I want to get the list of sales_flat_order_item for a product.

I tried the following

$read = Mage::getSingleton('core/resource')->getConnection('core_read');
$result = $read->query("SELECT order_item.* FROM sales_flat_order_item AS order_item WHERE order_item.product_id='".$sku."'");
$row = $result->fetch();

And this is giving me wrong result. How to get the list of all transactions of a given product id?


You can try this:

$product = Mage::getModel('sales/order_item')->getCollection()->addFieldToFilter('product_id', '123');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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