| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Hiding categories | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
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!
__________________
Joe Holley 4.2 |
|||||||
#2
|
|||||||||
|
|||||||||
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.
__________________
CartTemplates | ASF Design Inc ~~~ CartTemplates.com | XCart Design - Custom design or Choose from thousands of templates that can be integrated with X-Cart. tel: +1 (416) 410-9995 |
|||||||||
#3
|
|||||||
|
|||||||
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.
__________________
Joe Holley 4.2 |
|||||||
#4
|
|||||||||
|
|||||||||
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
__________________
CartTemplates | ASF Design Inc ~~~ CartTemplates.com | XCart Design - Custom design or Choose from thousands of templates that can be integrated with X-Cart. tel: +1 (416) 410-9995 |
|||||||||
#5
|
|||||||
|
|||||||
Re: Hiding categories
That worked great.
The smarty.net website is an awesome resource. thanks for your help
__________________
Joe Holley 4.2 |
|||||||
|
|||
X-Cart forums © 2001-2020
|