Here I show how to get items from a Order by the order number id:
$order = Mage::getModel('sales/order')->load($order_id);
$items = $order->getAllItems();
$itemcount = count($items);
$name = array();
$unitPrice = array();
$sku = array();
$ids = array();
$qty = array();
foreach ($items as $itemId => $item) {
$name[] = $item->getName();
$unitPrice[] = $item->getPrice();
$sku[] = $item->getSku();
$ids[] = $item->getProductId();
$qty[] = $item->getQtyToInvoice();
}
How can I do the same but in SQL, get all the items information (name, price, image..) by order number id.
2
Answers
// getSelect() method allowed for order collection only so you can print query for specific order as as below.
Use sql query like :
This is for select item name and data