I want to display the category description in my left sidebar instead of the main column.
I added this to my catalog.xml:
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
</reference>
<reference name="left">
<block type="catalog/navigation" name="catalog.catdes" after="catalog.leftnav" template="catalog/navigation/description.phtml"/>
</reference>
And I created this file: catalog/navigation/description.phtml
<?php
$_helper = $this->helper('catalog/output');
$_category = $this->getCurrentCategory();
?>
<?php if($_description=$this->getCurrentCategory()->getDescription()): ?>
<div class="category-description">
<?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?>
</div>
There is no result at all. What could I be doing wrong?
php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $currentCategory = $objectManager->get('Magento\Framework\Registry')->registry('current_category');//get current category information echo $currentCategory->getId(); echo $currentCategory->getName(); echo $currentCategory->getDescription(); echo ...
To change the category layout, go to Products -> Categories -> Select your desired Category go to the Design tab and select desired option from the Layout dropdown.
The following solved this issue for me.
echo Mage::getModel('catalog/layer')->getCurrentCategory()->getDescription();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With