Solving error Fatal error: Call to a member function getSource ()

Adding column "Most Anticipated", "Good Price" returned an error.

Fatal error: Call to a member function getSource () on a 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; 
        }
    }

Save, Close File.
Resend via ftp again.

Done, problem solved.

This question is now closed

Written By

Comments