I just recently upgraded from Magento 1.6 to 1.9.2, and now I have several static blocks on my front page that are not appearing. The code in the template file for these blocks is listed below:
From 2columns-right-home.phtml
<div id="homeBanner"> <div class="bannerLeft"><?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('homebanner_left')->toHTML();?><p class="clear submit"><a href="<?php echo $this->getBaseUrl();?>index.php/customer/account/create/"><img src="<?php echo $this->getSkinUrl();?>/images/register-now.png" alt="Register Now"/></a></p></div> <div class="bannerRight"><?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('homebanner_right')->toHTML();?></div> <div class="clear"></div> </div> <div class="titleBarWrap"> <div class="titleBar"> <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('titlebar_text')->toHTML(); ?> <?php echo $this->getChildHtml('titlebar'); ?> </div> </div>
I'm pretty sure Magento doesn't use this syntax anymore, but I am having trouble finding the correct way to display the blocks now. Could somebody please offer me some assistance into fixing this issue?
Hi @jfurnas
If you are on Magento 1.9.2.2( Magento 1.9.2.2) it includes SUPEE-6788 security patch. You need to white-list the cms/block.
Go to system >permissions>block and add the block there.
For more information visit the official documentation SUPEE-6788 TECHNICAL DETAILS
Thanks again for the speedy reply. I should have given some more information. In that area, I added the cms/block to the list, and it's still not displaying them. Is there anything else I would need to do?
Hi @jfurnas
Do you have any other custom blocks?(Or provide more information to get help)
Try white listing following mostly used blocks:
core/template
catalog/product_new
enterprise_catalogevent/event_lister
catalog/category_list
cms/block
I have all of the ones you listed added to the whitelist in CMS>Permissions>Blocks. The only custom blocks I have on the site are the ones I copy/pasted the HTML for earlier. I am still unable to get them to display.
Hi @jfurnas
Did you try to white list the blocks which I mentioned?
If by whitelisting you mean adding them in CMS>Permissions>Blocks then yes, they are in there. That page only asks for the block name though (cms/block), not the individual block IDs. Either way, the blocks still are not showing up.
Now that I am looking at the source, the div for homeBanner isn't even showing up which is where all the blocks are contained. I am not familiar with magento enough to know where I would investigate this at. The code I pasted at the initial post was from the .phtml file. Perhaps the site isn't using it?
EDIT: So after investigating, it looks like the new magento is throwing out my old layout, and using it's own. I was able to copy/paste the block code into the 2columns-right.phtml and it is working as it should now. Thanks for working with me on the issue.