Magento Forum

   
setLayer() on a non-object shows up when browsing a anchor category
 
pgoetzin
Jr. Member
 
Total Posts:  28
Joined:  2009-04-24
 

Hello Everyone,
I updated from 1.4.1 to 1.4.2. When I open now a category where the “anchor” function is enable i get the following error:

Fatal error: Call to a member function setLayer() on a non-object in /var/www/vhosts/demo/httpdocs/app/code/core/Mage/Catalog/Block/Layer/View.php on line 113

I already tried some new unmodified 1.42 templates but with no success, same behavior.

Dose anyone have the same Problem ? Or a Advice for me what I can check next?

thanks,

Philipp

/var/www/vhosts/demo/httpdocs/app/code/core/Mage/Catalog/Block/Layer/View.php

105     /**
106      * Prepare child blocks
107      *
108      * @return Mage_Catalog_Block_Layer_View
109      */
110     protected function _prepareLayout()
111     {
112         $stateBlock 
$this->getLayout()->createBlock($this->_stateBlockName)
113             ->setLayer($this->getLayer());<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
114 
115         $categoryBlock 
$this->getLayout()->createBlock($this->_categoryBlockName)
116             ->setLayer($this->getLayer())
117             ->init();
118 
119         $this
->setChild('layer_state'$stateBlock);
120         $this->setChild('category_filter'$categoryBlock);
121 
122         $filterableAttributes 
$this->_getFilterableAttributes();
123         foreach ($filterableAttributes as $attribute{
124             
if ($attribute->getAttributeCode() == 'price'{
125                 $filterBlockName 
$this->_priceFilterBlockName;
126             }
127             
elseif ($attribute->getBackendType() == 'decimal'{
128                 $filterBlockName 
$this->_decimalFilterBlockName;
129             }
130             
else {
131                 $filterBlockName 
$this->_attributeFilterBlockName;
132             }
133 
134             $this
->setChild($attribute->getAttributeCode() . '_filter',
135                 $this->getLayout()->createBlock($filterBlockName)
136                     ->setLayer($this->getLayer())
137                     ->setAttributeModel($attribute)
138                     ->init());
139         }
140 
141         $this
->getLayer()->apply();
142 
143         
return parent::_prepareLayout();
144     }

 
Magento Community Magento Community
Magento Community
Magento Community
 
YeoMos
Jr. Member
 
Total Posts:  15
Joined:  2009-05-08
Athens, Greece
 

I have the same problem.

After looking into it I found that it had to do with “Netzarbeiter_GroupsCatalog” module. If I disable it the frontend works (but it breaks the backend).

 
Magento Community Magento Community
Magento Community
Magento Community
 
pgoetzin
Jr. Member
 
Total Posts:  28
Joined:  2009-04-24
 

Hey YeoMos,
didn\’t got it fixed.

made a rollback to 1.4.1 because i\’m out of time at the moment.

grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
cocci72
Jr. Member
 
Total Posts:  1
Joined:  2010-10-21
 

Had a fellow developer help me debug this issue. Turns out it was the Netzarbeiter_GroupsCatalog. Magento must have changed something in version 1.4.2.

To fix it all I had to do was add $this->_initBlocks(); in Netzarbeiter > GroupsCatalog > Block > Layer > View.php

public function _construct()
    
{
        $this
->setData('module_name''Mage_Catalog');
        
        
//init the blocks
        
$this->_initBlocks();
    
}

 
Magento Community Magento Community
Magento Community
Magento Community
 
slickg
Jr. Member
 
Total Posts:  13
Joined:  2009-04-10
 

This worked great cocci72, thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
d8bhatta
Member
 
Total Posts:  44
Joined:  2009-06-11
 

public function _construct()
{
$this->setData(\\\\\\\’module_name\\\\\\\’, \\\\\\\’Mage_Catalog\\\\\\\’);

//init the blocks
$this->_initBlocks();
}

This doesn\\\\\\\’t work for me.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top