The code snippet below returns me names and product quantities, each one being a variable.
foreach ($orderItems as $order) {
$order_data = Mage::getModel('sales/order')->load($order['order_id']);
$items = $order_data->getAllItems();
$order_id = $order['order_id'];
$total = $order_data->getGrandTotal();
$customer_name = $order_data->getCustomerName();
foreach ($items as $item) {
$product_id = $item->getProductId();
if ($product_id == $id) {
$tudo = $item->getName() .' - Quantidade: '. $item->getQtyOrdered().'<br/>';
}
}
echo $tudo;
}
Output example:
Product1 - Quantity: 2
Product1 - Quantity: 7
Product2 - Quantity: 1
Product2 - Quantity: 1
How could I make the output to be next?
Product1 - Quantity: 9
Product2 - Quantity: 2