diff --git a/admin-dev/themes/default/template/controllers/orders/form.tpl b/admin-dev/themes/default/template/controllers/orders/form.tpl index e0a57766d..57d2610c9 100755 --- a/admin-dev/themes/default/template/controllers/orders/form.tpl +++ b/admin-dev/themes/default/template/controllers/orders/form.tpl @@ -38,6 +38,11 @@ var defaults_order_state = new Array(); var customization_errors = false; var pic_dir = '{$pic_dir}'; + var currency_format = 5; + var currency_sign = ''; + var currency_blank = false; + var priceDisplayPrecision = 2; + {foreach from=$defaults_order_state key='module' item='id_order_state'} defaults_order_state['{$module}'] = '{$id_order_state}'; {/foreach} @@ -505,7 +510,6 @@ } displaySummary(res); resetBind(); - updateCurrencySign(); } }); } @@ -652,11 +656,12 @@ var id_product = Number(this.id_product); var id_product_attribute = Number(this.id_product_attribute); cart_quantity[Number(this.id_product)+'_'+Number(this.id_product_attribute)+'_'+Number(this.id_customization)] = this.cart_quantity; - cart_content += ''+this.name+'
'+this.attributes_small+''+this.reference+' '; + cart_content += ''+this.name+'
'+this.attributes_small+''+this.reference+''; cart_content += (!this.id_customization ? '

' : ''); cart_content += (!this.id_customization ? '
' : ''); cart_content += (!this.id_customization ? '
' : ''); - cart_content += ''+this.total+' '; + cart_content += '' + formatCurrency(parseFloat(this.total), currency_format, currency_sign, currency_blank) + ''; + if (this.id_customization && this.id_customization != 0) { $.each(this.customized_datas[this.id_product][this.id_product_attribute][id_address_delivery], function() { @@ -712,6 +717,11 @@ function displaySummary(jsonSummary) { + currency_format = jsonSummary.currency.format; + currency_sign = jsonSummary.currency.sign; + currency_blank = jsonSummary.currency.blank; + priceDisplayPrecision = jsonSummary.currency.decimals ? 2 : 0; + updateCartProducts(jsonSummary.summary.products, jsonSummary.summary.gift_products, jsonSummary.cart.id_address_delivery); updateCartVouchers(jsonSummary.summary.discounts); updateAddressesList(jsonSummary.addresses, jsonSummary.cart.id_address_delivery, jsonSummary.cart.id_address_invoice); @@ -738,19 +748,18 @@ $('#gift_message').html(jsonSummary.cart.gift_message); if(!changed_shipping_price) - $('#shipping_price').html(''+jsonSummary.summary.total_shipping+''); + $('#shipping_price').html('' + formatCurrency(parseFloat(jsonSummary.summary.total_shipping), currency_format, currency_sign, currency_blank) + ''); shipping_price_selected_carrier = jsonSummary.summary.total_shipping; - - $('#total_vouchers').html(jsonSummary.summary.total_discounts_tax_exc); - $('#total_shipping').html(jsonSummary.summary.total_shipping_tax_exc); - $('#total_taxes').html(jsonSummary.summary.total_tax); - $('#total_without_taxes').html(jsonSummary.summary.total_price_without_tax); - $('#total_with_taxes').html(jsonSummary.summary.total_price); - $('#total_products').html(jsonSummary.summary.total_products); + + $('#total_vouchers').html(formatCurrency(parseFloat(jsonSummary.summary.total_discounts_tax_exc), currency_format, currency_sign, currency_blank)); + $('#total_shipping').html(formatCurrency(parseFloat(jsonSummary.summary.total_shipping_tax_exc), currency_format, currency_sign, currency_blank)); + $('#total_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_tax), currency_format, currency_sign, currency_blank)); + $('#total_without_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price_without_tax), currency_format, currency_sign, currency_blank)); + $('#total_with_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price), currency_format, currency_sign, currency_blank)); + $('#total_products').html(formatCurrency(parseFloat(jsonSummary.summary.total_products), currency_format, currency_sign, currency_blank)); id_currency = jsonSummary.cart.id_currency; $('#id_currency option').removeAttr('selected'); $('#id_currency option[value="'+id_currency+'"]').attr('selected', true); - updateCurrencySign(); id_lang = jsonSummary.cart.id_lang; $('#id_lang option').removeAttr('selected'); $('#id_lang option[value="'+id_lang+'"]').attr('selected', true); @@ -778,21 +787,21 @@ qty: qty, id_customer: id_customer, id_cart: id_cart, - }, + }, success : function(res) { - displaySummary(res); - var errors = ''; - if(res.errors.length) - { - $.each(res.errors, function() { - errors += this+'
'; - }); - $('#products_err').show(); - } - else - $('#products_err').hide(); - $('#products_err').html(errors); + displaySummary(res); + var errors = ''; + if (res.errors.length) + { + $.each(res.errors, function() { + errors += this + '
'; + }); + $('#products_err').show(); + } + else + $('#products_err').hide(); + $('#products_err').html(errors); } }); } @@ -888,11 +897,6 @@ }); } - function updateCurrencySign() - { - $('.currency_sign').html(currencies[id_currency]); - } - function sendMailToCustomer() { $.ajax({ @@ -1184,7 +1188,7 @@

-    +

@@ -1208,12 +1212,12 @@

diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index b4c5bf35c..32e01834a 100755 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -684,18 +684,21 @@ class AdminCartsControllerCore extends AdminController $free_shipping = true; break; } - return array('summary' => $this->getCartSummary(), - 'delivery_option_list' => $this->getDeliveryOptionList(), - 'cart' => $this->context->cart, - 'addresses' => $this->context->customer->getAddresses((int)$this->context->cart->id_lang), - 'id_cart' => $id_cart, - 'order_message' => $message_content, - 'link_order' => $this->context->link->getPageLink( - 'order', false, - (int)$this->context->cart->id_lang, - 'step=3&recover_cart='.$id_cart.'&token_cart='.md5(_COOKIE_KEY_.'recover_cart_'.$id_cart)), - 'free_shipping' => (int)$free_shipping - ); + return array( + 'summary' => $this->getCartSummary(), + 'delivery_option_list' => $this->getDeliveryOptionList(), + 'cart' => $this->context->cart, + 'currency' => new Currency($this->context->cart->id_currency), + 'addresses' => $this->context->customer->getAddresses((int)$this->context->cart->id_lang), + 'id_cart' => $id_cart, + 'order_message' => $message_content, + 'link_order' => $this->context->link->getPageLink( + 'order', false, + (int)$this->context->cart->id_lang, + 'step=3&recover_cart='.$id_cart.'&token_cart='.md5(_COOKIE_KEY_.'recover_cart_'.$id_cart) + ), + 'free_shipping' => (int)$free_shipping + ); } public function initToolbar()