I am trying to get the attribute values for products in an order and show them on the checkout success page.
So far I have been able to get SKU, NAME, but MANUFACTURER won't show any value...
Here is the code I am using to get the items from the checkout session:
<?php //
$products = array();
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$_order = Mage::getSingleton('sales/order')->load($lastOrderId);
/* @var $item Mage_Sales_Model_Order */
foreach ($_order->getAllVisibleItems() as $item) {
$info['sku'] = trim($item->getSku());
$info['qty'] = $item->getQtyOrdered();
$info['name'] = $item->getName();
$info['manufacturer'] = $item->getManufacturer();
$products[] = $info;
}
$config['productInfos'] = $products;
?>
And to echo the values:
<?php foreach ($config['productInfos'] as $product): ?>
<?php echo trim(stripslashes(htmlentities($product['manufacturer']))); ?>
<?php echo trim(stripslashes(htmlentities($product['name']))); ?>,
<?php echo trim(stripslashes(htmlentities($product['sku']))); ?>,
<?php endforeach; ?>
Can anyone see what is wrong with my code?