2

I am trying to add a CMS block in-between the Category page description and the products list for a single category page. I believe I would need to use the Custom Layout Update to add the CMS block. If I reference the Content block, I can get the cms block to display at the top of the content with this:

<reference name="content">
 <block type="cms/block" name="cutlery_page_addition" before="product_list">
    <action method="setBlockId"><block_id>cutlery_page_addition</block_id></action>
 </block>
</reference>

But how would I target a child block of the content block? I tried this with no luck:

<reference name="category.products">
 <block type="cms/block" name="cutlery_page_addition" before="product_list">
    <action method="setBlockId"><block_id>cutlery_page_addition</block_id></action>
 </block>
</reference>

Any help would be greatly appreciated. Thanks

1

just call this block at catalog/category/view.phtml between

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

and

<?php if($this->isContentMode()): ?>

using the code

<?php echo $this->getChildHtml('cutlery_page_addition');?>

But magento is provide add an cms static block from admin at Category.Just select any category..... Design Setting>Display Mode> select Static block and products

  • Thanks for this feedback Amit! Your last suggestion worked for my situation. – Legendary_Fish Mar 17 '15 at 21:11
1

if you dont want to edit phtml add output attribute to the block tag

<reference name="category.products">
     <block type="cms/block" name="cutlery_page_addition" before="product_list" output="toHtml">
          <action method="setBlockId"><block_id>cutlery_page_addition</block_id></action>
     </block>
</reference>
  • Hey @balajisoundar I just tried this and the block just rendered after the footer on my site. – Legendary_Fish Mar 17 '15 at 21:15
  • @Legendary_Fish try this: <reference name="content"> <block type="cms/block" name="myname" after="category.products"> <action method="setBlockId"><block_id>block_name</block_id></action> </block> </reference> – Danny Z Oct 19 '15 at 21:12
0

content, left. right are all types of Mage_Core_Block_Text_List and therefore automatically rendered.

catalog.products extends Mage_Core_Block_Template which doesn't have this auto render feature. You have to put your echo $this->getChildHtml('cutlery_page_addition'); manually where you want to have it in the belonging .phtml file.

  • Thanks @Jeroen! I was starting to gather this was the case. I just needed it spelled out somewhere. – Legendary_Fish Mar 17 '15 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.