在初始加载时,列名称的值为空,仅包含
我做了一些调试,问题的文件在这里:
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php
在_prepareCollection方法中,有一段代码可以将name属性添加到过滤器中:
$product = $this->_getProduct();
$collection = $product->getCollection()
->addAttributeToSelect('name')
->addAttributeToSelect('sku')
->addAttributeToSelect('attribute_set_id')
->addAttributeToSelect('type_id')
->addAttributeToSelect('price')
->addFieldToFilter('attribute_set_id',$product->getAttributeSetId())
->addFieldToFilter('type_id', $allowProductTypes)
->addFilterByRequiredOptions();
但结果查询没有提及名称:
SELECT `e`.*, (
IF(
IF(
cataloginventory_stock_item.use_config_manage_stock,
1,
cataloginventory_stock_item.manage_stock
),
cataloginventory_stock_item.is_in_stock,
1
)
) AS `is_saleable`, `cataloginventory_stock_item`.`is_in_stock` AS `inventory_in_stock`, `_table_color`.`value` AS `color`, `_table_size`.`value` AS `size` FROM `catalog_product_entity` AS `e`
LEFT JOIN `cataloginventory_stock_item` ON (cataloginventory_stock_item.product_id=e.entity_id)
INNER JOIN `catalog_product_entity_int` AS `_table_color` ON (`_table_color`.`entity_id` = `e`.`entity_id`) AND (`_table_color`.`attribute_id` = '80') AND (`_table_color`.`store_id` = 0)
INNER JOIN `catalog_product_entity_int` AS `_table_size` ON (`_table_size`.`entity_id` = `e`.`entity_id`) AND (`_table_size`.`attribute_id` = '123') AND (`_table_size`.`store_id` = 0) WHERE (e.attribute_set_id = '9') AND (((e.type_id = 'simple') or (e.type_id = 'virtual') or (e.type_id = 'downloadable'))) AND (((e.required_options != '1') or (e.required_options is NULL))) AND (_table_color.value not in ('')) AND (_table_size.value not in (''))
有关如何解决此问题的任何想法?
答案 0 :(得分:0)
转到此处:
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Simple.php
并注释掉以下内容:
//$attribute->setAttributeCode('simple_product_' . $attributeCode);
我必须诚实,我不确定为什么添加该行,所以请测试以确保它在其他地方没有任何影响