Page 1 of 1

open and closing

PostPosted: Mon Oct 27, 2008 10:24 pm
by martin
Hi All

is there any way to set the default closing date 31 days after a item has been posted and to display days left below the item before close
please explain in detail i am new to this

PostPosted: Tue Oct 28, 2008 8:35 pm
by shannah
Is there any way to set the default closing date 31 days after a item has been posted


Implement the closing_time__default() method in the tables/products/products.php class.

e.g.
Code: Select all
function closing_time__default(){
    return date('Y-m-d H:i:s', time()+(31*24*60*60));
}


display days left below the item before close


2 Steps.

1. Add a calculated field to the tables/products/products.php delegate class to show the number of days until closing:
Code: Select all
function field__days_left(&$record){
    return (round((strtotime($record->strval('closing_time'))-time())/(24*60*60)));
}

(You may need to play with this a little to get it to work, as I haven't tested it).

2. Then add the following to the templates/view_product.html template where you want this figure to appear:
Code: Select all
{$product->val('days_left')}



-Steve