Quantcast
Channel: Magento Resource » design
Viewing all articles
Browse latest Browse all 10

How to add category description under category

$
0
0

Here is the example:
You can see the example of this menu at http://www.cortevents.com, under furniture catalog. On a left hand side each category item has small text that is being pulled from category description field.

STEP1:
/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Tree.php
I’ve inserted following code on the line 234 (_getDefaultCollection function, after addAttributeToSelect(‘name’))

1
->addAttributeToSelect('description')



STEP2:
/app/code/core/Mage/Catalog/Model/Category.php
I’ve added the following function at the end of the class

1
2
3
public function getDescription() {
    return $this->_getData('description');
}



STEP3:
/app/code/core/Mage/Catalog/Block/Navigation.php
I’ve added the following code on line 177

1
2
3
if ($level == 0) {
    $html .= '<span class="category-desc">'.$category->getDescription().'</span>';
}



OK, We done it.

From:http://www.igorkrasnykh.com


Viewing all articles
Browse latest Browse all 10

Trending Articles