Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Category Problem Attributes.php on line 137
 
nils_ro45345
Jr. Member
 
Total Posts:  6
Joined:  2012-03-07
 

I did some work on attributes and attributes sets and now I can not edit existing categories. If I create a new categoriy there is no problem.

I got this error message:

Fatal error: Call to a member function getAttributeCode() on a non-object in .../app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php on line 137

I am using 1.7 CE

I can not find a solution for that and would be very happy about helping me.

Thanks,
Nils

 
Magento Community Magento Community
Magento Community
Magento Community
 
Francis Kim
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2011-11-02
Melbourne
 

It seems that whatever is before getAttributeCode() in the chain is not returning an object. Could you post what is on .../app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php on line 137?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nils_ro45345
Jr. Member
 
Total Posts:  6
Joined:  2012-03-07
 

line 137:

if ($element $form->getElement($attribute->getAttributeCode())) {

lines around:

$this->_setFieldset($attributes$fieldset);

        foreach (
$attributes as $attribute{
            
/* @var $attribute Mage_Eav_Model_Entity_Attribute */
            
if ($attribute->getAttributeCode() == 'url_key'{
                
if ($this->getCategory()->getLevel() == 1{
                    $fieldset
->removeField('url_key');
                    
$fieldset->addField('url_key''hidden', array(
                        
'name'  => 'url_key',
                        
'value' => $this->getCategory()->getUrlKey()
                    ));
                
else {
                    $form
->getElement('url_key')->setRenderer(
                        
$this->getLayout()->createBlock('adminhtml/catalog_form_renderer_attribute_urlkey')
                    );
                
}
            }
        }

        
if ($this->getCategory()->getLevel() == 1{
            $fieldset
->removeField('custom_use_parent_settings');
        
else {
            
if ($this->getCategory()->getCustomUseParentSettings()) {
                
foreach ($this->getCategory()->getDesignAttributes() as $attribute{
                    
if ($element $form->getElement($attribute->getAttributeCode())) {
                        $element
->setDisabled(true);
                    
}
                }
            }
            
if ($element $form->getElement('custom_use_parent_settings')) {
                $element
->setData('onchange''onCustomUseParentChanged(this)');
            
}
        }

        
if ($this->getCategory()->hasLockedAttributes()) {
            
foreach ($this->getCategory()->getLockedAttributes() as $attribute{
                
if ($element $form->getElement($attribute)) {
                    $element
->setReadonly(truetrue);
                
}
            }
        }

        
if (!$this->getCategory()->getId()){
            $this
->getCategory()->setIncludeInMenu(1);
        
}

        $form
->addValues($this->getCategory()->getData());

Many thanks,
Nils

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