After updating Magento to version 1.9.2.2, or installing security patch SUPEE-6788 on an older version, lots of people are noticing that their static block shortcodes are no longer working. On my homepage, for example, I’m including a CMS Static Block as follows:

{{block type="cms/block" block_id="slide_home"}}

After the upgrade, this block was no longer displaying. In fact, this shortcode caused a PHP error to show up in my log files:

Notice: Undefined variable: block  in /app/code/core/Mage/Core/Model/Email/Template/Filter.php on line 187

Furthermore, it soon became clear that error is not limited to shortcodes for CMS Static Blocks, but that in fact all my custom blocks, including those in 3rd party extensions, failed to display.

This it not a bug, but a security feature added in security patch SUPEE-6788. When reading the technical details the author clearly states that blocks will have to be added to a white list if they are to be displayed:

[nz_highlight color=”ababab”]Magento now includes a white list of allowed blocks or directives. If a module or extension uses variables like {{config path=”web/unsecure/base_url”}} and {{block type=rss/order_new}} in CMS pages or emails, and the directives are not on this list, you will need to add them with your database installation script. Extensions or custom code that handles content (like blog extensions) might be affected. – See more at: http://magento.com/security/patches/supee-6788-technical-details#sthash.oywSvFeq.dpuf[/nz_highlight]

How to solve this problem?

Simply add the block type you wish to display to Magento’s white list.

Luckily, this is very easy and can be done through the Magento backend interface. Navigate to

System => Permissions => Blocks

And add the block type you wish to display.

For get the right block name to add open your homepage, or the page where you get the blocks not showing going to CMS => Pages and look in your code.

For example on my website I got 2 widget blocks called with:

{{block type="shopreview/widget" name="shopreviewwidget"}}
{{block type="aslider/container" template="aslider/container.phtml"}}

So on System => Permissions => Blocks I will Add the two New Block and will put on one shopreview/widget and on the other aslider/container.

Save, clear cache and you’ll get back the pages as was befor the Magento update/patch

Leave a Reply

Your email address will not be published. Required fields are marked

This site uses Akismet to reduce spam. Learn how your comment data is processed.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
Success message!
Warning message!
Error message!