// Retrocompatibility : Now old 1.4 template works with new chechout process. Multishipping cannot be enabled.
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10948 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -268,8 +268,7 @@ class CartControllerCore extends FrontController
|
||||
if ($this->context->cart->id_address_delivery)
|
||||
$deliveryAddress = new Address($this->context->cart->id_address_delivery);
|
||||
$id_country = (isset($deliveryAddress) && $deliveryAddress->id) ? $deliveryAddress->id_country : Configuration::get('PS_COUNTRY_DEFAULT');
|
||||
$result['carriers'] = Carrier::getCarriersForOrder(Country::getIdZone($id_country), $groups);
|
||||
//$result['checked'] = Carrier::getDefaultCarrierSelection($result['carriers'], (int)$this->cart->id_carrier);
|
||||
|
||||
$result['HOOK_EXTRACARRIER'] = Hook::exec('extraCarrier', array('address' => (isset($deliveryAddress) && (int)$deliveryAddress->id) ? $deliveryAddress : null));
|
||||
}
|
||||
$result['summary'] = $this->context->cart->getSummaryDetails();
|
||||
|
||||
@@ -64,7 +64,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
}
|
||||
break;
|
||||
case 'updateCarrierAndGetPayments':
|
||||
if (Tools::isSubmit('delivery_option') AND Tools::isSubmit('recyclable') AND Tools::isSubmit('gift') AND Tools::isSubmit('gift_message'))
|
||||
if ((Tools::isSubmit('delivery_option') || Tools::isSubmit('id_carrier')) AND Tools::isSubmit('recyclable') AND Tools::isSubmit('gift') AND Tools::isSubmit('gift_message'))
|
||||
{
|
||||
if ($this->_processCarrier())
|
||||
{
|
||||
@@ -358,11 +358,12 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
{
|
||||
if (!$this->isLogged)
|
||||
{
|
||||
$carriers = Carrier::getCarriersForOrder(Country::getIdZone((int)Configuration::get('PS_COUNTRY_DEFAULT')));
|
||||
$carriers = $this->context->cart->simulateCarriersOutput();
|
||||
$this->context->smarty->assign(array(
|
||||
'HOOK_EXTRACARRIER' => NULL,
|
||||
'HOOK_BEFORECARRIER' => Hook::exec('beforeCarrier', array(
|
||||
'carriers' => $carriers,
|
||||
'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
|
||||
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
|
||||
'delivery_option' => $this->context->cart->getDeliveryOption()
|
||||
))
|
||||
@@ -432,6 +433,8 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
else
|
||||
$link_conditions .= '&content_only=1';
|
||||
|
||||
$carriers = $this->context->cart->simulateCarriersOutput();
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'checkedTOS' => (int)($this->context->cookie->checkedTOS),
|
||||
'recyclablePackAllowed' => (int)(Configuration::get('PS_RECYCLABLE_PACK')),
|
||||
@@ -442,6 +445,8 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
'recyclable' => (int)($this->context->cart->recyclable),
|
||||
'gift_wrapping_price' => (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE')),
|
||||
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
|
||||
'carriers' => $carriers,
|
||||
'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
|
||||
'delivery_option' => $this->context->cart->getDeliveryOption(),
|
||||
'address_collection' => $this->context->cart->getAddressCollection(),
|
||||
'opc' => true));
|
||||
@@ -456,8 +461,6 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
$this->errors[] = Tools::displayError('This address is invalid.');
|
||||
else
|
||||
{
|
||||
$carriers = Carrier::getCarriersForOrder((int)Address::getZoneById((int)($address_delivery->id)), $groups);
|
||||
|
||||
$result = array(
|
||||
'HOOK_BEFORECARRIER' => Hook::exec('beforeCarrier', array(
|
||||
'carriers' => $carriers,
|
||||
|
||||
@@ -216,9 +216,25 @@ class ParentOrderControllerCore extends FrontController
|
||||
}
|
||||
else
|
||||
$id_zone = Country::getIdZone((int)Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
|
||||
if (Tools::getIsset('delivery_option') && $this->validateDeliveryOption(Tools::getValue('delivery_option')))
|
||||
$this->context->cart->setDeliveryOption(Tools::getValue('delivery_option'));
|
||||
|
||||
if (Tools::getIsset('delivery_option'))
|
||||
{
|
||||
if ($this->validateDeliveryOption(Tools::getValue('delivery_option')))
|
||||
$this->context->cart->setDeliveryOption(Tools::getValue('delivery_option'));
|
||||
}
|
||||
elseif (Tools::getIsset('id_carrier'))
|
||||
{
|
||||
// For retrocompatibility reason, try to transform carrier to an delivery option list
|
||||
$delivery_option_list = $this->context->cart->getDeliveryOptionList();
|
||||
if (count($delivery_option_list) == 1)
|
||||
{
|
||||
$delivery_option = reset($delivery_option_list);
|
||||
$key = Cart::desintifier(Tools::getValue('id_carrier'));
|
||||
foreach ($delivery_option_list as $id_address => $options)
|
||||
if (isset($options[$key]))
|
||||
$this->context->cart->setDeliveryOption(array($id_address => $key));
|
||||
}
|
||||
}
|
||||
|
||||
Hook::exec('processCarrier', array('cart' => $this->context->cart));
|
||||
|
||||
@@ -377,17 +393,20 @@ class ParentOrderControllerCore extends FrontController
|
||||
{
|
||||
$address = new Address($this->context->cart->id_address_delivery);
|
||||
$id_zone = Address::getZoneById($address->id);
|
||||
$carriers = Carrier::getCarriersForOrder($id_zone, $this->context->customer->getGroups());
|
||||
$carriers = $this->context->cart->simulateCarriersOutput();
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'address_collection' => $this->context->cart->getAddressCollection(),
|
||||
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
|
||||
'carriers' => $carriers,
|
||||
'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
|
||||
'delivery_option' => $this->context->cart->getDeliveryOption()
|
||||
));
|
||||
$this->context->smarty->assign(array(
|
||||
'HOOK_EXTRACARRIER' => Hook::exec('extraCarrier', array('address' => $address)),
|
||||
'HOOK_BEFORECARRIER' => Hook::exec('beforeCarrier', array(
|
||||
'carriers' => $carriers,
|
||||
'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
|
||||
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
|
||||
'delivery_option' => $this->context->cart->getDeliveryOption()
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user