diff --git a/controllers/front/OrderController.php b/controllers/front/OrderController.php index a442555b3..2900b0692 100644 --- a/controllers/front/OrderController.php +++ b/controllers/front/OrderController.php @@ -98,6 +98,7 @@ class OrderControllerCore extends ParentOrderController $delivery_option = $this->context->cart->getDeliveryOption(); $delivery_option[(int)Tools::getValue('id_address')] = Tools::getValue('id_delivery_option'); $this->context->cart->setDeliveryOption($delivery_option); + $this->context->cart->save(); $return = array( 'content' => Hook::exec( 'displayCarrierList', @@ -141,11 +142,18 @@ class OrderControllerCore extends ParentOrderController break; case 3: - // Test that the conditions (so active) were accepted by the customer + // Check that the conditions (so active) were accepted by the customer $cgv = Tools::getValue('cgv'); if (Configuration::get('PS_CONDITIONS') && (!Validate::isBool($cgv) || $cgv == false)) Tools::redirect('index.php?controller=order&step=2'); + // Check the delivery option is setted + if (!Tools::getValue('delivery_option')) + Tools::redirect('index.php?controller=order&step=2'); + foreach (Tools::getValue('delivery_option') as $delivery_option) + if (empty($delivery_option)) + Tools::redirect('index.php?controller=order&step=2'); + $this->autoStep(); // Bypass payment step if total is 0 diff --git a/themes/default/css/global.css b/themes/default/css/global.css index 9d24ec3f9..91b94de75 100644 --- a/themes/default/css/global.css +++ b/themes/default/css/global.css @@ -704,7 +704,7 @@ table#cart_summary .cart_quantity {width:130px} .cart_quantity .cart_quantity_button { float:left; position: relative; - top: -5px + top: -5px } table#cart_summary .cart_total {width:120px} table#cart_summary .cart_delete { @@ -729,11 +729,15 @@ a.price_discount_delete { border-right:none; } - table#cart_summary .cart_total_price td.cart_voucher { border-bottom:1px solid #999; vertical-align:middle } + +table#cart_summary #total_price_container { + border-bottom:1px solid #999; +} + .cart_voucher h4, .cart_voucher p {float:left;} .cart_voucher h4 { diff --git a/themes/default/lang/fr.php b/themes/default/lang/fr.php index 4cf43cba7..5adf9eb3b 100644 --- a/themes/default/lang/fr.php +++ b/themes/default/lang/fr.php @@ -325,6 +325,8 @@ $_LANG['order-address_10ac3d04253ef7e1ddc73e6091c0cd55'] = 'Suivant'; $_LANG['order-carrier_f5bf48aa40cad7891eb709fcf1fde128'] = 'produit'; $_LANG['order-carrier_86024cad1e83101d97359d7351051156'] = 'produits'; $_LANG['order-carrier_5508a53851720a210e50f7b8a6f66f46'] = 'Vous devez accepter les conditions générales de vente pour passer à l\'étape suivante.'; +$_LANG['order-carrier_643047669ab50e48c4a68c0fceae4dfc'] = 'Vous devez sélectionner une option de livraison pour passer à l\'étape suivante.'; +$_LANG['order-carrier_f8f914bbf28939b80c76166f4ea15466'] = 'Vous devez sélectionner les options de livraison pour passer à l\'étape suivante.'; $_LANG['order-carrier_e7a6ca4e744870d455a57b644f696457'] = 'Gratuit !'; $_LANG['order-carrier_ea9cf7e47ff33b2be14e6dd07cbcefc6'] = 'Frais de port'; $_LANG['order-carrier_6f05787682585c32498e88bcd2ea88fc'] = 'Méthodes de livraison'; diff --git a/themes/default/order-carrier.tpl b/themes/default/order-carrier.tpl index 70f1f8793..a17fcc985 100644 --- a/themes/default/order-carrier.tpl +++ b/themes/default/order-carrier.tpl @@ -36,17 +36,38 @@ var txtProducts = "{l s='products'}"; var orderUrl = '{$link->getPageLink("order", true)}'; - var msg = "{l s='You must agree to the terms of service before continuing.' js=1}"; + var msgCgv = "{l s='You must agree to the terms of service before continuing.' js=1}"; + var msgCarrier = "{l s='You must select a delivery option before continuing.' js=1}"; + var msgCarriers = "{l s='You must select deliveries options before continuing.' js=1}"; + {literal} - function acceptCGV() + function validateCarriers() { if ($('#cgv').length && !$('input#cgv:checked').length) { - alert(msg); + alert(msgCgv); return false; } - else - return true; + + var delivery_option = {}; + $('.delivery_option_radio').each(function () { + if (typeof(delivery_option[$(this).attr('name')]) == 'undefined') + delivery_option[$(this).attr('name')] = false; + if ($(this).is(':checked')) + delivery_option[$(this).attr('name')] = true; + }); + + $.each(delivery_option, function(i, val) { + if (!val) { + if (delivery_option.length > 1) + alert(msgCarriers); + else + alert(msgCarrier); + return false; + } + }); + + return true; } {/literal} //]]> @@ -83,7 +104,7 @@ {include file="$tpl_dir./errors.tpl"} -
+ {else}