diff --git a/admin-dev/themes/default/template/controllers/attributes/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/attributes/helpers/form/form.tpl index f5cc56a04..365736bbd 100644 --- a/admin-dev/themes/default/template/controllers/attributes/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/attributes/helpers/form/form.tpl @@ -27,7 +27,7 @@ {block name="label"} {if $input.type == 'color'} -
+
{/if} {$smarty.block.parent} {/block} diff --git a/classes/Cart.php b/classes/Cart.php index 41a7e1d24..0d7e4711a 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -953,6 +953,7 @@ class CartCore extends ObjectModel $this->update(true); $context = Context::getContext()->cloneContext(); $context->cart = $this; + Cache::clean('getContextualValue_*'); if ($auto_add_cart_rule) CartRule::autoAddToCart($context); @@ -2869,8 +2870,12 @@ class CartCore extends ObjectModel { $cart_rule['value_real'] -= $total_shipping; $cart_rule['value_tax_exc'] -= $total_shipping_tax_exc; - $total_discounts -= $total_shipping; - $total_discounts_tax_exc -= $total_shipping_tax_exc; + $cart_rule['value_real'] = Tools::ps_round($cart_rule['value_real'], (int)$context->currency->decimals * _PS_PRICE_DISPLAY_PRECISION_); + $cart_rule['value_tax_exc'] = Tools::ps_round($cart_rule['value_tax_exc'], (int)$context->currency->decimals * _PS_PRICE_DISPLAY_PRECISION_); + if ($total_discounts > $cart_rule['value_real']) + $total_discounts -= $total_shipping; + if ($total_discounts_tax_exc > $cart_rule['value_tax_exc']) + $total_discounts_tax_exc -= $total_shipping_tax_exc; // Update total shipping $total_shipping = 0; diff --git a/classes/CartRule.php b/classes/CartRule.php index 228f15607..1b0177810 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -912,7 +912,7 @@ class CartRuleCore extends ObjectModel if ($cart_vat_amount == 0 || $cart_amount_te == 0) $cart_average_vat_rate = 0; else - $cart_average_vat_rate = $cart_vat_amount / $cart_amount_te; + $cart_average_vat_rate = Tools::ps_round($cart_vat_amount / $cart_amount_te, 3); if ($this->reduction_tax && !$use_tax) $reduction_value += $prorata * $reduction_amount / (1 + $cart_average_vat_rate); diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 8a9f2e643..f23fd83b7 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -429,13 +429,14 @@ abstract class PaymentModuleCore extends Module // Set the new voucher value if ($voucher->reduction_tax) - $voucher->reduction_amount = $values['tax_incl'] - $order->total_products_wt; + $voucher->reduction_amount = $values['tax_incl'] - $order->total_products_wt - $order->total_shipping_tax_incl; else - $voucher->reduction_amount = $values['tax_excl'] - $order->total_products; + $voucher->reduction_amount = $values['tax_excl'] - $order->total_products - $order->total_shipping_tax_excl; $voucher->id_customer = $order->id_customer; $voucher->quantity = 1; $voucher->quantity_per_user = 1; + $voucher->free_shipping = 0; if ($voucher->add()) { // If the voucher has conditions, they are now copied to the new voucher diff --git a/classes/Tools.php b/classes/Tools.php index ca10a4785..08705746b 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -2347,16 +2347,16 @@ exit; $addons_url = 'api.addons.prestashop.com'; $postData = ''; $postDataArray = array( - 'version' => _PS_VERSION_, - 'iso_lang' => strtolower(Context::getContext()->language->iso_code), - 'iso_code' => strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))), - 'shop_url' => urlencode(Tools::getShopDomain()), - 'mail' => urlencode(Configuration::get('PS_SHOP_EMAIL')) + 'version' => isset($params['version']) ? $params['version'] : _PS_VERSION_, + 'iso_lang' => Tools::strtolower(isset($params['iso_lang']) ? $params['iso_lang'] : Context::getContext()->language->iso_code), + 'iso_code' => Tools::strtolower(isset($params['iso_country']) ? $params['iso_country'] : Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))), + 'shop_url' => urlencode(isset($params['shop_url']) ? $params['shop_url'] : Tools::getShopDomain()), + 'mail' => urlencode(isset($params['email']) ? $params['email'] : Configuration::get('email')) ); foreach ($postDataArray as $postDataKey => $postDataValue) $postData .= '&'.$postDataKey.'='.$postDataValue; $postData = ltrim($postData, '&'); - + // Config for each request if ($request == 'native') { diff --git a/classes/controller/Controller.php b/classes/controller/Controller.php index 7e4ebf6ed..0d4591455 100644 --- a/classes/controller/Controller.php +++ b/classes/controller/Controller.php @@ -175,8 +175,8 @@ abstract class ControllerCore // then using displayAjax[action] if ($this->ajax) { - $action = Tools::getValue('action'); - if (!empty($action) && method_exists($this, 'displayAjax'.Tools::toCamelCase($action, true))) + $action = Tools::toCamelCase(Tools::getValue('action', true)); + if (!empty($action) && method_exists($this, $action)) $this->{'displayAjax'.$action}(); elseif (method_exists($this, 'displayAjax')) $this->displayAjax(); diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 90a845d02..fc0cf91ce 100755 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -101,15 +101,15 @@ class AdminCartsControllerCore extends AdminController { if (!($cart = $this->loadObject(true))) return; - $customer = new Customer($cart->id_customer); + $currency = new Currency($cart->id_currency); $this->context->cart = $cart; + $this->context->currency = $currency; $this->context->customer = $customer; $products = $cart->getProducts(); $customized_datas = Product::getAllCustomizedDatas((int)$cart->id); Product::addCustomizationPrice($products, $customized_datas); $summary = $cart->getSummaryDetails(); - $currency = new Currency($cart->id_currency); /* Display order information */ $id_order = (int)Order::getOrderByCartId($cart->id); @@ -739,6 +739,7 @@ class AdminCartsControllerCore extends AdminController { $context = Context::getContext(); $context->cart = new Cart($id_cart); + $context->currency = new Currency((int)$context->cart->id_currency); $context->customer = new Customer((int)$context->cart->id_customer); return Cart::getTotalCart($id_cart, true, Cart::BOTH_WITHOUT_SHIPPING); } diff --git a/controllers/admin/AdminCountriesController.php b/controllers/admin/AdminCountriesController.php index 00d1a8cd1..5a80556cd 100644 --- a/controllers/admin/AdminCountriesController.php +++ b/controllers/admin/AdminCountriesController.php @@ -442,7 +442,7 @@ class AdminCountriesControllerCore extends AdminController $html .= '
  • '.$class_name.''; foreach (AddressFormat::getValidateFields($class_name) as $name) - $fields[] = ' + $fields[] = ' '.$name.''; $html .= '
    diff --git a/install-dev/controllers/http/process.php b/install-dev/controllers/http/process.php index 047a84370..f9d98996f 100644 --- a/install-dev/controllers/http/process.php +++ b/install-dev/controllers/http/process.php @@ -331,8 +331,6 @@ class InstallControllerHttpProcess extends InstallControllerHttp */ public function display() { - $this->initializeContext(); - // The installer SHOULD take less than 32M, but may take up to 35/36M sometimes. So 42M is a good value :) $low_memory = Tools::getMemoryLimit() < Tools::getOctets('42M'); @@ -361,8 +359,15 @@ class InstallControllerHttpProcess extends InstallControllerHttp $this->process_steps[] = $install_modules; $install_modules = array('key' => 'installModulesAddons', 'lang' => $this->l('Install modules Addons')); + + $params = array('iso_lang' => $this->language->getLanguageIso(), + 'iso_country' => $this->session->shop_country, + 'email' => $this->session->admin_email, + 'shop_url' => Tools::getHttpHost(), + 'version' => _PS_INSTALL_VERSION_); + if ($low_memory) - foreach ($this->model_install->getAddonsModulesList() as $module) + foreach ($this->model_install->getAddonsModulesList($params) as $module) $install_modules['subtasks'][] = array('module' => (string)$module['name'], 'id_module' => (string)$module['id_module']); $this->process_steps[] = $install_modules; diff --git a/install-dev/models/install.php b/install-dev/models/install.php index 2780f23de..ca62908fc 100644 --- a/install-dev/models/install.php +++ b/install-dev/models/install.php @@ -587,10 +587,10 @@ class InstallModelInstall extends InstallAbstractModel return $modules; } - public function getAddonsModulesList() + public function getAddonsModulesList($params = array()) { $addons_modules = array(); - $content = Tools::addonsRequest('install-modules'); + $content = Tools::addonsRequest('install-modules', $params); $xml = @simplexml_load_string($content, null, LIBXML_NOCDATA); if ($xml !== false and isset($xml->module)) diff --git a/themes/default/address.tpl b/themes/default/address.tpl index f193fec91..689440edd 100644 --- a/themes/default/address.tpl +++ b/themes/default/address.tpl @@ -220,7 +220,7 @@ $(function(){ldelim}

    - +

    diff --git a/themes/default/js/cart-summary.js b/themes/default/js/cart-summary.js index f4477fec2..c1c0ac3c7 100644 --- a/themes/default/js/cart-summary.js +++ b/themes/default/js/cart-summary.js @@ -655,9 +655,9 @@ function updateCartSummary(json) location.reload(); if (priceDisplayMethod !== 0) - $('#total_discount').html(formatCurrency(json.total_discounts_tax_exc, currencyFormat, currencySign, currencyBlank)); + $('#total_discount').html('-' + formatCurrency(json.total_discounts_tax_exc, currencyFormat, currencySign, currencyBlank)); else - $('#total_discount').html(formatCurrency(json.total_discounts, currencyFormat, currencySign, currencyBlank)); + $('#total_discount').html('-' + formatCurrency(json.total_discounts, currencyFormat, currencySign, currencyBlank)); $('.cart_discount').each(function(){ var idElmt = $(this).attr('id').replace('cart_discount_',''); @@ -667,10 +667,12 @@ function updateCartSummary(json) if (json.discounts[i].id_discount == idElmt) { if (json.discounts[i].value_real !== '!') + { if (priceDisplayMethod !== 0) $('#cart_discount_' + idElmt + ' td.cart_discount_price span.price-discount').html(formatCurrency(json.discounts[i].value_tax_exc * -1, currencyFormat, currencySign, currencyBlank)); else $('#cart_discount_' + idElmt + ' td.cart_discount_price span.price-discount').html(formatCurrency(json.discounts[i].value_real * -1, currencyFormat, currencySign, currencyBlank)); + } toDelete = false; } if (toDelete) diff --git a/themes/default/js/order-opc.js b/themes/default/js/order-opc.js index c053b38c2..162f95553 100644 --- a/themes/default/js/order-opc.js +++ b/themes/default/js/order-opc.js @@ -265,6 +265,7 @@ function confirmFreeOrder() else $('#opc_account-overlay').fadeIn('slow'); $('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow'); + $('#confirmOrder').attr('disabled', 'disabled'); $.ajax({ type: 'POST', headers: { "cache-control": "no-cache" }, @@ -275,6 +276,7 @@ function confirmFreeOrder() data: 'ajax=true&method=makeFreeOrder&token=' + static_token , success: function(html) { + $('#confirmOrder').attr('disabled', ''); var array_split = html.split(':'); if (array_split[0] == 'freeorder') { diff --git a/tools/profiling/Controller.php b/tools/profiling/Controller.php index 1b55dd0dd..923faccec 100644 --- a/tools/profiling/Controller.php +++ b/tools/profiling/Controller.php @@ -227,8 +227,8 @@ abstract class Controller extends ControllerCore // then using displayAjax[action] if ($this->ajax) { - $action = Tools::getValue('action'); - if (!empty($action) && method_exists($this, 'displayAjax'.Tools::toCamelCase($action))) + $action = 'displayAjax'.Tools::toCamelCase(Tools::getValue('action', true)); + if (!empty($action) && method_exists($this, $action)) $this->{'displayAjax'.$action}(); elseif (method_exists($this, 'displayAjax')) $this->displayAjax();