Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

print date on product listing


Guest

Recommended Posts

I have a client who wants to add a column on the product listing with the date added of each product so that the customer can sort by release/added date directly from the listing just like you can by price, name etc...

I've tried both adding a new column and changing the weight column (which we aren't using) to print out the date with no success. I'm not a PHP guru unfortunately. I haven't found a contribution that would do this, has anyone done this on their site or know what I should do to accomplish this?

 

Thanks for any help you can assist me with. :'(

Link to comment
Share on other sites

Hi - the date a product was added is already in your products database - all you have to do is add this code into your product_info.php file where you want the date to appear -

<?php echo $product_info['products_date_added']; ?>

 

Im pretty sure this will work for you!

Please note - if I have suggested a contrib above, it doesnt mean it will work! Most of the contribs are not ones I've used, but may be useful for your particular problem....

Have you tried a refined search? Chances are your problem has already been dealt with elsewhere on the forums.....

if (stumped == true) {

return(square_one($start_over)

} else {

$random_query = tep_fetch_answer($forum_query)

}

Link to comment
Share on other sites

Not on the product info page, I need it to show up on the product listing page, where you can sort by product name etc...

 

 

 

Hi - the date a product was added is already in your products database - all you have to do is add this code into your product_info.php file where you want the date to appear -
<?php echo $product_info['products_date_added']; ?>

 

Im pretty sure this will work for you!

Link to comment
Share on other sites

sorry, misunderstood. You need to add the code into your catalog/includes/modules/product_listing.php file - I think it could need quite a bit of extyra coding, but just try adding that line in on its own first to see whether it works. If not, give me a yell on pm and I'll try to look at it some more for you. :'(

Please note - if I have suggested a contrib above, it doesnt mean it will work! Most of the contribs are not ones I've used, but may be useful for your particular problem....

Have you tried a refined search? Chances are your problem has already been dealt with elsewhere on the forums.....

if (stumped == true) {

return(square_one($start_over)

} else {

$random_query = tep_fetch_answer($forum_query)

}

Link to comment
Share on other sites

Did it work? Would you please let me know? I too would like to add that feature.

 

thanks,

 

Laney

 

Not on the product info page, I need it to show up on the product listing page, where you can sort by product name etc...

"There are only 10 types of people in this world: those who understand binary, and those who don't. "

Link to comment
Share on other sites

Yes, I finally got it to work. What I did was change the Weight column to list the date instead. we weren't showing the weight column on the product listing.

 

I changed a couple of things:

 

in the product_listing.php in includes/modules:

 

case 'PRODUCT_LIST_WEIGHT':

$lc_text = TABLE_HEADING_DATE_ADDED;

$lc_align = 'right';

break;

 

and

 

case 'PRODUCT_LIST_WEIGHT':

$lc_align = 'right';

$lc_text = ' ' . tep_date_short($listing_values['products_date_added']) . ' ';

break;

 

In index.php and advanced_search_result.php I added p.products_date_added to all the $listing_sql's

ie. p.products_price, p.products_date_added,.....

 

changed:

 

case 'PRODUCT_LIST_WEIGHT': $select_column_list .= 'p.products_date_added';

break;

 

and

 

case 'PRODUCT_LIST_WEIGHT': $listing_sql .= "p.products_date_added " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";

 

And added

 

define('TABLE_HEADING_DATE_ADDED', 'Date');

 

to the language files.

 

 

 

sorry, misunderstood. You need to add the code into your catalog/includes/modules/product_listing.php file - I think it could need quite a bit of extyra coding, but just try adding that line in on its own first to see whether it works. If not, give me a yell on pm and I'll try to look at it some more for you. :'(

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...