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)
-   -   Root category display only (https://forum.x-cart.com/showthread.php?t=43300)

risecreativegroup 10-28-2008 12:35 PM

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

Yurij 10-29-2008 12:26 AM

Re: Root category display only
 
First categoty in category path:

PHP Code:

name - {$location[1].0}
url - {$location[1].1


risecreativegroup 11-04-2008 12:11 PM

Re: Root category display only
 
Thank you so much Yurij, it helped me.

TanyaG 03-20-2009 12:43 AM

Re: Root category display only
 
Hi Yurij, do you know how can I display root category id? Many thanks.

Victor D 03-20-2009 01:03 AM

Re: Root category display only
 
Suppose it to be zero.

TanyaG 03-25-2009 01:08 AM

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?

Victor D 03-25-2009 02:03 AM

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

TanyaG 03-25-2009 03:40 AM

Re: Root category display only
 
Victor, thanks a lot for your help. Works perfectly.


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

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