Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2008
    Location
    Victoria AU
    Posts
    48
    Plugin Contributions
    0

    Default Show Modified Date on Product Pages

    How would I go about changing the information shown at the bottom of the product pages to a modified date, rather than the date added.

    eg
    Currently: This product was added to our catalog on Wednesday 30 January, 2013
    Preferred: This product was last updated on Thursday 11 July 2013.

    I know the field "products_last_modified" is available in the database, but my php/zencart skills just aren't up to the task of dealing with the null values that are present if the product has never been updated. Otherwise I think I could hack together a solution.

    Any help would be greatly appreciated.

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Show Modified Date on Product Pages

    I would fetch both the date-added and last-modified from the db, then check for last-modified being null and substitute date-added in that case, to send to output.

  3. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Show Modified Date on Product Pages

    You could customize the file:
    /includes/templates/template_default/templates/tpl_product_info_display.php

    and using your templates and overrides, customize the code:
    Code:
        if ($flag_show_product_info_date_added == 1) {
    ?>
          <p id="productDateAdded" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_ADDED, zen_date_long($products_date_added)); ?></p>
    <?php
        } // $flag_show_product_info_date_added
    and change it by adding the code in RED:
    Code:
        if ($flag_show_product_info_date_added == 1) {
    ?>
    <?
    define('TEXT_DATE_MODIFIED', 'This product was last updated on %s');
    $chk_date_added = zen_products_lookup((int)$_GET['products_id'], 'products_date_added');
    $chk_date_modified = zen_products_lookup((int)$_GET['products_id'], 'products_last_modified');
    if ($chk_date_modified <= $chk_date_added) {
    ?>
          <p id="productDateAdded" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_ADDED, zen_date_long($products_date_added)); ?></p>
    <?php } else { ?>
          <p id="productDateAdded" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_MODIFIED, zen_date_long($chk_date_modified)); ?></p>
    <?php } ?>
    <?php
        } // $flag_show_product_info_date_added
    then change your language file, again using your templates and overrides for the DEFINE for TEXT_DATE_ADDED to alter the text on how it reads ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  4. #4
    Join Date
    Mar 2008
    Location
    Victoria AU
    Posts
    48
    Plugin Contributions
    0

    Default Re: Show Modified Date on Product Pages

    Quote Originally Posted by Ajeh View Post
    You could customize the file:
    /includes/templates/template_default/templates/tpl_product_info_display.php
    Thanks for this, I will give it a try. Much appreciated.

 

 

Similar Threads

  1. Date problem on customers last modified
    By wirefram in forum General Questions
    Replies: 0
    Last Post: 4 Nov 2011, 10:25 PM
  2. last modified Date
    By purelypoultry in forum Basic Configuration
    Replies: 1
    Last Post: 28 Jan 2010, 12:06 PM
  3. Product - show date available
    By icemanchai in forum Setting Up Categories, Products, Attributes
    Replies: 6
    Last Post: 23 Aug 2006, 10:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg