I'm trying to add a static block to my category pages through Custom Design>Custom Layout Update, that is only visible to a certain customer group. I've already referenced this post, but I'm stuck.

Showing static block only to specific customer group

Currently, I'm using the following in Custom Layout Update:

<reference name="left">
<block type="cms/block" name="MYCUSTOMBLOCK" before="-">
     <action method="setBlockId"><block_id>my-custom-block</block_id></action>

On that static block, I'm then calling for a phtml file that I created:

{{block type="core/template" template="page/my-custom-file-name.phtml"}}

Here's the contents of the phtml file:

<?php if (Mage::getSingleton('customer/session')->getCustomerGroupId() <> 2) :?>
         <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId(163)->toHtml()?><?php endif;?>

With BlockID 163 being another static block that I created, which has a jpeg in it.

This isn't working for me, I know I'm doing something wrong, just not sure what. Would it be better for me to just call for the jpeg through the phtml file, instead of calling for a 2nd block? If so, how would I do that?

1 Answer 1


So, you have a CMS block, which calls a regular core/template block, which calls (again) a CMS block... Why not just loading the core/template block in your Layout Update?

<reference name="left">
    <block type="core/template" template="page/my-custom-file-name.phtml" before="-" />

Make it simple, so possible problems are reduced. Maybe layout object is not being loaded in blocks loaded inside a CMS block, and that's because the $this->getLayout() part is not working, just an idea...

  • 1
    Thanks Raul , this method actually worked! It wasn't working at first, but then I realized I wasn't pulling the template from the right folder, i missed a subfolder "page/html/my-custom-file-name.phtml"
    – Eric Fox
    Mar 4, 2016 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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