문제

Basically I need to know if a grouped product contains any MAP sub product.

Is it possible to get this information without loading all product associated to it?

도움이 되었습니까?

해결책

So, You need to check if any of the Grouped Product has a MAP set? You don't want to load all the product's because that can be slow.

The simplest suggestion I have is to gather all the Id's with

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

Then you can use

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

Put it together. 'attribute_code' => needed Attribute's 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 ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top