5
votes

When I visit a page using the magentoshop; I get this errormessage:

Call to a member function getId() on a non-object in /xxxxx/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Price.php on line 85

I headed for that line, it's a part of a function called getTotalConfigurableItemsPrice. It's in a foreach:

And it says:

foreach ($attributes as $attribute) {
    $attributeId = $attribute->getProductAttribute()->getId();

And the attribute stuff is the problem. I tried a var_dump() on $attribute->getProductAttribute() and recieved NULL A var_dump on($attribute) shows i.e.

["_data":protected]=>
  array(5) {
    ["product_super_attribute_id"]=>
    string(4) "3845"
    ["product_id"]=>
    string(8) "10001563"
    ["attribute_id"]=>
    string(3) "135"
    ["position"]=>
    string(1) "0"
    ["product_attribute"]=>
    NULL
  }

What's wrong with the attribute and how can I fix it ? If I say:

$attributeId = 1234;

instead of

$attributeId = $attribute->getProductAttribute()->getId();

The error is gone, but I need true values ..

2
Have you installed any extension that extend magento product attribute set functionality?Mufaddal
NO, no extensions of that way have been installeduser1697061
You should accept the answer below as it resolves your question.zigojacko

2 Answers

9
votes

I had the same problem and found the solution for it.

Problem description:

The problem affects configurable products that were with attribute set "Default" and configurable attribute "color". A new attribute set was created based on "Default" and the attribute color was removed from that attribute set. Afterwards with some 3rd party extension the attribute sets of some configurable products were changed to the new one. And that was causing the problem.

Solution:

Add the attribute "color" to the attribute set of the problematic product.

Approach:

The configurable attributes for a given product are stored in the table catalog_product_super_attribute. Using the id of the product you can find out which those attributes are.

mysql> select * from catalog_product_super_attribute where product_id=1826;
+----------------------------+------------+--------------+----------+
| product_super_attribute_id | product_id | attribute_id | position |
+----------------------------+------------+--------------+----------+
|                       1826 |       1826 |           92 |        0 |
|                       2683 |       1826 |          209 |        0 |
+----------------------------+------------+--------------+----------+
mysql> select attribute_id,attribute_code from eav_attribute where (attribute_id=92 or attribute_id=208);
+--------------+----------------+
| attribute_id | attribute_code |
+--------------+----------------+
|           92 | color          |
|          208 | color_mutsy    |
+--------------+----------------+

All you have to do is go to your admin to Catalog - Attributes - Manage Attribute Sets and add the attributes to the attribute set of the problematic product and reindex.

0
votes

I have same problem like you when I had upgrade my magento, one of my extension is extend attribute set functionality so it give me this error.

So finally I had run this query.

update eav_entity_type set additional_attribute_table='catalog/eav_attribute',entity_attribute_collection='catalog/product_attribute_collection' where entity_type_id=4;

And my problem was solved.

Hope this will help you.