[英]Prestashop 1.4 Issue on cart update (currency conversion)
我在執行$ cart-> update()時遇到一個奇怪的問題; 更改貨幣后
例如,以磅為單位,購物車的總金額為£896.32 ,當前匯率為1.388889 (歐元)
因此,以歐元計算,應為896.32 * 1.388889 = 1244.89(四舍五入)
但是,如果我在結帳和付款模塊上,我會:
$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變量是錯誤的。
調試控制台: $ 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-> 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"
如您所見,這1 239,67€是錯誤的,應該改為1 244,89€ 。
拜托,錯誤在哪里? 我為此而瘋狂。 非常感謝您的幫助。
發現了這個問題
在數據庫中有一個extra_shipping_cost字段,當您更改幣種時該字段不會更新。 我不知道在最新的PS版本中行為是否有所不同,但這肯定是開發人員的疏忽。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.