Magento recalc命令不会改变总数

时间:2015-01-06 01:13:30

标签: magento observers

我在'sales_model_service_quote_submit_success'上有观察员,我动态修改了产品价格。 我尝试重新计算订单,但总数不会改变。

已经尝试过:

$ItemOfOrder->setCustomPrice(20);
$ItemOfOrder->setOriginalCustomPrice(20);
$ItemOfOrder->setPrice(20);
$ItemOfOrder->setBasePrice(20);
$ItemDoPedido->setOriginalPrice(20);

// Enable super mode on the product.
$ItemOfOrder->setIsSuperMode(true);
//$ItemDoPedido->calcRowTotal();
$ItemOfOrder->save();


$quote->setRowTotal(20);
$quote->setBaseRowTotal(21);
$quote->setRowTotalWithDiscount(22);
$quote->setBaseRowTotalInclTax(23);
$quote->collectTotals(24);
$quote->setTotalsCollectedFlag(false);
$quote->getShippingAddress()->unsetData('cached_items_all');
$quote->getShippingAddress()->unsetData('cached_items_nominal');
$quote->getShippingAddress()->unsetData('cached_items_nonnominal');
$quote->collectTotals();

1 个答案:

答案 0 :(得分:0)

如果你尝试在de计算中使用地址数据?

$address = $quote->getAddress();
$address->collectTotals();
$quote->setGrandTotal($address->getGrandTotal());