Magento – Get config of simple product from configurable product options

configurable-productmagento-1.9simple-product

Hi i have a configurable product id and its selected options ids is there any way i can get the id of simple product of this configurable product which belongs to these options.

["config_product"]=>"754"
["super_attribute"]=>
      array(4) {
        [327]=>"2148"
        [551]=> "11474"
        [554]=> "11515"
        [628]=>"13239"
      }

I have this array i want to get simple product id of this configurable product which belongs to these super attributes.

Best Answer

I found an answer for this question if we send it params and parent product it will return the related associated product.

$product = $parent_config_product_object;
$params["super_attribute"]=>
      array(4) {
        [327]=>"2148"
        [551]=> "11474"
        [554]=> "11515"
        [628]=>"13239"
      }
    $childProduct = Mage::getModel('catalog/product_type_configurable')->getProductByAttributes($params['super_attribute'], $product);
        Mage::log($childProduct->getData());

Hope it will help someone else..

Related Topic