2

Can you help me? I have a Magento site that throws this error when I search for products:

a:5:{i:0;s:34:"The attribute model is not defined";i:1;s:4717:"#0
/var/www/mystore.com/public_html/app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php(239):
Mage::throwException('The attribute m...')
#1 /var/www/mystore.com/public_html/app/code/local/Mana/Filters/Model/Filter/Attribute.php(63):
Mage_Catalog_Model_Layer_Filter_Abstract->getAttributeModel()
#2 ....

and this on my page 'The attribute model is not defined ' in system.txt i see this error

2014-02-05T11:15:36+00:00 ERR (3): Warning: chdir(): Permission denied (errno 13)

How i can solve this?

Thanks for any help. Have a great day. Greeting.

3 Answers 3

2

welcome to MageOverflow.

chdir is a function to change the directory. I have no idea, what *Mana_Filters* does, but you are not allowed to change the directory. But I don't think this is connected to your problem.

This is here:

// \Mage_Catalog_Model_Layer_Filter_Abstract::getAttributeModel
public function getAttributeModel()
{
    $attribute = $this->getData('attribute_model');
    if (is_null($attribute)) {
        Mage::throwException(Mage::helper('catalog')->__('The attribute model is not defined'));
    }
    return $attribute;
}

So Mana_Filters expects a attribute_model which is not defined. If this is a paid extention, I would sent the vendor an email. If it is not paid, you should check what goes wrong inside of app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php

6
  • yes my extension Mana Filter it's paid. Thanks for everything. Have a nice day. - from @nena988 Commented Feb 14, 2014 at 8:24
  • how to fix this error?
    – Sathish
    Commented Sep 13, 2016 at 9:27
  • @Sathish please open a new question and explain what you are talking about. What have you done, what have you expected and what happened instead. Commented Sep 13, 2016 at 10:36
  • 1
    I need quick fix, so i done like this.$attribute = $this->getData('attribute_model'); if (is_null($attribute)) { $attribute = Mage::getModel('catalog/resource_eav_attribute'); // Mage::throwException(Mage::helper('catalog')->__('The attribute model is not defined')); } return $attribute;
    – Sathish
    Commented Sep 13, 2016 at 10:52
  • its helps, i don't know is this was right way? anyway thank you for your quick reply
    – Sathish
    Commented Sep 13, 2016 at 10:53
1

Underlying reason of the issue might happen, if attribute is deleted directly in DB, not in Magento admin panel. There is additional code which handles attribute deletions which is called on admin panels "Delete attribute" action and it is not called when deleted in DB.

For a fix check here http://www.manadev.com/faq/error--the-attribute-model-is-not-defined

0

As @manadev-com-team said, the root issues is deleting an attribute through any means other than the Magento Admin. This can be through direct database manipulation, or the removeAttribute() method in a module installer.

First, make sure that you reindex catalog_product_attribute. If you have Flat Catalog enabled for products, reindex that as well.

Then, run the following queries against your database:

DELETE fs, fv, fvs
FROM m_filter2 f
INNER JOIN m_filter2_store fs
ON f.id = fs.global_id
INNER JOIN m_filter2_value fv
ON f.id = fv.filter_id
INNER JOIN m_filter2_value fvs
ON f.id = fvs.filter_id
WHERE f.id IN(
    SELECT f.id FROM m_filter2 f
    LEFT JOIN eav_attribute eav
    ON f.code = eav.attribute_code
    AND eav.entity_type_id = (
        SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_product'
    )
    WHERE eav.attribute_id IS NULL
    AND f.code != 'category'
);

DELETE f
FROM m_filter2 f
LEFT JOIN eav_attribute eav
ON f.code = eav.attribute_code
AND eav.entity_type_id = (
    SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_product'
)
WHERE eav.attribute_id IS NULL
AND f.code != 'category';

These queries will delete any "filters" (attributes) and all related information in Manadev tables for any attributes which no longer exist in Magento, (excluding the category filter, which doesn't actually match an attribute in Magento.)

Finally, it wouldn't hurt to rerun all of the Manadev indexers.

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.