1

I have included a Static Block called "home-center-contact" for 4 different Store Views with the ID's '14', '19', '16' and '18'.

Why am I seeing the number on my homepage along with the Static Block? Including the default Store View, which I am NOT including "home-center-contact" on?

Here is the code I have added to "home.phtml":

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-promotion')->toHtml(); ?>
<?php echo $storeId = Mage::app()->getStore()->getStoreId();
 if($storeId == '14')
{ $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
}
if($storeId == '19')
{ $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
}
if($storeId == '16')
{ $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
}
if($storeId == '18')
{ $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
} ?>

Store Views with "home-center-contact":

https://beaconbingo.kellyseye.com/

https://cashino.kellyseye.com/

https://tanexpress.kellyseye.com/

https://merkurengineering.kellyseye.com/

Store View NOT Including "home-center-contact" but including "home-center-promotion":

https://store.kellyseye.com/

Can anyone help?

0

Try the below code instead of yours:

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-promotion')->toHtml(); ?>
<?php $storeId = Mage::app()->getStore()->getStoreId();
    if($storeId == '14')
    { 
        echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
    }
    if($storeId == '19')
    { 
        echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
    }
    if($storeId == '16')
    { 
        echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
    }
    if($storeId == '18')
    { 
        echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
    } 
?>

According to the logic of the code all stores you have mentioned will show the same static block.

| improve this answer | |
0

if you check your code you have echo that's why display store id please change below line.

 <?php echo $storeId = Mage::app()->getStore()->getStoreId();  

so just remove echo.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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