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

Need simpler function for cat id conditions...

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-14-2007, 03:57 PM
 
pdheady pdheady is offline
 

Advanced Member
  
Join Date: Mar 2007
Location: West Palm Beach, FL
Posts: 36
 

Default 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?
__________________
Xcart 4.0.19
Reply With Quote
  #2  
Old 03-14-2007, 08:30 PM
 
pdheady pdheady is offline
 

Advanced Member
  
Join Date: Mar 2007
Location: West Palm Beach, FL
Posts: 36
 

Default 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}
__________________
Xcart 4.0.19
Reply With Quote
  #3  
Old 03-26-2007, 01:27 PM
  designtheweb's Avatar 
designtheweb designtheweb is offline
 

Senior Member
  
Join Date: Mar 2005
Location: Sydney Australia
Posts: 132
 

Default 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
__________________
"The more you know - the less you pay"

Various websites using

4.66 Pro & 5
Reply With Quote
  #4  
Old 03-26-2007, 06:26 PM
 
pdheady pdheady is offline
 

Advanced Member
  
Join Date: Mar 2007
Location: West Palm Beach, FL
Posts: 36
 

Default 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.
__________________
Xcart 4.0.19
Reply With Quote
  #5  
Old 04-02-2007, 03:47 AM
  designtheweb's Avatar 
designtheweb designtheweb is offline
 

Senior Member
  
Join Date: Mar 2005
Location: Sydney Australia
Posts: 132
 

Default 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.
__________________
"The more you know - the less you pay"

Various websites using

4.66 Pro & 5
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > 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 07:31 AM.

   

 
X-Cart forums © 2001-2020