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...
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...
You could customize the products listing code with your templates and overrides of:
/includes/modules/product_listing.php
using the code in RED:
This example puts the date after the price ...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':
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!
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
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!
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.
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 .' '. 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.
Bookmarks