I have 4 different stores in the same Magento system, so I have 4 different themes. One of them is overriding on /code/community/mage/cms/block/block.php the function _toHtml() like this:

protected function _toHtml()
        $blockId = $this->getBlockId();
        $html = '';
        if ($blockId) {
            $block = Mage::getModel('cms/block')
            if ($block->getIsActive()) {
                /* @var $helper Mage_Cms_Helper_Data */
                $helper = Mage::helper('cms');
                $processor = $helper->getBlockTemplateProcessor();
                $html = NovaWorks_ThemeOptions_Helper_Filter::applyFilters($block->getContent(), array('object' => 'a', 'context' => 'page'));
                $html = $processor->filter($html);
        return $html;

As you can see, this function is using this: NovaWorks_ThemeOptions_Helper_Filter::applyFilters($block->getContent(), array('object' => 'a', 'context' => 'page'));

which is an specific function of one of the themes. Rest of websites aren't working fine because of this function.

How can I do that to make that only one website/theme uses this function?

Many thanks.


If all you need to do is use or not use that specific line for specific stores, just do an if.

$currentStoreId = Mage::app()->getStore()->getId();
if ($currentStoreId == $storeIdYouWantToUseFilering) {
                    $html = NovaWorks_ThemeOptions_Helper_Filter::applyFilters($block->getContent(), array('object' => 'a', 'context' => 'page'));

You can find store IDs in core_store. You can also find these by going to System -> Manage Store -> hover over the store names.

  • Thanks @laketuna! Great answer, I didn't know I could do that, very useful! – Maria Mar 3 '14 at 17:25

You can check if current theme is that for which you want to run the code

$sCurrentPackage = Mage::getSingleton('core/design_package')->getPackageName();
$sCurrentTheme = Mage::getSingleton('core/design_package')->getTheme('frontend');
if ($sCurrentPackage == 'your_package_name' && $sCurrentTheme == 'your_theme_name') {
    //your code here

Also you can check by store code

$sStoreCode = Mage::app()->getStore()->getCode();
if ($sStoreCode == 'store_code') {
    //your code here
  • I didn't know I could do that, so newby at Magento... great solution! – Maria Mar 3 '14 at 16:19
  • Happy that my answer helped you. But it is better to move this comment to the answer which you marked as accepted. Because it makes no sense to accept one answer and thank another. – oleksii.svarychevskyi Mar 3 '14 at 16:40

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.