// Retrocompatibility with carriers modules

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12614 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mDeflotte
2012-01-23 15:50:50 +00:00
parent 2227bdc63f
commit 441f643fda
10 changed files with 186 additions and 66 deletions
+1 -1
View File
@@ -268,7 +268,7 @@ class CartControllerCore extends FrontController
$deliveryAddress = new Address($this->context->cart->id_address_delivery);
$id_country = (isset($deliveryAddress) && $deliveryAddress->id) ? $deliveryAddress->id_country : Configuration::get('PS_COUNTRY_DEFAULT');
$result['HOOK_EXTRACARRIER'] = Hook::exec('displayCarrierList', array('address' => (isset($deliveryAddress) && (int)$deliveryAddress->id) ? $deliveryAddress : null));
Cart::addExtraCarriers($result);
}
$result['summary'] = $this->context->cart->getSummaryDetails();
$result['customizedDatas'] = Product::getAllCustomizedDatas($this->context->cart->id, null, true);
+17
View File
@@ -92,6 +92,23 @@ class OrderControllerCore extends ParentOrderController
{
global $isVirtualCart;
if (Tools::isSubmit('ajax') && Tools::getValue('method') == 'updateExtraCarrier')
{
// Change virtualy the currents delivery options
$delivery_option = $this->context->cart->getDeliveryOption();
$delivery_option[(int)Tools::getValue('id_address')] = Tools::getValue('id_delivery_option');
$this->context->cart->setDeliveryOption($delivery_option);
$return = array(
'content' => Hook::exec(
'displayCarrierList',
array(
'address' => new Address((int)Tools::getValue('id_address'))
)
)
);
die(Tools::jsonEncode($return));
}
if ($this->nbProducts)
$this->context->smarty->assign('virtual_cart', $isVirtualCart);
+18 -5
View File
@@ -68,12 +68,16 @@ class OrderOpcControllerCore extends ParentOrderController
{
if ($this->_processCarrier())
{
$carriers = $this->context->cart->simulateCarriersOutput();
$address_delivery = new Address($this->context->cart->id_address_delivery);
$return = array(
'summary' => $this->context->cart->getSummaryDetails(),
'HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'),
'HOOK_PAYMENT' => $this->_getPaymentMethods(),
'carrier_data' => $this->_getCarrierList(),
'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array('carriers' => $carriers))
);
Cart::addExtraCarriers($return);
die(Tools::jsonEncode($return));
}
else
@@ -436,8 +440,7 @@ class OrderOpcControllerCore extends ParentOrderController
$link_conditions .= '&content_only=1';
$carriers = $this->context->cart->simulateCarriersOutput();
$this->context->smarty->assign(array(
$vars = array(
'checkedTOS' => (int)($this->context->cookie->checkedTOS),
'recyclablePackAllowed' => (int)(Configuration::get('PS_RECYCLABLE_PACK')),
'giftAllowed' => (int)(Configuration::get('PS_GIFT_WRAPPING')),
@@ -451,7 +454,17 @@ class OrderOpcControllerCore extends ParentOrderController
'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
'delivery_option' => $this->context->cart->getDeliveryOption(),
'address_collection' => $this->context->cart->getAddressCollection(),
'opc' => true));
'opc' => true,
'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array(
'carriers' => $carriers,
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
'delivery_option' => $this->context->cart->getDeliveryOption()
))
);
Cart::addExtraCarriers($vars);
$this->context->smarty->assign($vars);
if ($this->context->customer->id)
$groups = $this->context->customer->getGroups();
@@ -469,9 +482,9 @@ class OrderOpcControllerCore extends ParentOrderController
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
'delivery_option' => $this->context->cart->getDeliveryOption()
)),
'carrier_block' => $this->context->smarty->fetch(_PS_THEME_DIR_.'order-carrier.tpl'),
'HOOK_EXTRACARRIER' => Hook::exec('displayCarrierList', array('address' => $address_delivery))
'carrier_block' => $this->context->smarty->fetch(_PS_THEME_DIR_.'order-carrier.tpl')
);
Cart::addExtraCarriers($result);
return $result;
}
if (sizeof($this->errors))
+7 -3
View File
@@ -406,15 +406,19 @@ class ParentOrderControllerCore extends FrontController
'checked' => $checked,
'delivery_option' => $this->context->cart->getDeliveryOption()
));
$this->context->smarty->assign(array(
'HOOK_EXTRACARRIER' => Hook::exec('displayCarrierList', array('address' => $address)),
$vars = array(
'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array(
'carriers' => $carriers,
'checked' => $checked,
'delivery_option_list' => $delivery_option_list,
'delivery_option' => $this->context->cart->getDeliveryOption()
))
));
);
Cart::addExtraCarriers($vars);
$this->context->smarty->assign($vars);
}
protected function _assignWrappingAndTOS()