0
私はカスタム価格の商品をいくつか持っています。選択されたオプションに応じて、製品に料金を追加する式が適用されるため、価格は決して同じではありません。私が追加した場合Magento:注文価格で商品を並べ替え、価格は常に0
$order = Mage::registry('current_order');
$items = $order->getItemsCollection();
foreach ($items as $item) {
try {
$cart->addOrderItem($item);
...
:私が持っている問題は、並べ替えたときに、並べ替え、製品の価格は常に0
販売/コントローラ/ OrderControllerであり、機能の追加注文で、これがあることですこれらの行は、私はカスタム価格を取得することができますが、商品を編集する方法を見つけることができないので、価格は注文に追加されます。
$options = $item->getProductOptions();
$options = $options['info_buyRequest'];
$customPrice = $options['custom_price'];
私は成功せず、($ cart-> addOrderItem($アイテム)の前に、ループ内で)試してみました何があります。
$item->setSpecialPrice($customPrice);
$item->setCustomPrice($customPrice);
$item->setOriginalPrice($customPrice);
$item->setBaseOriginalPrice($customPrice);
$item->setBaseCost($customPrice);
$item->setBaseRowInvoiced($customPrice);
$item->setRowInvoiced($customPrice);
$item->save();
助けが必要ですか?
ありがとうございます!私はこれを試してみるでしょうが、あなたの$ itemはどこから来ますか? –
Ups、申し訳ありません、それは '$ observer-> getQuoteItem()'になります。私はサンプルコードを更新しました。 – Vinai
ええ、私はあなたの答えの前にそれを理解しました、そして、それはうまくいきます。どうもありがとうございます! –