I have a category for clearance items (master_categories_id 284). I'd like to display the text "discontinued" on the product info page where the item is in the clearance category. Can anyone help me accomplish this?
I have a category for clearance items (master_categories_id 284). I'd like to display the text "discontinued" on the product info page where the item is in the clearance category. Can anyone help me accomplish this?
see this post: http://www.zen-cart.com/showthread.p...056#post695056
Twitch Add Title to Product Based on Category Name
add this to includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php
This should work nicely :)PHP Code:
<?php
// bof Twitch Add Title to Product Based on Category Name
$find_the_category_name = zen_get_categories_name(zen_get_products_category_id((int)$_GET['products_id']), $_SESSION['languages_id']);
// Note: Your category name must exactly match the name used in the next line between the quotes.
if ($find_the_category_name == 'Discontinued') {
//echo $find_the_category_name;
echo '<span class="alert"><strong> This Product has been discontinued </strong></span>';
} else {
//do nothing or add your text here
}
// eof Twitch Add Title to Product Based on Category Name
?>
Last edited by twitchtoo; 3 Mar 2015 at 07:51 PM.
Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
Twitch Base8 - Obsidian - This, is what's new.
Much simpler and far easier to maintain is to use the stylesheets to your advantage:
http://www.zen-cart.com/wiki/index.p...Per-Page-Rules
For an explanation of why (describing pages in general) see: http://www.zen-cart.com/wiki/index.p...dividual_Pages
Could delete the above as after rereading the desired action (adding text) it may not be as easy, but might still be possible.
Last edited by mc12345678; 3 Mar 2015 at 10:10 PM.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
I did it like this:
Code:<?php if ($cPath == 284) { echo '<div class="productIcon disc">'.TITLE_TXT_CLEARANCE.'</div>'; }?>
Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
Twitch Base8 - Obsidian - This, is what's new.
Hm, so that only works if I click on the product from the clearance category.. but a product in clearance may be listed in multiple categories. And if I click on it from a linked category, it doesn't display the "clearance" text. I need to specify the master_categories_id...
You can get the current categories_id with:
$current_category_id
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!
This works:
Code:<?php $clearlink = zen_product_in_category($_GET['products_id'], 284); if ($clearlink == 1) { echo '<div class="productIcon disc">'.TITLE_TXT_CLEARANCE.'</div>'; }?>
Bookmarks