如何从 magento 1.9.2 社区版中的订单项目集合中获取小计
How to get subtotal from order items collection in magento 1.9.2 community edition
我正在尝试像后端一样在前端显示订单详细信息
这是我的代码
$orderData = Mage::getSingleton('sales/order')->loadByIncrementId($incrementId);
$itemCollection = $orderData->getItemsCollection();
foreach($itemsCollection as $_items) {
echo $_items->getName();
echo $_items->getStatus();
echo $_items->getOriginalPrice();
echo $_items->getPrice();
echo $_items->getQtyOrdered();
echo $_items->getSubTotal();
echo $_items->getTaxAmount();
echo $_items->getPercent();
echo $_items->getDiscountAmount();
echo $_items->getRowTotal();
}
除了小计,我得到了所有我也试过的东西:
echo $_items->getBaseSubtotal();
但我仍然得到空值。
来自Amit Bera's answer on Magento.SE:
base_subtotal is field of Order table.
it is not field to sales order item table..So you did not get data
from $_items->getBaseSubtotal()
In order to get a sales item base total try below code:
$items->getBaseRowTotal();
我正在尝试像后端一样在前端显示订单详细信息
这是我的代码
$orderData = Mage::getSingleton('sales/order')->loadByIncrementId($incrementId);
$itemCollection = $orderData->getItemsCollection();
foreach($itemsCollection as $_items) {
echo $_items->getName();
echo $_items->getStatus();
echo $_items->getOriginalPrice();
echo $_items->getPrice();
echo $_items->getQtyOrdered();
echo $_items->getSubTotal();
echo $_items->getTaxAmount();
echo $_items->getPercent();
echo $_items->getDiscountAmount();
echo $_items->getRowTotal();
}
除了小计,我得到了所有我也试过的东西:
echo $_items->getBaseSubtotal();
但我仍然得到空值。
来自Amit Bera's answer on Magento.SE:
base_subtotal is field of Order table.
it is not field to sales order item table..So you did not get data from
$_items->getBaseSubtotal()
In order to get a sales item base total try below code:
$items->getBaseRowTotal();