cancel
Showing results for 
Search instead for 
Did you mean: 

Static Block Menu Links NOT Displaying

Static Block Menu Links NOT Displaying

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/

2 REPLIES 2

Re: Static Block Menu Links NOT Displaying

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.

Did you find it helpful? Please give "Kudos" or "Accept as Solution".
Meet 70+ extensions and templates for M1 & M2 in one place


Re: Static Block Menu Links NOT Displaying

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:

  • a. home-center-contact
  • b. top_menu_beacon
  • c. footer_links_beacon

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'.