Question

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?

Was it helpful?

Solution

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;
     }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top