Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Hiding categories

 
Reply
   X-Cart forums > X-Cart 4 > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-23-2008, 02:38 PM
 
jholley jholley is offline
 

Advanced Member
  
Join Date: Jan 2007
Posts: 66
 

Default 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
Reply With Quote
  #2  
Old 12-24-2008, 08:51 AM
  Dmitri's Avatar 
Dmitri Dmitri is offline
 

Senior Member
  
Join Date: Jul 2003
Location: Toronto
Posts: 174
 

Default 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
Reply With Quote
  #3  
Old 12-24-2008, 07:25 PM
 
jholley jholley is offline
 

Advanced Member
  
Join Date: Jan 2007
Posts: 66
 

Default 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
Reply With Quote
  #4  
Old 12-24-2008, 11:29 PM
  Dmitri's Avatar 
Dmitri Dmitri is offline
 

Senior Member
  
Join Date: Jul 2003
Location: Toronto
Posts: 174
 

Default 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
Reply With Quote
  #5  
Old 12-26-2008, 11:33 AM
 
jholley jholley is offline
 

Advanced Member
  
Join Date: Jan 2007
Posts: 66
 

Default Re: Hiding categories

That worked great.

The smarty.net website is an awesome resource.

thanks for your help
__________________
Joe Holley
4.2
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:37 AM.

   

 
X-Cart forums © 2001-2020