Magento: how to add a static block AFTER product list

3.9k views Asked by At

In a web site my boss wants me to insert a static block AFTER the product list of that category. Up to now, using the Magento front end application, the one you can see here, I have seen that I can add a static block only before the product list. How can I do to put the block after the product list for each category? For example this is a page of the site I am working on and I would like to display the block at the bottom of the page, after the product list but before the footer links. I think I should change some files (like page.xml or local.xml) ma I don't know how and I haven't found anything useful in the net. Can you help?

1

There are 1 answers

2
RichTea On BEST ANSWER

In your local.xml add the following, replacing cms_extra with the identifier of your CMS block.

 <!-- Catalog Category (Anchor) -->
 <catalog_category_layered>
     <reference name="content">
         <block type="cms/block" name="cms_extra" after="category.products">
             <action method="setBlockId"><block_id>cms_extra</block_id></action>
         </block>       
     </reference>
 </catalog_category_layered>

 <!-- Catalog Category (Non-Anchor) -->
 <catalog_category_default>
     <reference name="content">
         <block type="cms/block" name="cms_extra" after="category.products">
             <action method="setBlockId"><block_id>cms_extra</block_id></action>
         </block>
     </reference>
 </catalog_category_default>

Alternatively if it needs to be a different CMS block on each category, add the following near the bottom of your catalog/product/list.phtml..

 <?php
     $catcode = Mage::registry('current_category')->getId();
     echo $this->getLayout()->createBlock('cms/block')->setBlockId('category_block_' . $catcode .'')->toHtml(); 
 ?>

Create each category's CMS block with identifier of category_block_categoryid