I am trying to get order item id by going over all items present in the order with getAllItems()
. The problem is I am getting only the simple product even though the product has a parent item (double checked with $item->getParentItemId()
). Even when I try getAllVisibleItems()
I only get the simple product.
I can see that only the configurable product is visible, so I am obviously selecting the configurable product when placing order.
Also, is it possible to have a simple product which is visible individually and also associated with a grouped/configurable product? This is unrelated to the rest of the post but I will appreciate any help here as well.
This is the code:
foreach ($order->getAllVisibleItems() as $item)
{
$k++;
$productId = $item->getProductId();
$product = Mage::getModel('catalog/product')->load($productId);
Mage::log($k.")".$product->getTypeId()." and id is ".$item->getId(), null, "MODB.log");
if( $product->getTypeId() == 'simple' ){
if ($item->getData('row_total_incl_tax') != null){
$price = $item->getData('row_total_incl_tax');
}
if (!$item->getParentItemId){ //get simple prods data;}
else{//get parent prods data;}.......