My auctions are able to be seen by users (not bid on) after they are closed. Is there a way to make it so they are invisible to users (but not admins) once they are closed?
1. In the tables/products/fields.ini file, change the first line from
__sql__="select p.*,current_high_bid from products p left join (select product_id,max(bid_amount) as current_high_bid from bids group by product_id) as b on p.product_id=b.product_id"
to
__sql__="select p.*,current_high_bid, c.close_date from products p left join (select product_id,max(bid_amount) as current_high_bid from bids group by product_id) as b on p.product_id=b.product_id left join closed c on p.product_id=c.product_id"
(i.e. we are adding a caculated field close_date to the products table).
2. In the tables/products/products.php file, find the block__result_list method. It will look like:
- Code: Select all
function block__result_list(){
if ( isAdmin() ) return PEAR::raiseError("Just show the default list");
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
$products = df_get_records_array('products', $query);
df_display(array('products'=>&$products), 'public_product_list.html');
}
Add a line:
- Code: Select all
$query['close_date'] = '>';
SO that it becomes:
- Code: Select all
function block__result_list(){
if ( isAdmin() ) return PEAR::raiseError("Just show the default list");
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
$query['close_date'] = '>';
$products = df_get_records_array('products', $query);
df_display(array('products'=>&$products), 'public_product_list.html');
}
This will make it so that average users will only see the auctions that are not closed yet. The admins will still see all auctions.
-Steve