【问题标题】:How to get subtotal from order items collection in magento 1.9.2 community edition如何从magento 1.9.2社区版中的订单项集合中获取小计
【发布时间】:2016-10-31 23:02:47
【问题描述】:

我正在尝试在前端显示订单详细信息,就像在后端一样

这是我的代码

$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();

但我仍然得到空值。

【问题讨论】:

标签: php magento magento-1.9


【解决方案1】:

来自Amit Bera's answer on Magento.SE

base_subtotal订单表的字段

它不是销售订单项目表的字段。。所以你没有得到数据 来自$_items->getBaseSubtotal()

为了获得销售项目基数,请尝试以下代码:

$items->getBaseRowTotal();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-26
    • 1970-01-01
    • 2019-02-24
    • 2012-03-05
    • 1970-01-01
    • 2017-11-22
    相关资源
    最近更新 更多