6

Client is trying to setup promotions via the admin but when saving and applying the promotion the server logs the following error (admin return blank screen):

PHP Fatal error: Call to a member function getBackend() on a non-object in /app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php on line 855

Unable to find any info regarding this type of error, what may be causing it, or how to correct it.

Thanks for your help!

1
  • 3
    This error is being thrown because an attempt to load an attribute instance is failing when Mage_Catalog_Model_Resource_Product_Collection::getAllAttributeValues is called. Can you provide a backtrace for this error? Fatal errors should record a complete backtrace in the PHP error log along with the error message.
    – davidalger
    Jul 16, 2013 at 2:56

1 Answer 1

8

Use the following script to list product attributes with non-existant backend models:

umask(0);
require 'app/Mage.php';    
Mage::setIsDeveloperMode(true);
Mage::app('admin');

$entityType = Mage::getSingleton('eav/config')->getEntityType('catalog_product');
foreach ($entityType->getAttributeCollection() as $attribute) {
    if ($backendClass = $attribute->getBackendModel()) {
        try {
            class_exists(Mage::getConfig()->getModelClassName($backendClass), true);
        } catch (Exception $e) {
            echo "Not found the backend model {$backendClass} for product attribute {$attribute->getAttributeCode()}\n";
        }
    }
}
2
  • this code really helped me in finding the error Mar 24, 2016 at 4:42
  • Note that you can do the same for 'catalog_category', 'customer' and 'customer_address' to find all possible sources of 'Call to a member function getBackend() on a non-object", not only in Product/Collection.php May 25, 2016 at 10:11

Your Answer

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

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