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)
-   -   Need simpler function for cat id conditions... (https://forum.x-cart.com/showthread.php?t=29693)

pdheady 03-14-2007 03:57 PM

Need simpler function for cat id conditions...
 
I'll keep it simple, Im building a custom menu that consists of a main menu and a submenu. The mainmenu and submenus are called if any category id condition is met as in the example below.

<?
if ($cat == 1 || $cat == 2 || $cat == 3 || $cat == 4 || $cat == 5 ) {
$menu = "dothismenu"; }

if ($cat == 3 || $cat == 4 ) { $submenu = "dothatmenu"; }

{/if}
{/if}

?>


Now I have hundreds of categories and I would rather find some better logic then to write all category id's illustrated above. It is very time consuming, and the other caveat is I have to manually go into the backend and update everytime a new category is added.

Is there a simpler way of performing this task, such as a smarty function or command to get the root level id, and 2nd level id based on the current catid?

pdheady 03-14-2007 08:30 PM

Re: Need simpler function for cat id conditions...
 
Well I figured it out.

This does the trick!

{if ($location[1].0) eq "this" }

do this

{/if}

{if ($location[2].0) eq "that" }

do that

{/if}

designtheweb 03-26-2007 01:27 PM

Re: Need simpler function for cat id conditions...
 
Can you please let me know where I might be able to see your working category model, i need to do something similar

pdheady 03-26-2007 06:26 PM

Re: Need simpler function for cat id conditions...
 
Unfortunately, I am not at liberty to show the clients site yet until it is live. If you have any questions in the meantime feel free to ask and I will try to help you out.

designtheweb 04-02-2007 03:47 AM

Re: Need simpler function for cat id conditions...
 
i am building categories based on states and suburbs and generally need to make it about 12 digits long, but csv doesn't seem to like it. I can't understand your methodology, can you explain it any easier please.


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

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