- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2016
09:55 PM
08-23-2016
09:55 PM
Magento REST Api - Get associate products for a configurable product
I was doing lot of R & D work to retrieve associated products for a given configurable product. What I have learnt is neither Magento REST API nor SOAP API support that. could you kindly let me know how I can achieve that?
Labels:
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2016
04:54 AM
09-06-2016
04:54 AM
Re: Magento REST Api - Get associate products for a configurable product
Hello Rangab,
There are no any default api according to your requirement. You have to create your own rest/soap API.
Check out here how to extend rest api in magento.
code for getting associate products for a configurable product
$product= Mage::getModel('catalog/product')->load($configId); #Check if the product has children if ($product->type_id == 'configurable') { $options = array(); // Get any super_attribute settings we need $productAttributesOptions = $product->getTypeInstance(true)->getConfigurableOptions($product); foreach ($productAttributesOptions as $productAttributeOption) { $options[$product->getId()] = array(); foreach ($productAttributeOption as $optionValues) { $val = $this->trimValue($optionValues['option_title']); $options[$product->getId()][] = array ( $optionValues['sku'] => $optionValues['attribute_code']."=".$val ) ; } }