Search the Community
Showing results for tags 'Siblings'.
-
Good evening, I've been trying to show the sister categories (not the daughters) on the category page for some time now, but it's impossible for me, since the method I used to do it in 1.6 no longer works for 1.7 or I can't adapt it, for Let's see if someone is able to help me, I would be infinitely grateful. Example: I have 3 categories (cat1, cat2 and cat3), if I access the cat1 category, I want to show the daughters (this is already done by default of prestashop with the subcategories) and also show the sisters in another block, that is, cat2 and cat3. The same if I enter cat2, it shows me the daughters on the one hand and cat1 and cat3 which are the sisters of the same level on the other hand. There is already a method for version 1.6, but in 1.7 the file to edit is no longer the same and that method cannot be followed. This is the topic: A greeting and thanks in advance!
-
I'd like to show under category-count siblings subcategories. I have found one solution but it doesn't work for me. category-count.tpl: <!-- Subcategories --> {if isset($subcategories) } <ul> {foreach from=$subcategories item=subcategory} <li> <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" class="cat_name">{$subcategory.name|escape:'htmlall':'UTF-8'}</a> </li> {/foreach} </ul> {else if $category->active} <ul> {foreach from=$category_siblings item=siblingcategory} <li> {$siblingcategory.name} </li> {/foreach} </ul> {else} ZLE PODMIENKY {/if} CategoryController: <?php class CategoryController extends CategoryControllerCore { public function displayContent() { // Get the global smarty object. global $smarty; // Get current category's parent. $parent_category = new Category($this->category->id_parent, self::$cookie->id_lang); // Get parent category's subcategories (which is current category's siblings, including it self). $category_siblings = getChildren($parent_category,self::$cookie->id_lang,true); /* Assign your siblings array to smarty. */ $smarty->assign( array( "category_siblings" => $category_siblings ) ); /* This we run the normal displayContent, but pass the siblings array to category.tpl */ parent::displayContent(); } }
- 4 replies
-
- categories
- Siblings
-
(and 1 more)
Tagged with: