Hiding categories
Does anyone know how I could hide two categories from displaying in categories.tpl.
We have two categories that are accessed through a separate drop-down box and would like to hide them from the normal category displays. any help would be greatly appreciated! |
Re: Hiding categories
Hello Joe
Add the logic into the /skin1/customer/category.tpl {if $categories[cat_num].categoryid eq XXX}...{/if} where XXX is the category id, and display only those that match (or don't match) your category id. You can lookup the category ID in admin module, or mouse over the link on front home.php?cat=XXX Hope that helps. |
Re: Hiding categories
Well, I seem to be making this harder than it should be.
This is the original code. <ul> {foreach from=$categories_menu_list item=c} <li><a href="home.php?cat={$c.categoryid}" title="{$c.category|escape}">{$c.category}</a></li> {/foreach} </ul> {assign var="additional_class" value="menu-categories-list"} This is what I did <ul> {foreach from=$categories_menu_list item=c} {if $categories[cat_num].categoryid eq XXX} <li><a href="home.php?cat={$c.categoryid}" title="{$c.category|escape}">{$c.category}</a></li> {/if} {/foreach} </ul> {assign var="additional_class" value="menu-categories-list"} If I put any id, other than 0 in the place of XXX, all the categories are dropped. Am I missing something obvious? Thanks for your help. |
Re: Hiding categories
Replace "eq" with "neq"
Current condition tells to display the category when the category id equals to the XXX. If you put "neq" this will mean display when the category id not equal to the XXX, thus will display everything except the XXX {if $categories[cat_num].categoryid neq XXX} ... {/if} will display all categories but XXX {if $categories[cat_num].categoryid == XXX || $categories[cat_num].categoryid == YYY} ... {/if} will display only categories XXX and YYY there is more on smarty conditions here: http://www.smarty.net/manual/en/language.function.if.php |
Re: Hiding categories
That worked great.
The smarty.net website is an awesome resource. thanks for your help |
All times are GMT -8. The time now is 03:53 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.