Having a second left bar in the category page
-
16-10-2019 - |
Question
Well in my page I have in the left bar show the sub categories of the category when you enter the page of the category, but my client has required that I manage to put a second left bar below the first one, this has to show the brands of the products of the category; I have the sub category of brands, but I have no clue of how to put them as a second bar in the left side of the page.
I hope you guys can help me. Thanks in advantage.
Solution
To add a new block into left
, you need a module, a layout xml, a block and a template.
Add Layout file to magento
<config>
<frontend>
<layout>
<updates>
<company_module>
<file>company_module.xml</file>
</company_module>
</updates>
</layout>
</frontend>
</config>
Add block to left
<the_layout_handle_of_your_choice>
<reference name="left">
<block type="your/type" template="your/module/template.phtml" />
</reference>
</the_layout_handle_of_your_choice>
If you don't need a block to split logic and html, you can just use core/template
here.
And in your template file you can show whatever you want:
<?php $brands = $this->getMyBrands(); ?>
<?php foreach($brands as $brand): ?>
...
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange