cancel
Showing results for 
Search instead for 
Did you mean: 

Magento REST Api - Get associate products for a configurable product

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?

1 REPLY 1

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           
                    ) ;
            }
        }