Guest bigblock Posted September 4, 2011 Share Posted September 4, 2011 I need to use different product templates based on which category the product is in. How would I go about doing that? I don't see any info about this. -sean Quote Link to comment Share on other sites More sharing options...
Robsta Posted September 4, 2011 Share Posted September 4, 2011 Depends on which version of CC you're using. Quote Link to comment Share on other sites More sharing options...
Guest bigblock Posted September 4, 2011 Share Posted September 4, 2011 Depends on which version of CC you're using. I'm using v5 ~ I would up adding some stuff to catalogue.class.php: // Customize template by category id $catid = $product['cat_id']; if($catid == 2){ $usetemplate = 'content.product.retail.php'; }else if($catid == 3){ $usetemplate = 'content.product.bulk.php'; }else{ $usetemplate = 'content.product.case.php'; } $content = $GLOBALS['smarty']->fetch('templates/' . $usetemplate ); //$content = $GLOBALS['smarty']->fetch('templates/content.product.custom.php'); -sean Quote Link to comment Share on other sites More sharing options...
Homar Posted September 5, 2011 Share Posted September 5, 2011 Modifying the classes is never a good idea. Besides, you can do this using SMARTY. {$PRODUCT.cat_id} holds the product's category ID. You can then use this with the technique outlined here: Quote Link to comment Share on other sites More sharing options...
Robsta Posted September 5, 2011 Share Posted September 5, 2011 Moved to v5 support. Quote Link to comment Share on other sites More sharing options...
Guest bigblock Posted September 5, 2011 Share Posted September 5, 2011 Modifying the classes is never a good idea. Besides, you can do this using SMARTY. {$PRODUCT.cat_id} holds the product's category ID. You can then use this with the technique outlined here: Thanks Homar; I got around this by replacing the content of the content.product.php with this: {if $PRODUCT.cat_id == 2} {include scope=parent file="skins/$SKIN_FOLDER/templates/content.product.retail.php"} {else} {include scope=parent file="skins/$SKIN_FOLDER/templates/content.product.bulk.php"} {/if} works just fine. -sean Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.