1

When I click on any of the categories listed in the top nav I go to a blank page with the message:

Fatal error: Call to a member function setLayer() on boolean in magentopath/app/code/core/Mage/Catalog/Block/Layer/View.php on line 134

It's a multistore, until now both stores were running the theme eTheme - BuyShop ver. 2.1 and were working ok.

But now we had to install the theme mgstheme claue_v1.5.1 on one of the stores.

So now the configuration of each store is:

configuration of one store configuration of the other store

Now the store with the new theme mgstheme claue_v1.5.1 installed do not list any category. I followed the files to an empty collection of categories.

in app/code/design/frontend/mgstheme/claue/template/megamenu/navigation.phtml there is $megaMenu = $this->getMegamenuItems() and $megaMenu is empty.

in app/code/local/MGS/Megamenu/Block/Megamenu.php is the getMegamenuItems() method.

public function getMegamenuItems(){
    $store = Mage::app()->getStore();
    $menuCollection = Mage::getModel('megamenu/megamenu')
        ->getCollection()
        ->addStoreFilter($store)
        ->addFieldToFilter('parent_id', 1)
        ->addFieldToFilter('status', 1)
        ->setOrder('position', 'ASC')
    ;
    return $menuCollection;
}

And it returns nothing. The categories are created and worked fine in the nav menu before changing the theme.

And the store with the previous theme seems to work ok, but when click on a category, then a blank page with the error Call to a member function setLayer() on boolean is displayed.

I'm not sure where I should to begin looking for the error...

1 Answer 1

2

you should look first where the error message says to look : app/code/core/Mage/Catalog/Block/Layer/View.php on line 134

You will see this line :

$this->getLayout()->createBlock($filterBlockName)->setLayer($this->getLayer())

The error message means that Magento failed to create the block : the result of $this->getLayout()->createBlock($filterBlockName) should be an object and it is a boolean (false I guess).

If I were you, I will do some debug with a Mage::log($filterBlockName) before this line (or with x-debug if you know how to do it) to see what type of block failed and why this type does not exist.

6
  • so $filterBlockName is catalog/layer_filter_attribute, but $this->getLayout()->createBlock($filterBlockName) is empty (null/false). I look into app/code/core/Mage/Catalog/Block/Layer/Filter/Attribute.php but I don't see here anything out of place. It is a great first step to look for, but seems that I'm stuck again...
    – Alex
    Commented Feb 8, 2018 at 16:11
  • Seems that Attribute.php extends from Mage_Catalog_Block_Layer_Filter_Abstract and there is called a template in app/design/frontend/default/buyshop/template/catalog/layer called filter.phtml. But there is no filter.phtml, so probably the fallback system of magento is failing for some reason and is not finding the template. I copied the template in it's place but still same error.
    – Alex
    Commented Feb 8, 2018 at 16:29
  • Can you check if the catalog/layer_filter_attribute has been rewrite by another extension ? If you can use n98-magerun, you can see it with magerun dev:module:rewrite:list and magerun dev:module:rewrite:conflicts. Commented Feb 8, 2018 at 16:52
  • There is conflict only with checkout modules and 2 adminhtml modules none of them seems to have relation with filters. catalog/layer_filter_attribute is rewritten by MGS_Mpanel_Block_Catalog_Layer_Filter_Attribute, though this theme is not active in this store, it is from the other store. I see that catalog/layer_filter_price is overwritten by MGS_Mpanel_Block_Catalog_Layer_Filter_Price and price filter is working. I commented the filters in view.php and view.phtml and now it is working, but without filters, so it is not a good solution. I'm still searching.
    – Alex
    Commented Feb 9, 2018 at 7:23
  • Ok, we are progressing. Note that even if the theme is not active on a store, the rewrite is effective (a rewrite is global). If I were you, I will try to undertsand why the result of $this->getLayout()->createBlock($filterBlockName) is false with some Mage::log() for debbugging. First, I will look in the createBlock method (in Mage_Core_Model_Layout in there is no rewrite of this class) and put some if($type=="catalog/layer_filter_attribute"){Mage::log(what-ever-can-help-to-debug)}. Did you look in the exception.log file too ? Commented Feb 9, 2018 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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