use*_*061 5 attributes magento
当我使用magentoshop访问页面时; 我收到此错误消息:
在第85行的/xxxxx/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Price.php中的非对象上调用成员函数getId()
我前往该行,它是一个名为getTotalConfigurableItemsPrice的函数的一部分.这是在一个foreach:
它说:
foreach ($attributes as $attribute) {
$attributeId = $attribute->getProductAttribute()->getId();
Run Code Online (Sandbox Code Playgroud)
而属性的东西是问题.我在$ attribute-> getProductAttribute()上尝试了var_dump()并收到了NULL($ attribute)上的var_dump显示ie
["_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
}
Run Code Online (Sandbox Code Playgroud)
该属性有什么问题,我该如何解决?如果我说:
$attributeId = 1234;
Run Code Online (Sandbox Code Playgroud)
代替
$attributeId = $attribute->getProductAttribute()->getId();
Run Code Online (Sandbox Code Playgroud)
错误消失了,但我需要真正的价值观......
我有同样的问题,并找到了解决方案.
问题描述:
该问题影响具有属性集"默认"和可配置属性"颜色"的可配置产品.基于"默认"创建了新的属性集,并从该属性集中删除了属性颜色.之后通过一些第三方扩展,一些可配置产品的属性集被更改为新的.这导致了问题.
解:
将属性"color"添加到有问题的产品的属性集中.
做法:
给定产品的可配置属性存储在表中catalog_product_super_attribute.使用产品的ID,您可以找出这些属性.
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 |
+--------------+----------------+
Run Code Online (Sandbox Code Playgroud)
您所要做的就是将您的管理员转到目录 - 属性 - 管理属性集,并将属性添加到有问题的产品和reindex的属性集中.
当我升级我的 magento 时,我遇到了和你一样的问题,我的扩展之一是扩展属性集功能,所以它给了我这个错误。
所以最后我运行了这个查询。
update eav_entity_type set additional_attribute_table='catalog/eav_attribute',entity_attribute_collection='catalog/product_attribute_collection' where entity_type_id=4;
我的问题解决了。
希望对你有帮助。