cancel
Showing results for 
Search instead for 
Did you mean: 

How to fix Attribute model is not defined error.

How to fix Attribute model is not defined error.

When we search from the search box on the top of the header of the website at that time displayed error like 

Attribute model is not defined


Not resolved even we check all the attribute which have not to search navigation in frontend side.

So, please if you have any idea then please share here.

Thanks.

10 REPLIES 10

Re: How to fix Attribute model is not defined error.

Hi @Ashish_k_php 

For resolve issue please kindly refer below link  in case for M1:
https://magento.stackexchange.com/questions/14985/the-attribute-model-is-not-defined

It may help you to resolve issue.

Problem solved? Click Accept as Solution!

Re: How to fix Attribute model is not defined error.

@Bhanu Periwal  Thanks for your reply.

We already did that but still not resolved the issue.

Please share more about this.

Re: How to fix Attribute model is not defined error.

Hi @Ashish_k_php 

To resolve it just re create the attribute which causes this error, in the backend but do not enable for layered navigation or search. 

It may help you to resolve issue.
Thank you.

Problem solved? Click Accept as Solution!

Re: How to fix Attribute model is not defined error.

@Bhanu Periwal 

We find but not get which attribute causes.

Can you please let us know the why how can i find that attribute which causes.

Thanks.

Re: How to fix Attribute model is not defined error.

Hi @Ashish_k_php 

Please search file by below path in M1:

app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php

There must be below function:

 

// \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;
}

In this function you can create logs for attribute. 

If issue resolve, please click on 'Kudos' & Accept as Solution!

 

Problem solved? Click Accept as Solution!

Re: How to fix Attribute model is not defined error.

@Bhanu Periwal 

I already did that but not working and not resolved the error.

Re: How to fix Attribute model is not defined error.

Hi @Ashish_k_php , 

Please follow below steps to figure out the attribute code which is causing error.

1. Search for the attributes in the attributes grid using filter on grid through Use In Search.

2. After you get the list, check for the attributes in the database that whether we have added any model with those attributes. 

3. Later at the end, try to disable attributes for search one by one which have any model's and hope we will get our culprit attribute which is causing issue.

Thanks!

Problem Solved! Click Kudos & Accept as Solution!

Re: How to fix Attribute model is not defined error.

@Nishu Jindal  thank you for your reply.

We filter the for search in the admin side and check that attribute on the database but not any attribute have attribute_model set.

Please guide me if you have any other solution.

Re: How to fix Attribute model is not defined error.

Hi @Ashish_k_php ,

 

Can you please add below lines in the index.php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
 
After that try to reproduce the error and check the log entries in [Magento_Root]/var/log/
 
Thanks!
 
Problem Solved! Click Kudos & Accept as Solution!