diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php
index 5c3a44325..da74d332f 100644
--- a/controllers/front/OrderOpcController.php
+++ b/controllers/front/OrderOpcController.php
@@ -139,7 +139,7 @@ class OrderOpcControllerCore extends ParentOrderController
'summary' => $this->context->cart->getSummaryDetails(),
'order_opc_adress' => $this->context->smarty->fetch(_PS_THEME_DIR_.'order-address.tpl'),
'block_user_info' => (isset($blockUserInfo) ? $blockUserInfo->hookTop(array()) : ''),
- 'carrier_list' => $this->_getCarrierList(),
+ 'carrier_data' => $this->_getCarrierList(),
'HOOK_TOP_PAYMENT' => Hook::exec('paymentTop'),
'HOOK_PAYMENT' => $this->_getPaymentMethods(),
'no_address' => 0,
@@ -195,7 +195,8 @@ class OrderOpcControllerCore extends ParentOrderController
'summary' => $this->context->cart->getSummaryDetails(),
'HOOK_TOP_PAYMENT' => Hook::exec('paymentTop'),
'HOOK_PAYMENT' => $this->_getPaymentMethods(),
- 'gift_price' => Tools::displayPrice(Tools::convertPrice(Product::getTaxCalculationMethod() == 1 ? $wrapping_fees : $wrapping_fees_tax_inc, new Currency((int)($this->context->cookie->id_currency))))
+ 'gift_price' => Tools::displayPrice(Tools::convertPrice(Product::getTaxCalculationMethod() == 1 ? $wrapping_fees : $wrapping_fees_tax_inc, new Currency((int)($this->context->cookie->id_currency)))),
+ 'carrier_data' => $this->_getCarrierList()
));
die(Tools::jsonEncode($result));
}
@@ -422,6 +423,28 @@ class OrderOpcControllerCore extends ParentOrderController
protected function _getCarrierList()
{
$address_delivery = new Address($this->context->cart->id_address_delivery);
+
+ $cms = new CMS(Configuration::get('PS_CONDITIONS_CMS_ID'), $this->context->language->id);
+ $link_conditions = $this->context->link->getCMSLink($cms, $cms->link_rewrite, true);
+ if (!strpos($link_conditions, '?'))
+ $link_conditions .= '?content_only=1';
+ else
+ $link_conditions .= '&content_only=1';
+
+ $this->context->smarty->assign(array(
+ 'checkedTOS' => (int)($this->context->cookie->checkedTOS),
+ 'recyclablePackAllowed' => (int)(Configuration::get('PS_RECYCLABLE_PACK')),
+ 'giftAllowed' => (int)(Configuration::get('PS_GIFT_WRAPPING')),
+ 'cms_id' => (int)(Configuration::get('PS_CONDITIONS_CMS_ID')),
+ 'conditions' => (int)(Configuration::get('PS_CONDITIONS')),
+ 'link_conditions' => $link_conditions,
+ 'recyclable' => (int)($this->context->cart->recyclable),
+ 'gift_wrapping_price' => (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE')),
+ 'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
+ 'delivery_option' => $this->context->cart->getDeliveryOption(),
+ 'address_collection' => $this->context->cart->getAddressCollection(),
+ 'opc' => true));
+
if ($this->context->customer->id)
$groups = $this->context->customer->getGroups();
else
@@ -433,12 +456,14 @@ class OrderOpcControllerCore extends ParentOrderController
else
{
$carriers = Carrier::getCarriersForOrder((int)Address::getZoneById((int)($address_delivery->id)), $groups);
+
$result = array(
'HOOK_BEFORECARRIER' => Hook::exec('beforeCarrier', array(
'carriers' => $carriers,
'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('extraCarrier', array('address' => $address_delivery))
);
return $result;
diff --git a/themes/prestashop/js/cart-summary.js b/themes/prestashop/js/cart-summary.js
index fdd94eed1..a7b1a7488 100644
--- a/themes/prestashop/js/cart-summary.js
+++ b/themes/prestashop/js/cart-summary.js
@@ -109,7 +109,7 @@ function changeAddressDelivery(obj)
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
if (jsonData.carriers != null)
- updateCarrierList(jsonData);
+ getCarrierListAndUpdate();
// @todo reverse the remove order
// This effect remove the current line, but it's better to remove the other one, and refresshing this one
@@ -299,7 +299,7 @@ function deleteProductFromSummary(id)
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
updateCustomizedDatas(jsonData.customizedDatas);
if (jsonData.carriers != null)
- updateCarrierList(jsonData);
+ getCarrierListAndUpdate();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
@@ -349,7 +349,7 @@ function upQuantity(id, qty)
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
if (jsonData.carriers != null)
- updateCarrierList(jsonData);
+ getCarrierListAndUpdate();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
@@ -408,7 +408,7 @@ function downQuantity(id, qty)
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
if (jsonData.carriers != null)
- updateCarrierList(jsonData);
+ getCarrierListAndUpdate();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
diff --git a/themes/prestashop/js/order-opc.js b/themes/prestashop/js/order-opc.js
index 3abb505e3..a6f4ae720 100755
--- a/themes/prestashop/js/order-opc.js
+++ b/themes/prestashop/js/order-opc.js
@@ -26,79 +26,12 @@
function updateCarrierList(json)
{
- var carriers = json.carriers;
+ var html = json.carrier_block;
- /* contains all carrier available for this address */
- if (!carriers || carriers.length == 0)
- {
- checkedCarrier = 0;
- $('input[name=id_carrier]:checked').attr('checked', false);
- $('#noCarrierWarning').show();
- $('#extra_carrier').hide();
- $('#recyclable_block').hide();
- $('table#carrierTable:visible').hide();
- }
- else
- {
- checkedCarrier = json.checked;
- var html = '';
- for (i=0;i