我在更改货币后执行 $ cart-> update(); 时出现了一个奇怪的问题
e.g。以磅为单位,购物车的总金额£896.32 目前的转换率 1.388889 (对欧元)
所以,欧元应该是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 变量是错误的。
DEBUG CONSOLE: 在$ 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"
售后$ cart->更新();
$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"
你可以看到, 1 239,67€是错误的,应该 1 244,89€,而不是。
请问,错误在哪里?我为此疯狂。 非常感谢你的帮助。
答案 0 :(得分:0)
发现问题
数据库上有 additional_shipping_cost 字段,当您更改货币时,该字段未更新。 我不知道在最新的PS版本中,行为是否有所不同,但这肯定是开发人员的疏忽。