Fatal error: Call to a member function getSource() on boolean

fatal error: Call to a member function getSource() on boolean in C:\xampp\htdocs\my_store\app\code\core\Mage\Catalog\Model\Product.php on line 1390

Fatal error: Call to a member function getSource () on non-object products In Line 1390 file product.php

To fix this error open the file:

Code:

/home/public_html/app/code/core/Mage/Catalog/Model/Product.php

Find the lines:

Code:

public function getAttributeText($attributeCode)
    {
        return $this->getResource()
            ->getAttribute($attributeCode)
                ->getSource()
                    ->getOptionText($this->getData($attributeCode));
    }

And replace with:

Code:

public function getAttributeText($attributeCode)
    {
        if ($attribute = $this->getResource()->getAttribute($attributeCode)) {
            return
                    $attribute->getSource()
                                ->getOptionText($this->getData($attributeCode));
        } else {
            //Mage::log(\'attributes-errors.log\',$attributeCode);
            return false; 
        }
    }

Reffereance:https://www.ubertheme.com/question/solving-error-fatal-error-call-to-a-member-function-getsource/

Leave a comment

Your email address will not be published. Required fields are marked *