[-] FO : Check for cart rules before diplaying shopping cart in OPC

This commit is contained in:
gRoussac
2013-03-13 18:42:40 +01:00
parent 930e10f87c
commit be6ad7855a
5 changed files with 24 additions and 13 deletions
+13 -2
View File
@@ -290,6 +290,17 @@ class OrderOpcControllerCore extends ParentOrderController
{ {
parent::initContent(); parent::initContent();
/* id_carrier is not defined in database before choosing a carrier, set it to a default one to match a potential cart _rule */
if (empty($this->context->cart->id_carrier))
{
$checked = $this->context->cart->simulateCarrierSelectedOutput();
$checked = ((int)Cart::desintifier($checked));
$this->context->cart->id_carrier = $checked;
$this->context->cart->update();
CartRule::autoRemoveFromCart($this->context);
CartRule::autoAddToCart($this->context);
}
// SHOPPING CART // SHOPPING CART
$this->_assignSummaryInformations(); $this->_assignSummaryInformations();
// WRAPPING AND TOS // WRAPPING AND TOS
@@ -337,9 +348,9 @@ class OrderOpcControllerCore extends ParentOrderController
/* Load guest informations */ /* Load guest informations */
if ($this->isLogged && $this->context->cookie->is_guest) if ($this->isLogged && $this->context->cookie->is_guest)
$this->context->smarty->assign('guestInformations', $this->_getGuestInformations()); $this->context->smarty->assign('guestInformations', $this->_getGuestInformations());
// ADDRESS
if ($this->isLogged) if ($this->isLogged)
$this->_assignAddress(); // ADDRESS $this->_assignAddress();
// CARRIER // CARRIER
$this->_assignCarrier(); $this->_assignCarrier();
// PAYMENT // PAYMENT
+1 -1
View File
@@ -460,7 +460,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();
$delivery_option_list = $this->context->cart->getDeliveryOptionList(); $delivery_option_list = $this->context->cart->getDeliveryOptionList();
$this->setDefaultCarrierSelection($this->context->cart->getDeliveryOptionList()); $this->setDefaultCarrierSelection($delivery_option_list);
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'address_collection' => $this->context->cart->getAddressCollection(), 'address_collection' => $this->context->cart->getAddressCollection(),