// Don't preselect delivery options

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13488 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mDeflotte
2012-02-21 10:02:56 +00:00
parent 49450cdf05
commit 30cdc8b277
3 changed files with 12 additions and 9 deletions
+4 -1
View File
@@ -2038,7 +2038,7 @@ class CartCore extends ObjectModel
* Get the delivery option seleted, or if no delivery option was selected, the cheapest option for each address * Get the delivery option seleted, or if no delivery option was selected, the cheapest option for each address
* @return array delivery option * @return array delivery option
*/ */
public function getDeliveryOption($default_country = null) public function getDeliveryOption($default_country = null, $dontAutoSeletectOptions = false)
{ {
$delivery_option_list = $this->getDeliveryOptionList($default_country); $delivery_option_list = $this->getDeliveryOptionList($default_country);
@@ -2057,6 +2057,9 @@ class CartCore extends ObjectModel
if ($validated) if ($validated)
return $delivery_option; return $delivery_option;
} }
if ($dontAutoSeletectOptions)
return false;
// No delivery option selected or delivery option selected is not valid, get the better for all options // No delivery option selected or delivery option selected is not valid, get the better for all options
$delivery_option = array(); $delivery_option = array();
+5 -5
View File
@@ -376,7 +376,7 @@ class OrderOpcControllerCore extends ParentOrderController
'carriers' => $carriers, 'carriers' => $carriers,
'checked' => $this->context->cart->simulateCarrierSelectedOutput(), 'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(), 'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
'delivery_option' => $this->context->cart->getDeliveryOption() 'delivery_option' => $this->context->cart->getDeliveryOption(null, true)
)) ))
)); ));
} }
@@ -411,7 +411,7 @@ class OrderOpcControllerCore extends ParentOrderController
else else
return '<p class="warning">'.Tools::displayError('Error: There are no carriers available that deliver to this address').'</p>'; return '<p class="warning">'.Tools::displayError('Error: There are no carriers available that deliver to this address').'</p>';
} }
if (!$this->context->cart->getDeliveryOption() && !$this->context->cart->isVirtualCart()) if (!$this->context->cart->getDeliveryOption(null, true) && !$this->context->cart->isVirtualCart())
return '<p class="warning">'.Tools::displayError('Error: please choose a carrier').'</p>'; return '<p class="warning">'.Tools::displayError('Error: please choose a carrier').'</p>';
if (!$this->context->cart->id_currency) if (!$this->context->cart->id_currency)
return '<p class="warning">'.Tools::displayError('Error: no currency has been selected').'</p>'; return '<p class="warning">'.Tools::displayError('Error: no currency has been selected').'</p>';
@@ -464,13 +464,13 @@ class OrderOpcControllerCore extends ParentOrderController
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(), 'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
'carriers' => $carriers, 'carriers' => $carriers,
'checked' => $this->context->cart->simulateCarrierSelectedOutput(), 'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
'delivery_option' => $this->context->cart->getDeliveryOption(), 'delivery_option' => $this->context->cart->getDeliveryOption(null, true),
'address_collection' => $this->context->cart->getAddressCollection(), 'address_collection' => $this->context->cart->getAddressCollection(),
'opc' => true, 'opc' => true,
'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array( 'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array(
'carriers' => $carriers, 'carriers' => $carriers,
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(), 'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
'delivery_option' => $this->context->cart->getDeliveryOption() 'delivery_option' => $this->context->cart->getDeliveryOption(null, true)
)) ))
); );
@@ -488,7 +488,7 @@ class OrderOpcControllerCore extends ParentOrderController
'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array( 'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array(
'carriers' => $carriers, 'carriers' => $carriers,
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(), 'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
'delivery_option' => $this->context->cart->getDeliveryOption() 'delivery_option' => $this->context->cart->getDeliveryOption(null, true)
)), )),
'carrier_block' => $this->context->smarty->fetch(_PS_THEME_DIR_.'order-carrier.tpl') 'carrier_block' => $this->context->smarty->fetch(_PS_THEME_DIR_.'order-carrier.tpl')
); );
+3 -3
View File
@@ -409,7 +409,7 @@ class ParentOrderControllerCore extends FrontController
'delivery_option_list' => $delivery_option_list, 'delivery_option_list' => $delivery_option_list,
'carriers' => $carriers, 'carriers' => $carriers,
'checked' => $checked, 'checked' => $checked,
'delivery_option' => $this->context->cart->getDeliveryOption() 'delivery_option' => $this->context->cart->getDeliveryOption(null, true)
)); ));
$vars = array( $vars = array(
@@ -417,7 +417,7 @@ class ParentOrderControllerCore extends FrontController
'carriers' => $carriers, 'carriers' => $carriers,
'checked' => $checked, 'checked' => $checked,
'delivery_option_list' => $delivery_option_list, 'delivery_option_list' => $delivery_option_list,
'delivery_option' => $this->context->cart->getDeliveryOption() 'delivery_option' => $this->context->cart->getDeliveryOption(null, true)
)) ))
); );
@@ -453,7 +453,7 @@ class ParentOrderControllerCore extends FrontController
'carriers' => $this->context->cart->simulateCarriersOutput(), 'carriers' => $this->context->cart->simulateCarriersOutput(),
'checked' => $this->context->cart->simulateCarrierSelectedOutput(), 'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
'address_collection' => $this->context->cart->getAddressCollection(), 'address_collection' => $this->context->cart->getAddressCollection(),
'delivery_option' => $this->context->cart->getDeliveryOption(), 'delivery_option' => $this->context->cart->getDeliveryOption(null, true),
'gift_wrapping_price' => (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE')), 'gift_wrapping_price' => (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE')),
'total_wrapping_cost' => Tools::convertPrice($wrapping_fees_tax_inc, $this->context->currency), 'total_wrapping_cost' => Tools::convertPrice($wrapping_fees_tax_inc, $this->context->currency),
'total_wrapping_tax_exc_cost' => Tools::convertPrice($wrapping_fees, $this->context->currency))); 'total_wrapping_tax_exc_cost' => Tools::convertPrice($wrapping_fees, $this->context->currency)));