Magento Accessing sku's by order id on success.phtml
On the success.phtml template, I need to list t开发者_C百科he sku's from the completed order. How can I iterate through the order and retrieve these values?
you should extend Mage_Checkout_Block_Success
and add the method similar to this:
public function getOrder()
{
return Mage::getModel('sales/order')->load($this->getLastOrderId());
}
and in your success.phtml template:
$order = $this->getOrder();
foreach($order->getAllItems() as $item){
//$item is your product object and you can do what you want with this;
}
精彩评论