3

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?

SagittariusA
  • 5,289
  • 15
  • 73
  • 127

1 Answers1

6

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

RichTea
  • 1,462
  • 10
  • 16
  • 24
  • Thank you very much. I will test this tomorrow as soon as possible when I have obtained the ftp data access to the site. Would you pleade explain me the difference between anchor and not-anchor? – SagittariusA Jun 22 '15 at 14:37
  • explanation here: http://www.magedevelopers.com/blog/magento-tutorials/what-is-anchor/ I've edited answer to provide a dynamic option too. – RichTea Jun 22 '15 at 14:41