Magento: How to get all associated children product of a configurable product?
A configurable product can have multiple other products associated to it.
Here is the code to fetch all the children products that are associated with a configurable product.
Here goes the code :)
/**
* Load product by product id
*/
$product = Mage::getModel('catalog/product')
->load(YOUR_PRODUCT_ID);
/**
* Get child products id (only ids)
$childIds = Mage::getModel('catalog/product_type_configurable')
->getChildrenIds($product->getId());
/**
* Get children products (all associated children products data)
*/
$childProducts = Mage::getModel('catalog/product_type_configurable')
->getUsedProducts(null,$product);
Hope this helps. Thanks.
Related posts:
- Magento: Get order option of configurable and bundle product in cart
- Magento: Get parent id of simple product associated to configurable product
- Magento: Get sub categories and product count
- Magento: Product Edit Warning: Invalid argument supplied for foreach()
- Magento: Load store specific product
- Magento: How to get product stock quantity & other stock information?
- Magento: Downloadable products not displayed in Associated Products tab in Grouped Product
- Magento: Get manufacturer name and id from product
- Magento: How to get top rated products?
- Magento: Get category name and url from product
