0

I need to export magento orders per product ( I want to get all the orders for a specific product) How could I do it?

4
  • what is your magento version? Commented Jun 5, 2018 at 6:45
  • 1.9.31 this is the version Commented Jun 5, 2018 at 7:01
  • reference extension link : marketplace.magento.com/… Commented Jun 5, 2018 at 7:05
  • Thank you but I am not sure how to use it to filter order per product Commented Jun 5, 2018 at 7:18

1 Answer 1

0

You can get the order collection which contains specific products in the order by following code:

$collection = Mage::getModel('sales/order')->getCollection(); if($sku = $_product->getSku()){ $collection->getSelect()->join(array('order_item' => 'sales_flat_order_item'),'main_table.entity_id = order_item.order_id',array('sku')); $collection->getSelect()->where("order_item.sku like ?", "%$sku%")->group('main_table.entity_id'); } 

After that you can export it according to your requirement. This is not for export but for filter the order collection by sku or product.

Hope this help!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.