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)
-   -   How to use an "and" statement for 3 category menus (https://forum.x-cart.com/showthread.php?t=50846)

zebu 11-19-2009 03:53 PM

How to use an "and" statement for 3 category menus
 
Hi, I have created 3 category menus

1st menu displays categories with a POS between 1 and 10
2st menu displays categories with a POS between 11 and 99
3rdt menu displays categories with a POS between 100 and 999

Menu 1 & 3 are working fine.

Just need some help on how to use an "and" statement for menu 2 to only show products between 11 and 99 for Category Position.

Code I have is below:

What I really want is something like : {if $c.order_by gt 10 and lt 100 }

But doesn't seem to work - any hints from a Guru?

HTML Code:


{foreach from=$categories item=c}
    {if $c.order_by lt 100 }
            <table width="100%" cellpadding="0" cellspacing="0" border="0" valign="top">
                <tr valign="top">
                    <td width="100%" valign="top">
                    <a href="home.php?cat={$c.categoryid}" class="catnav"><b>{$c.category}</b></a>
                    {foreach from=$allcategories item=cat key=catid}
                    {if $cat.parentid eq $c.categoryid}
                    <a href="home.php?cat={$catid}" class="catnav_sub">&nbsp;&nbsp;&rsaquo;&nbsp;{$cat.category}</a>
                    {/if}               
                    {/foreach}
                    </td>
                </tr>
            </table>
    {/if}
        {/foreach}


Cheers Zane

zebu 11-19-2009 03:56 PM

Re: How to use an "and" statement for 3 category menus
 
Managed to get it to work using two if statements. Is this the best way?

{if $c.order_by lt 100 }
{if $c.order_by gt 10 }

geckoday 11-20-2009 06:11 AM

Re: How to use an "and" statement for 3 category menus
 
You were close. Try:

{if $c.order_by gt 10 and $c.order_by lt 100 }

Chris B 01-11-2010 07:09 AM

Re: How to use an "and" statement for 3 category menus
 
For 4.0x I'm looking to add a header to each of the broken out categories (Only if there are categories listed between the $categories[cat_num].order_by). Any ideas?

Here's my current code:

<p><font class="VertMenuTitleGold">Category Name One</font></p>
{section name=cat_num loop=$categories}
{if $categories[cat_num].order_by gt 200 AND $categories[cat_num].order_by lt 299}
<FONT class="CategoriesListCaps"><A href="home.php?cat={$categories[cat_num].categoryid}" class="VertMenuItemsWht">{$categories[cat_num].category}</A></FONT><BR>
{/if}
{/section}



<p><font class="VertMenuTitleGold">Category Name Two</font></p>
{section name=cat_num loop=$categories}
{if $categories[cat_num].order_by gt 300 AND $categories[cat_num].order_by lt 399}
<FONT class="CategoriesListCaps"><A href="home.php?cat={$categories[cat_num].categoryid}" class="VertMenuItemsWht">{$categories[cat_num].category}</A></FONT><BR>
{/if}
{/section}


Thanks...


All times are GMT -8. The time now is 09:42 AM.

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