Prestashop 1.4发布购物车更新(货币转换)


Prestashop 1.4 Issue on cart update (currency conversion)

我在执行$cart->update()时遇到了一个奇怪的问题更改货币后

例如,以英镑为单位,购物车的总金额为896.32当前的转换率138889(对欧元)

因此,以欧元计算,应该是896.32*1.388889=1244.89(四舍五入2)

但如果我在结账和支付模块上,我会:

$cookie->id_currency = 1; //1 for EUR
$cart->id_currency = $cookie->id_currency;
$cart->update();
//and then...
$amount = number_format($cart->getOrderTotal(true, 3), 2, '.', '');

它完全错了。。。最后的$total变量是错误的。

调试控制台:BEFORE$cart->update()

$cart   Smarty_Variable Object (3)
->value = Cart Object (14)
   ->id = 2899
   ->id_address_delivery = "5"
   ->id_address_invoice = "5"
   ->id_currency = "3"
   ->id_customer = "3"
   ->id_guest = "998683"
   ->id_lang = "1"
   ->id_carrier = "14"
   ->recyclable = "1"
   ->gift = "0"
   ->gift_message = ""
   ->date_add = "2015-12-09 10:08:27"
   ->secure_key = "5b5c81dbecc7b7e1d9603752071321b7"
   ->date_upd = "2015-12-09 17:17:15"
->nocache = false
->scope = "Smarty root"

$total  Smarty_Variable Object (3)
->value = "£896.32"
->nocache = false
->scope = "Smarty root"

AFTER$cart->update()

$cart   Smarty_Variable Object (3)
->value = Cart Object (14)
   ->id = 2899
   ->id_address_delivery = "5"
   ->id_address_invoice = "5"
   ->id_currency = 1
   ->id_customer = "3"
   ->id_guest = "998683"
   ->id_lang = "1"
   ->id_carrier = "14"
   ->recyclable = "1"
   ->gift = "0"
   ->gift_message = ""
   ->date_add = "2015-12-09 10:08:27"
   ->secure_key = "5b5c81dbecc7b7e1d9603752071321b7"
   ->date_upd = "2015-12-09 17:19:41"
->nocache = false
->scope = "Smarty root"
$total  Smarty_Variable Object (3)
->value = "1 239,67 €"
->nocache = false
->scope = "Smarty root"

正如您所看到的,1239,67€是错误的,应该是1244,89€

请问,错误在哪里?我要为此疯狂了。非常感谢你的帮助。

发现问题

数据库上有additional_shipping_cost字段,当您更改货币时该字段不会更新。我不知道在最新的PS版本中,行为是否有所不同,但这肯定是开发人员的疏忽。