How to find order exists using SKU in Magento 1.9.

SKU is "ABC";

I want to check how many orders are available for the particular product using SKU.


1 Answer 1


Use the below code to get the orders for a particular SKU

$sku = "ABC";
 $orders = Mage::getModel('sales/order')
           ->join(array('order_item' => 'sales/order_item'),'main_table.entity_id = order_item.order_id');

 $orders->addFieldToFilter('order_item.sku', array(array('like' => '%'.$sku.'%')));
  • Manashvi Birla : Thank you I will check it. But can you give me any other solutions instead of like query. (gt or et). Dec 19, 2017 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.