![]() |
root cat
is there root cat syntax?
like {if root_cat eq 255} blah blah blah {/if} Ash |
Re: root cat
if $cat eq "1" or $current_category.parentid eq "1"
|
Re: root cat
but what if the are ina sub sub sub cat... you know 4 levels down?
|
Re: root cat
paul,
didn't work at all. nothing showed. |
Re: root cat
$cat is the current category id
$current_category.parentid is one level up obviously (which will work if you have only one level down) There is also $current_category.categoryid_path which first element will be the first category id for the sub sub sub cat. It is in the form of 123/234/345... |
Re: root cat
how do you do a foreach from a certain category only?
like say list sub one level down just from cat 255 |
Re: root cat
How about this
<ul> {foreach from=$allsubcategories item=c} {if $c.parentid eq "255"} <li>$c.category</li> {/if} {/foreach} </ul> If you don't have $allsubcategories this is how to get them (I can't remember the thread) add to /include/categories.php at the end before subcategories and cat assigns Code:
function func_getallsubcat() |
Re: root cat
couldn't figure it out, so I hard coded it.
Here the whole scenario. There are 10 root cats all together. 5 of them have a sub cat that list gemstone cats so rings > gemstone rings > Amethyst, Pearl, Emerald, Garnet Ruby ect... earrings > gemstone earrings> Amethyst, Pearl, Emerald, Garnet Ruby ect... I want to list the sub cats of the gemstone rings on the rings root cat page and I want to list the sub cats of the gemstone earrings on the earrings root cat page |
Re: root cat
Ok try in subcategories template used to show subcats
<ul> {if $cat eq "rings"} {foreach from=$allsubcategories item=c} {if $c.parentid eq "gemstone rings"} <li>$c.category</li> {/if} {/foreach} {elseif $cat eq "earrings"} {foreach from=$allsubcategories item=c} {if $c.parentid eq "gemstone earrings"} <li>$c.category</li> {/if} {/foreach} {/if} </ul> Replace cat names with cat numbers |
Re: root cat
ok thanks, will try that.
Ash |
| All times are GMT -8. The time now is 03:52 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.