Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Adding Category Description and Title to Product List Page
 
Jonathan106
Jr. Member
 
Total Posts:  13
Joined:  2009-06-02
 

Hello,

How do I go about adding the category description and category title to the product list page? I’m currently editing the blank template and need this on the page.

Any help would be much appriciated!

Thanks,

Jonathan

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jonathan106
Jr. Member
 
Total Posts:  13
Joined:  2009-06-02
 

Could anyone help me with this please?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ckosny
Guru
 
Total Posts:  349
Joined:  2009-02-28
Luxembourg
 

Which template exactly are you talking about (I don’t have the blank theme available right now). At least in the default interface/theme the category view template already displays the title and description of the category, so if the blank theme does not do that, you might want to check the template in the default theme.

Good luck

Claudia

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jonathan106
Jr. Member
 
Total Posts:  13
Joined:  2009-06-02
 

i’m trying to add it to catalog>product>list

In the catalog>category>view file it’s added like this:

<?php if($_description=$this->getCurrentCategory()->getDescription()): ?>
        
<class="category-description"><?php echo $_helper->categoryAttribute($_category$_description'description'?></p>
    
<?php endif; ?>

But that doesn’t work on the page i want it to, any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ckosny
Guru
 
Total Posts:  349
Joined:  2009-02-28
Luxembourg
 

I did not see any easy way to the category from within this template. Afaik this template is also used to display search results, and, since search results can come from multiple categories, there would be no definite category to get in this template.

Theoretically you could fetch the first product from the product collection displayed on this page and then grab the first category of this product, but this would only work if you
never have a product with multiple categories and if you do disable the search.

Claudia

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jonathan106
Jr. Member
 
Total Posts:  13
Joined:  2009-06-02
 

Thanks for the response, how would I go about getting the category description that way then? Could I in that case request a querystring then if its null get the first products category?

 
Magento Community Magento Community
Magento Community
Magento Community
 
dpdexter
Jr. Member
 
Total Posts:  11
Joined:  2007-11-12
Los Angeles
 

Get the category information with MAge::getModel()…

For example:

$cModel = Mage::getModel(’catalog/category’)->load( the category id here );
echo $cModel->getDescription();

Hope that helps.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top