Php Magento:从订单获取固定的捆绑商品价格

Php Magento:从订单获取固定的捆绑商品价格,php,magento,magento-1.8,Php,Magento,Magento 1.8,我现在使用的是Magento 1.8.x CE,我正在尝试获取固定捆绑上选项的行项目定价: 以下是我目前仅用于测试的代码: $orderId = 18562; $order = Mage::getModel('sales/order')->load($orderId); foreach ($order->getAllItems() as $item){ echo $item->getPrice() . "<br>"; } 知道如何从固定捆绑订单中获取

我现在使用的是Magento 1.8.x CE,我正在尝试获取固定捆绑上选项的行项目定价:

以下是我目前仅用于测试的代码:

$orderId = 18562;
$order = Mage::getModel('sales/order')->load($orderId);

foreach ($order->getAllItems() as $item){ 
    echo $item->getPrice() . "<br>";
}

知道如何从固定捆绑订单中获取商品价格吗?

找到了答案,不确定这是否是最佳做法,但它正在从订单(包括固定捆绑订单)中获取所有简单产品价格

这将输出原始问题中的示例,如下所示:

“349.99,50.00”

399.9900
0.0000
0.0000
foreach ($order->getAllItems() as $item){

    /* Simple Product */
    if(($item->getProduct()->getTypeID() == 'simple') && !$item->getParentItemId()){        
        $prices[] += $item->getPrice();
    }

    /* Bundle (Fixed & Dynamic) Products */
    if($item->getProduct()->getTypeID() == 'bundle'){
        $items = $item->getProductOptions();    
        $options = $items['bundle_options'];

        foreach ($options as $option) {             
            $price = $option['value'][0]['price'];      
            $prices[] = number_format((float)$price, 2, '.', '');
        }
    }   
}

echo '"' . implode($prices,', ') . '"';