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

Root category display only

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-28-2008, 12:35 PM
 
risecreativegroup risecreativegroup is offline
 

Newbie
  
Join Date: Aug 2008
Posts: 4
 

Default Root category display only

How can I display level one or root category. The one after store name.
I am trying to add CSS class to body tag based on the root category. Currently display root and subcategories together.

just like location.tpl but not looping through all root category and subs only root category I am interested in.

Or give me idea how to search for the first category in categoryid_path

just like str_instr in php how do I search for particular category in the category path.

Thanks
__________________
4.1.10
Reply With Quote
  #2  
Old 10-29-2008, 12:26 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: Root category display only

First categoty in category path:

PHP Code:
name - {$location[1].0}
url - {$location[1].1
Reply With Quote
  #3  
Old 11-04-2008, 12:11 PM
 
risecreativegroup risecreativegroup is offline
 

Newbie
  
Join Date: Aug 2008
Posts: 4
 

Default Re: Root category display only

Thank you so much Yurij, it helped me.
__________________
4.1.10
Reply With Quote
  #4  
Old 03-20-2009, 12:43 AM
 
TanyaG TanyaG is offline
 

Advanced Member
  
Join Date: Nov 2007
Posts: 94
 

Default Re: Root category display only

Hi Yurij, do you know how can I display root category id? Many thanks.
__________________
Tanya

x-cart version: 4.1.7 4.1.9. 4.2
Reply With Quote
  #5  
Old 03-20-2009, 01:03 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: Root category display only

Suppose it to be zero.
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote
  #6  
Old 03-25-2009, 01:08 AM
 
TanyaG TanyaG is offline
 

Advanced Member
  
Join Date: Nov 2007
Posts: 94
 

Default Re: Root category display only

Quote:
Originally Posted by Victor D
Suppose it to be zero.

Thank you for your reply. The {$location[1].0} displays name of root subcategory but I need to find the way to display this subcategory id. Do you know how can I do it?
__________________
Tanya

x-cart version: 4.1.7 4.1.9. 4.2
Reply With Quote
  #7  
Old 03-25-2009, 02:03 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: Root category display only

The categoryid is not passed thru location array by default.
So you can:
1. modify PHP code to pass it
2. pull all the categories with their ids from db, pass them to template and find id that corresponds required category name (PHP again)
3. Parse category URL to get it's number

The third way is the easiest one
like this:
Code:
{assign var=substr value=$location[1].1|regex_replace:"/^[^=]*/":""} {$substr|regex_replace:"/\D*/":""}

For the root cat it will print nothing since root cat URL is home.php
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote

The following user thanks Victor D for this useful post:
TanyaG (03-25-2009)
  #8  
Old 03-25-2009, 03:40 AM
 
TanyaG TanyaG is offline
 

Advanced Member
  
Join Date: Nov 2007
Posts: 94
 

Default Re: Root category display only

Victor, thanks a lot for your help. Works perfectly.
__________________
Tanya

x-cart version: 4.1.7 4.1.9. 4.2
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 12:45 PM.

   

 
X-Cart forums © 2001-2020