I need to get details of all simple products associated with Configurable product along with product attributes
I used the existing magento functionality which returns empty value.
function getConfig($productIds) {
$configurableData = array();
$configProdCollctn = Mage::getResourceModel('catalog/product_collection');
$configProdCollctn->addAttributeToFilter('entity_id',array('in'=> $productIds))
->addAttributeToFilter('type_id',
array('eq'=> Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE));
while ($product = $configProdCollctn->fetchItem()) {
$prodAttrOptions = $product->getTypeInstance(true)->getConfigurableOptions($product);
foreach ($prodAttrOptions as $prodAttrOption) {
$configurableData[$product->getId()] = array();
foreach ($prodAttrOption as $optionValues) {
$val = $optionValues['option_title'];
$configurableData[$product->getId()][] = array(
$optionValues['sku'] => $optionValues['attribute_code']."=".$val
);
}
}
}
return ($configurableData);
}
This returns empty array.
for eg if config prod (A) has option of color and size. i need simple product A1,A2,A3 with color and size associated with options A1 = array(color => red,size => M) A2 = array(color => red,size => S)
Kindly Let me know how can I achieve this