开发者

Magento Accessing sku's by order id on success.phtml

开发者 https://www.devze.com 2023-02-26 14:13 出处:网络
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_Succes

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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消