在success.phtml模板上,我需要从已完成的订单中列出sku。如何迭代订单并检索这些值?
答案 0 :(得分:3)
你应该扩展Mage_Checkout_Block_Success
并添加类似于此的方法:
public function getOrder()
{
return Mage::getModel('sales/order')->load($this->getLastOrderId());
}
并在您的success.phtml模板中:
$order = $this->getOrder();
foreach($order->getAllItems() as $item){
//$item is your product object and you can do what you want with this;
}