Magento 显示空分组产品

Magento show empty grouped product

我想在 magento(版本 1.9.1.1)中显示分组产品,即使它们没有附加有效的简单产品。

如果我使用直接 url 访问产品,我可以在前端查看分组产品,但是当我使用搜索表单或查看类别页面时,我看不到产品。

如果我激活与分组产品关联的简单产品,则分组产品会出现在类别页面和搜索表单中。

提前致谢!

这是由于 Magento 的分组产品价格索引器 (Mage_Catalog_Model_Resource_Product_Indexer_Price_Grouped) 中存在错误。

索引过程只考虑具有简单产品关联的分组产品,请参阅Mage_Catalog_Model_Resource_Product_Indexer_Price_Grouped第 118 行:

if (!is_null($entityIds)) {
    $select->where('l.product_id IN(?)', $entityIds);
}

这需要更改为

if (!is_null($entityIds)) {
    $select->where('e.entity_id IN(?)', $entityIds);
}

让它发挥作用。此外,产品价格的批量索引(通过管理界面或通过 shell)解决了这个问题,因为命名 class 的 reindexAll() 功能不限于具有关联简单产品的分组产品要么。

请注意,您不应在核心文件中进行这些更改,而应覆盖 class。

问题has also been reported to Magento