Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing date added to date modified


diy

Recommended Posts

This product was added to our catalog on Thursday 05 April, 2007.

 

does not have a meaning after a while and it also gives an impression that your products just stay there getting old (some actually do)

 

So I am trying to change that to date modified which is not so hard

 

BUT

 

 

whan you 1st enter a product it is considered an entry and not a modification so some products that are on the site may not have a modification date and new products will have to be entered and then modified a bit to get a modification date (its an annoying second click that you may forget).

 

Do you have any suggestions for that?

 

PS (I mean making the 1st entry date date_added as a modification date as well date_modified)

Link to comment
Share on other sites

in product_info.php look for:

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

change it to:

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_last_modified, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

then when your displaying the date change this:

 

<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>

 

to:

 

<td align="center" class="smallText">
<?php
if($product_info['products_last_modified'])
{
  echo sprintf(TEXT_DATE_MODIFIED, tep_date_long($product_info['products_last_modified']));
}
else
{
  echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added']));
}
?>
</td>

 

You'll also need to add the following to /includes/languages/english/product_info.php

 

define('TEXT_DATE_MODIFIED', 'This product was modified on %s.');

 

anywhere before the closing ?>

 

BACKUP YOUR WORK BEFORE MAKING THESE CHANGES ... I DIDNT TEST THIS SO LET ME KNOW IF IT DOESNT WORK!!

Link to comment
Share on other sites

Thank you I tested it and i think that the

 

if($product_info['products_last_modified'])
{
  echo sprintf(TEXT_DATE_MODIFIED, tep_date_long($product_info['products_last_modified']));

does not work

 

when the product was modified it gives no date when the products was NOT modified it gives date_added

Link to comment
Share on other sites

Thank you I tested it and i think that the

 

if($product_info['products_last_modified'])
{
  echo sprintf(TEXT_DATE_MODIFIED, tep_date_long($product_info['products_last_modified']));

does not work

 

when the product was modified it gives no date when the products was NOT modified it gives date_added

 

So it doesnt spit out a date when the product has been modified?? does it at least print the text "This product was modified on .." ??

Link to comment
Share on other sites

So it doesnt spit out a date when the product has been modified?? does it at least print the text "This product was modified on .." ??

Hey Slav

 

The changes worked for me. It shows This product was modified on Tuesday 13 January, 2009. when I changed some text today.

Link to comment
Share on other sites

Hey Slav

 

The changes worked for me. It shows This product was modified on Tuesday 13 January, 2009. when I changed some text today.

 

Excellent thanks for testing + reporting Leslie :)

Link to comment
Share on other sites

Sorry everybody for wasting your time the code actually works if you follow ALL the instructions (I did not) so ignore my post #3!!

No problem, glad it is working for you.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...