brandonc503 Posted February 10, 2010 Share Posted February 10, 2010 where it has the subcategories in the categories.php page.. how can i get the categories in the same tier to show up right above the subcategories.. here is the code for the sub categories links at top of the categories.php {if isset($subcategories)} <!-- Subcategories --> {l s='Subcategories'} {foreach from=$subcategories item=subcategory} getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}"> {if $subcategory.id_image} getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" /> {else} {/if} getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'} {/foreach} {/if} insted of showing categories under the current category.. i wnat to link the current category along with the others in the same tier as the current.. thanks Link to comment Share on other sites More sharing options...
rocky Posted February 11, 2010 Share Posted February 11, 2010 Add this to category.php on line 50 (just before the $subCategories line): $parentSubCategories = array(); if ($category->id != 1) { $parent = new Category($category->id_parent); $parentSubCategories = $parent->getSubCategories(intval($cookie->id_lang)); } if (sizeof($parentSubCategories) > 0) $smarty->assign('parentSubcategories', $parentSubCategories); then add the following before the code you mentioned above: {if isset($parentSubcategories)} <!-- Subcategories --> {l s='Parent Subcategories'} {foreach from=$parentSubcategories item=subcategory} getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}"> {if $subcategory.id_image} getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" /> {else} {/if} getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'} {/foreach} {/if} This code should work, but the problem is that it uses two id="subcategories", which is bad. It would be better if you changed both id="subcategories" to class="subcategories", then in global.css, change all #subcategories to .subcategories. Link to comment Share on other sites More sharing options...
Grafikamania Posted February 25, 2010 Share Posted February 25, 2010 not working wellBut if one wants to show all subcategories, sub subcategories and sub sub subcategorie of a category in one page?ThanksSimona Link to comment Share on other sites More sharing options...
Mattz Posted April 6, 2010 Share Posted April 6, 2010 I also cannot get this to work.I would like to have that when I'm on a subcategorie that all categories around that one where Iḿ in are showed... so the rest that is under that parent.How to do this ? Link to comment Share on other sites More sharing options...
Recommended Posts