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

Exclude Certain Categories From Category List

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-22-2011, 02:56 AM
 
gatordp gatordp is offline
 

Advanced Member
  
Join Date: Aug 2009
Posts: 72
 

Default Exclude Certain Categories From Category List

I saw this thread in the 4.1x forums
http://forum.x-cart.com/showthread.php?t=23766&highlight=Exclude+Certain+C ategories+From+Category+List

But I tried it, and it did not on 4.2.2. Basically you assign a category you want to exclude with a high Category ID, like 500. Then you add an "if statement" to the categories.tpl file saying if category ID is > 500 then exclude.

Does anyone know how to do this?

Here is my categories.tpl

Code:
{* $Id: categories.tpl,v 1.33 2008/11/06 16:53:53 max Exp $ vim: set ts=2 sw=2 sts=2 et: *} {capture name=menu} {if $active_modules.Fancy_Categories} {include file="modules/Fancy_Categories/categories.tpl"} {assign var="additional_class" value="menu-fancy-categories-list"} {else} <ul class="nav_list"> {foreach from=$categories_menu_list item=c} {if $c.avail ne "H"} <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} {/capture} {include file="customer/menu_dialog.tpl" title=$lng.lbl_categories content=$smarty.capture.menu}
__________________
X-Cart Gold 4.5.4
Reply With Quote
  #2  
Old 09-22-2011, 05:00 AM
  rogue's Avatar 
rogue rogue is offline
 

X-Adept
  
Join Date: Apr 2007
Location: Loveland, Ohio
Posts: 770
 

Default Re: Exclude Certain Categories From Category List

Why not make your if

{if $c.categoryid lt 500}
__________________
Richard Williams
Rogue Wave Limited

Initial Inventory Imports
Daily Inventory Updates
Daily Inventory Reports
Drop Ship Support
Order Export to Shipper/Supplier
Shopping Feeds That Work
Programming for X-Cart

richard@roguewavelimited.com
http://www.roguewavelimited.com
Reply With Quote
  #3  
Old 09-22-2011, 11:10 AM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Exclude Certain Categories From Category List

It will be easier to control using the position rather than the categoryid. You can set the position number in the category administration page. Your if/than inside the loop will be based on $c.order_by

---
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #4  
Old 09-23-2011, 02:29 AM
 
gatordp gatordp is offline
 

Advanced Member
  
Join Date: Aug 2009
Posts: 72
 

Default Re: Exclude Certain Categories From Category List

Do you know what the piece of if code should look like?

I tried this: {if $c.order_by < 500}

And got a smarty error meesage
Code:
{* $Id: categories.tpl,v 1.33 2008/11/06 16:53:53 max Exp $ vim: set ts=2 sw=2 sts=2 et: *} {capture name=menu} {if $active_modules.Fancy_Categories} {include file="modules/Fancy_Categories/categories.tpl"} {assign var="additional_class" value="menu-fancy-categories-list"} {else} <ul class="nav_list"> {foreach from=$categories_menu_list item=c} {if $c.avail ne "H"} {if $c.order_by < 500} <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} {/capture} {include file="customer/menu_dialog.tpl" title=$lng.lbl_categories content=$smarty.capture.menu}
__________________
X-Cart Gold 4.5.4
Reply With Quote
  #5  
Old 09-23-2011, 03:03 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: Exclude Certain Categories From Category List

Use smarty operators
> - gt
< - lt
>= - gte
<= - lte
= - eq
!= - ne
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #6  
Old 09-23-2011, 04:55 AM
  rogue's Avatar 
rogue rogue is offline
 

X-Adept
  
Join Date: Apr 2007
Location: Loveland, Ohio
Posts: 770
 

Default Re: Exclude Certain Categories From Category List

You left the old IF in the code - remove it.

{if $c.avail ne "H"}
__________________
Richard Williams
Rogue Wave Limited

Initial Inventory Imports
Daily Inventory Updates
Daily Inventory Reports
Drop Ship Support
Order Export to Shipper/Supplier
Shopping Feeds That Work
Programming for X-Cart

richard@roguewavelimited.com
http://www.roguewavelimited.com
Reply With Quote
  #7  
Old 09-28-2011, 02:35 AM
 
gatordp gatordp is offline
 

Advanced Member
  
Join Date: Aug 2009
Posts: 72
 

Default Re: Exclude Certain Categories From Category List

That worked - thanks!
__________________
X-Cart Gold 4.5.4
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 11:36 AM.

   

 
X-Cart forums © 2001-2020