Php Magento签出成功页面上的变量
我正试图在我的Magento网站的成功页面上设置ROI 为此,我需要一个来自以下顺序的变量:Php Magento签出成功页面上的变量,php,magento,Php,Magento,我正试图在我的Magento网站的成功页面上设置ROI 为此,我需要一个来自以下顺序的变量: 产品\u ID-这应该是一个包含订单中所有产品的数组 到目前为止,我已经尝试了以下代码: <?php $order = Mage::getModel('sales/order')->load($this->getOrderId()); $items = $order->getAllItems(); $itemcount=count($items);
- 产品\u ID-这应该是一个包含订单中所有产品的数组
<?php
$order = Mage::getModel('sales/order')->load($this->getOrderId());
$items = $order->getAllItems();
$itemcount=count($items);
$name=array();
$ids=array();
?>
<?php foreach ($items as $itemId => $item) {
$ids[]=$item->getProductId();
} /* PRODUCT_ID - not showing anything */?>
提前感谢您的帮助
Dom$this->getOrderId()为您提供的是增量id,而不是订单的实体id。您可以通过以下方式加载订单:
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
订单的实际实体id存储在会话中:
Mage::getSingleton('checkout/session')->getLastOrderId()