![]() |
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 |
Re: Root category display only
First categoty in category path:
PHP Code:
|
Re: Root category display only
Thank you so much Yurij, it helped me.
|
Re: Root category display only
Hi Yurij, do you know how can I display root category id? Many thanks.
|
Re: Root category display only
Suppose it to be zero.
|
Re: Root category display only
Quote:
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? |
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:"/^[^=]*/":""} For the root cat it will print nothing since root cat URL is home.php |
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.