is it possible to use a separate template for a particular product but all others use default?
such as item-123 uses product template abc123.tpl but all others use standard
thanks
is it possible to use a separate template for a particular product but all others use default?
such as item-123 uses product template abc123.tpl but all others use standard
thanks
peace
You can style the product whose product_id value is 123 differently from all other products by creating a p_123.css file in your custom template's css directory (/includes/templates/YOUR_TEMPLATE/css/p_123.css).
thanks
thing is, i gotta change the content there too
peace
You could create the file /includes/templates/YOUR_TEMPLATE/product_info/extra_main_template_vars/product_123.php:
You will probably need the p_123.css file, too ...Code:<?php if (((int)$_GET['products_id']) == 123) { // Retrieve any special stuff you need from the database $tpl_page_body = 'tpl_product_info_display_123.php'; // Use the file /includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display_123.php to format this special product's information }
wow, nice!
i'd need to exclude the default pricing and other stuff as well cuz this is a customized product that goes beyond the cart capability presently
think i could tweak the default template call kinda like this:
Code:<?php if (((int)$_GET['products_id']) == 123) { // use special template $tpl_page_body = 'tpl_product_info_display_123.php'; // Use the file /includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display_123.php //to format this special product's information } else { // use normal template { // normal product template code here } };
peace
The normal template (tpl_product_info_display.php) will have already been set into the $tpl_page_body variable by /includes/modules/pages/product_info/main_template_vars.php's processing. All you need to do in your override is to set the name of the template file that will process that special product (and edit the special product's template file to do what you want).
i think i see the spot, around the following location:
Code:if ( $res->fields['total'] < 1 ) { $tpl_page_body = '/tpl_product_info_noproduct.php'; } else { $tpl_page_body = '/tpl_product_info_display.php';
peace
If you follow lat9's suggestion, you won't need to touch the stock main_template_vars.php at all - always a good thing to avoid editing existing files when you can make a new one that will allow for upgrades without having to maintain/merge stock files.
I guess I'm not sure how to do the overrideAll you need to do in your override is to set the name of the template file that will process that special product (and edit the special product's template file to do what you want).
I've figured out some other override stuff but not sure about this one
peace
I haven't used this variant of override directories myself, but I believe if you simply make that file with just the content shown and put it in that folder path, Zen Cart will automatically detect and use it in the appropriate circumstances (product 123's info page).You could create the file /includes/templates/YOUR_TEMPLATE/product_info/extra_main_template_vars/product_123.php:
Bookmarks