bradbrad Posted December 13, 2012 Share Posted December 13, 2012 Im trying to create a if statement in my cms.tpl of the generic 1.5 theme. What I want is that if the category is "blog" (ID=6), then display the div. I tried {if $category=='blog'},<div></div>{/if} but that just hid the div on all categories Please please help! Link to comment Share on other sites More sharing options...
Alex Simonchik BelVG Posted December 13, 2012 Share Posted December 13, 2012 What is the "category" mean? Maybe it will helps you: {$cms->id}? Link to comment Share on other sites More sharing options...
bradbrad Posted December 13, 2012 Author Share Posted December 13, 2012 The category of the CMS. I have several categories (eg news, directory, etc), one being blog (its id is 6). I only want a certain div to display on the CMS pages that belong to the BLOG category. I will try cms>id (which will be 6) and will let you know Link to comment Share on other sites More sharing options...
bradbrad Posted December 13, 2012 Author Share Posted December 13, 2012 ok that works... partially... it only displays the div where the CMS PAGE id is 6. I need it to display on all CMS pages where the category is 6 Link to comment Share on other sites More sharing options...
bradbrad Posted December 13, 2012 Author Share Posted December 13, 2012 Just tried {if $cms_category->id=='6'} and that didnt work either Link to comment Share on other sites More sharing options...
Alex Simonchik BelVG Posted December 13, 2012 Share Posted December 13, 2012 In your place, I would create a module that would be attached to a new hook (for ex. HOOK_CMS_PAGE), in which the required content displayed on the page with the CMS. To determine whether the article is refered to the category or not you can with the table "cms" Regards Link to comment Share on other sites More sharing options...
bradbrad Posted December 13, 2012 Author Share Posted December 13, 2012 Is there not a simpler way to do it (with just a if statement?) Not accustomed to creating modules on prestashop! Link to comment Share on other sites More sharing options...
bradbrad Posted December 17, 2012 Author Share Posted December 17, 2012 Surely this must be possible with a if statement? Please assist, or let me know how to create a module for it Link to comment Share on other sites More sharing options...
Groove Posted December 17, 2012 Share Posted December 17, 2012 (edited) maybe one of these might work {if $cms_category eq 'blog'} or {if $cms_category eq 'id_6'} I done something very similar here http://www.prestashop.com/forums/topic/156984-solved-producttpl-attribute-conditions/page__p__762003 for a size chart Edited December 17, 2012 by Groove (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts