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


Reply With Quote
