X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Exclude Certain Categories From Category List (https://forum.x-cart.com/showthread.php?t=60968)

gatordp 09-22-2011 02:56 AM

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}


rogue 09-22-2011 05:00 AM

Re: Exclude Certain Categories From Category List
 
Why not make your if

{if $c.categoryid lt 500}

gb2world 09-22-2011 11:10 AM

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

---

gatordp 09-23-2011 02:29 AM

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}


cflsystems 09-23-2011 03:03 AM

Re: Exclude Certain Categories From Category List
 
Use smarty operators
> - gt
< - lt
>= - gte
<= - lte
= - eq
!= - ne

rogue 09-23-2011 04:55 AM

Re: Exclude Certain Categories From Category List
 
You left the old IF in the code - remove it.

{if $c.avail ne "H"}

gatordp 09-28-2011 02:35 AM

Re: Exclude Certain Categories From Category List
 
That worked - thanks!


All times are GMT -8. The time now is 07:03 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.