rikito
February 27, 2007, 12:00am
#1
excuse my bad English, how to make to display the current categories in categories.tpl ?
i can display all the category with ce code but not categories current
{assign var="all_categories" value=0|fn_get_plain_categories_tree:false}
{foreach from=$all_categories item="cat"}
{$cat.category} {/foreach}
{/if}
thank you for assistance
zyles
February 27, 2007, 12:00am
#2
If you enable the template debugger and visit a category. You can search for the category name and find the variable that outputs the current category.
When you find it you can echo the category like: {$variable.category}
rikito
February 28, 2007, 12:00am
#3
how to display subcategories => Array (6) =>category ?
smarty debug consol display
[quote]
{$categories} Array (4)
0 => Array (7)
category_id => 181
parent_id => 0
id_path => 181
category => Femme
position => 10
level => 0
subcategories => Array (4)
0 => Array (7)
category_id => 185
parent_id => 181
id_path => 181/185
category => Chaussures Ă talons
position => 10
level => 1
subcategories => Array (5)
0 => Array (6)
category_id => 188
parent_id => 185
id_path => 181/185/188
category => Escarpins ouverts
position => 10
level => 2
1 => Array (6)
category_id => 189
parent_id => 185
id_path => 181/185/189
category => Escarpins fermés
position => 20
level => 2
2 => Array (6)
category_id => 190
parent_id => 185
id_path => 181/185/190
category => Talons compensés
position => 30
level => 2
3 => Array (6)
category_id => 192
parent_id => 185
id_path => 181/185/192
category => Talons hauts
position => 50
level => 2
4 => Array (6)
category_id => 193
parent_id => 185
id_path => 181/185/193
category => Sabots
position => 60
level => 2
etcâŠ
[/quote]
i have to test
[quote]
{foreach from=$categories item=âsubcategoryâ}
{$subcategory.category}
{/foreach}
[/quote]
and the display is root category (array 7)
thx for the responses
rikito
March 1, 2007, 12:00am
#4
no answer?
I put the question differently :
What is the syntax smarty to cross the array $categories to arrive at the data in $subcategories when I display the same category?
thx !
zyles
March 1, 2007, 12:00am
#5
Didnât you want to display the CURRENT category?
{$category_data.category}
rikito
March 1, 2007, 12:00am
#6
ok but I want to display all the attached categories and not only the selected category.
one should be done a {foreach} or {section} on the preceding or current category.
It allows to have the previous nearby categories when we show the last category.
exemple not correct :
[quote]
{if $subcategories}
{foreach from=$subcategories item=category}
{$category.category}
{/foreach}{else}
{foreach from=$category_data item=category}
{$category_data.category}
{/foreach}
{/if}
[/quote]
thx !
zyles
March 1, 2007, 12:00am
#7
Have you looked at the categories_pages/categories_dtree.tpl templates?
I think it does just that.
rikito
March 1, 2007, 12:00am
#8
[quote name=âZylesâ]Have you looked at the categories_pages/categories_dtree.tpl templates?
I think it does just that.[/QUOTE]
Yes but it display the subcategory when I am in the current categorie and I want to display the parent category of the subcategory.
exemple :
categorie A
=> subcategorie B
item = 1
item = 2
item = 3
=> subcategorie C
item = 1
item = 2
item = 3
i want to display on sidebox the links of the subcategorie B + items when i have the shown articles of the categorie C.
undestand my request ?
a simple recall of the preceding category.
thx !