基本上,我需要知道分组产品是否包含任何地图子产品。

是否可以在不加载与之关联的所有产品的情况下获取此信息?

有帮助吗?

解决方案

因此,您需要检查任何分组产品是否具有地图集?您不想加载所有产品,因为它可能会很慢。

我最简单的建议是收集所有身份证

$ids = $product->getTypeInstance(true)->getAssociatedProductIds($product);

那你可以使用

Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, 'attribute_code', $storeId);

把它放在一起。 'attribute_code' =>需要属性的代码 && $storeId

$ids = $product->getTypeInstance(true)->getAssociatedProductIds($product);
foreach($ids as $id){
     $wantedAttribute = Mage::getResourceModel('catalog/product')->getAttributeRawValue($id, 'attribute_code', $storeId);
     if(SOME_CHECK){
         DOSOMETHING;
     }
}
许可以下: CC-BY-SA归因
scroll top