I'am using Magento 1.9. I have to make return process in magento.
For that I'm listing all items of order. But for the configurable product I need to take the ID of the simple product to make the return request, since I need to process the return request for corresponding simple product.
Using the below code all the configurable items. But I could not get the actual simple product related with that item.
foreach ($orderItems as $item){
if ($item->getParentItemId())
continue;
$productId = $item->getProductId(); //It gives only the configurable product Id
if ( $item->getProductType() == 'configurable' ) {
$productId = $item->getOptionByCode('simple_product')->getProduct()->getId(); // It is not working
}
}
Can anyone help on this?