Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2012
    Posts
    6
    Plugin Contributions
    0

    Default Adding Date Available to Product Listing

    Is there a method for adding the "This product will be in stock..." date to the Product Listing page outputs?
    I searched everywhere and nothing...

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

    Default Re: Adding Date Available to Product Listing

    You could customize the products listing code with your templates and overrides of:
    /includes/modules/product_listing.php

    using the code in RED:
    Code:
            $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
    // bof: add date available        
            $products_date_available = zen_products_lookup($listing->fields['products_id'], 'products_date_available');
            if ($products_date_available > date('Y-m-d H:i:s')) {
              $lc_text .= '<br />' . 'Available:' . zen_date_short($products_date_available);
            }
    // eof: add date available        
            break;
            case 'PRODUCT_LIST_QUANTITY':
    This example puts the date after the price ...
    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: v1.5.5]
    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!

  3. #3
    Join Date
    Jan 2012
    Posts
    6
    Plugin Contributions
    0

    Default Re: Adding Date Available to Product Listing

    Quote Originally Posted by Ajeh View Post
    You could customize the products listing code with your templates and overrides of:
    /includes/modules/product_listing.php

    using the code in RED:
    Code:
            $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
    // bof: add date available        
            $products_date_available = zen_products_lookup($listing->fields['products_id'], 'products_date_available');
            if ($products_date_available > date('Y-m-d H:i:s')) {
              $lc_text .= '<br />' . 'Available:' . zen_date_short($products_date_available);
            }
    // eof: add date available        
            break;
            case 'PRODUCT_LIST_QUANTITY':
    This example puts the date after the price ...
    Thank you very much, it worked!

    Greeting from argentina

  4. #4
    Join Date
    Apr 2006
    Location
    Dark Side of the Moon
    Posts
    987
    Plugin Contributions
    1

    Default Re: Adding Date Available to Product Listing

    Quote Originally Posted by Ajeh View Post
    You could customize the products listing code with your templates and overrides of:
    /includes/modules/product_listing.php

    using the code in RED:
    Code:
            $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
    // bof: add date available        
            $products_date_available = zen_products_lookup($listing->fields['products_id'], 'products_date_available');
            if ($products_date_available > date('Y-m-d H:i:s')) {
              $lc_text .= '<br />' . 'Available:' . zen_date_short($products_date_available);
            }
    // eof: add date available        
            break;
            case 'PRODUCT_LIST_QUANTITY':
    This example puts the date after the price ...
    Hiya Ajeh!

    I know some time ago you said you were working code to make the "Date Available" more usable. Namely, that if the product isn't yet available, you can show it, but not add to cart for checkout.
    Did this make it into 1.5?

    If not, would it require much modding to add?

    Thanks!
    Chaddro

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

    Default Re: Adding Date Available to Product Listing

    The same code would work in v1.5 but it is not a standard setting as some want people to pre-order and some do not ...

    So if you want it, you need to add the custom code yourself to your site ...
    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: v1.5.5]
    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!

  6. #6
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: Adding Date Available to Product Listing

    Twitch Add Date Available to Product Listing for 155f

    I've swirled together a simple build on the code mentioned in this thread that works with Zen Cart 1.55f using the long date format.


    Tuck it in right under the add to cart/sold out buttons in the product listing here...

    includes/modules/YOUR_TEMPLATE/product_listing.php
    replace this:
    $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');

    break;

    with this:
    $lc_text .= '' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '' : '') : '');

    // bof Twitch Add Product Date Available on Product Listing
    // quick lookup for the products_date_available for each product in the list
    $find_products_date_available = zen_products_lookup($listing->fields['products_id'], 'products_date_available');

    if ($find_products_date_available > date('Y-m-d H:i:s')) {
    $lc_text .= '<div class="pL_productDateAvailable">' . 'Available on ' . zen_date_long($find_products_date_available) . '</div>';
    }
    // eof Twitch Add Product Date Available on Product Listing

    break;



    Some nice green text using margins for space...

    includes/templates/YOUR_TEMPLATE/css/stylesheet.css
    add to the bottom of your stylesheet
    :
    .pL_productDateAvailable {
    margin: .5em auto;
    font-size: 1.2em;
    color: #3AB54A;
    font-weight: bold;
    }



    The CSS class mimics the name of the one used in the tpl_product_info_display.php for the same use - displaying date added on the product info page.

    Display Options:
    - No date found -> Display nothing
    - Date found -> Display long date
    - Date Passed -> Display nothing


    In the future this could be tied to the switch being used on the product landing page already - $flag_show_product_info_date_available

    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base8 - Obsidian - This, is what's new.

  7. #7
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Idea or Suggestion Re: Adding Date Available to Product Listing

    Update for those looking to add Date Added to New Products Listing:

    includes/templates/YOUR_TEMPLATE/templates/tpl_modules_products_new_listing.php - Zen 1.57c...

    change this:
    <?php if (PRODUCT_NEW_LIST_DESCRIPTION > '0') { ?>
    <div class="clearBoth listings-description">
    <?php
    echo $display_products_description;
    ?>
    </div>

    </div>

    <?php
    $products_new->MoveNext();


    to this:
    <?php if (PRODUCT_NEW_LIST_DESCRIPTION > '0') { ?>
    <div class="clearBoth listings-description">
    <?php
    echo $display_products_description;
    ?>
    </div>
    <?php } ?>

    <?php // if ( add switch controls here if needed) { // Twitch Add Date Added to New Products Listing ?>
    <div id="productDateAdded" class="productGeneral centeredContent"><?php echo TEXT_DATE_ADDED .'&nbsp;'. zen_date_long($products_new->fields['products_date_added']); ?></div>
    <?php // } ?>

    </div>

    <?php
    $products_new->MoveNext();
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base8 - Obsidian - This, is what's new.

 

 

Similar Threads

  1. Adding Date Available to Product Listing page
    By safarce in forum General Questions
    Replies: 0
    Last Post: 14 Jun 2011, 07:04 PM
  2. Replies: 3
    Last Post: 30 Sep 2010, 11:23 PM
  3. Displaying Available date on Listing & Shopping Cart
    By wygk in forum General Questions
    Replies: 0
    Last Post: 3 Jul 2010, 05:46 PM
  4. add date available to product listing
    By moniek in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 16 Nov 2008, 10:03 AM
  5. Adding "Date Available" to Product Listing
    By blackpaladin in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 19 Dec 2007, 02:52 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR