1

I created 2 static blocks called "message". i want to show one on each store i have. After configuring it correctly im facing an error when i call

Mage::getModel('cms/block')->load('message')->getIsActive()

since it seems not to be calling the correct message block in the store but always the same one. Is there any way to specify the store_id while checking if block is active?

If i dont check if it is active and only show the block with

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('message')->toHtml();?>

i get the correct content in each store.

3

Do this:

$storeId = 1;
$block = Mage::getModel('cms/block')
    ->setStoreId($storeId)
    ->load('message');

$isActive = $block->getIsActive();

To get the current store id replace $storeId = 1 from above with

$storeId = Mage::app()->getStore()->getId();
| 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.