Hi,
I am trying to display links from a static block on my homepage.
I have added the following code to "home.phtml":
<?php $storeId = Mage::app()->getStore()->getStoreId(); if($storeId == '14') { echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml(); echo $this->getLayout()->createBlock('cms/block')->setBlockId('top_menu_beacon')->toHtml(); echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_links_beacon')->toHtml(); } if($storeId == '19') { echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml(); echo $this->getLayout()->createBlock('cms/block')->setBlockId('top_menu_cashino')->toHtml(); echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_links_cashino')->toHtml(); } if($storeId == '16') { echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml(); echo $this->getLayout()->createBlock('cms/block')->setBlockId('top_menu_tanexpress')->toHtml(); echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_links_tanexpress')->toHtml(); } if($storeId == '18') { echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml(); echo $this->getLayout()->createBlock('cms/block')->setBlockId('top_menu_merkur')->toHtml(); echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_links_merkur')->toHtml(); } ?>
...and I have allowed 'cms/block' in System > Permissions > Blocks.
Why are these not displaying?
I would like the 'top_menu_STORE' blocks displayed in the navigation and 'footer_links_STORE' to the left of the existing links in the footer.
Store View: https://cashino.kellyseye.com/
That would be better to show all that CMS blocks - not hardcode the storeviews.
You can set the stores visibility directly in admin area for CMS blocks.
Instead of using hard code store ids I think you can follow this approach:
1. Create different static blocks as per store for these identifier i.e:
so in your case you have to create 4 static blocks of each identifier as you have 4 stores (14,19,16,18)
2. Then in your home.phtml just call below lines without if conditions
echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
echo $this->getLayout()->createBlock('cms/block')->setBlockId('top_menu_merkur')->toHtml();
echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_links_merkur')->toHtml();
or
in home CMS page call
{{block type="cms/block" block_id="home-center-contact"}}
{{block type="cms/block" block_id="top_menu_merkur"}}
{{block type="cms/block" block_id="footer_links_merkur"}}
Problem solved? Please give 'Kudos' and accept 'Answer as Solution'.