Restored previous version
This commit is contained in:
@@ -31,7 +31,6 @@ use Thelia\Form\Exception\FormValidationException;
|
|||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Log\Tlog;
|
use Thelia\Log\Tlog;
|
||||||
use Thelia\Model\AddressQuery;
|
use Thelia\Model\AddressQuery;
|
||||||
use Thelia\Module\Exception\DeliveryException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CouponController
|
* Class CouponController
|
||||||
@@ -75,24 +74,13 @@ class CouponController extends BaseFrontController
|
|||||||
|
|
||||||
if (null !== $deliveryModule && null !== $deliveryAddress) {
|
if (null !== $deliveryModule && null !== $deliveryAddress) {
|
||||||
$moduleInstance = $this->container->get(sprintf('module.%s', $deliveryModule->getCode()));
|
$moduleInstance = $this->container->get(sprintf('module.%s', $deliveryModule->getCode()));
|
||||||
|
|
||||||
$orderEvent = new OrderEvent($order);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
|
$postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
|
||||||
|
|
||||||
|
$orderEvent = new OrderEvent($order);
|
||||||
$orderEvent->setPostage($postage);
|
$orderEvent->setPostage($postage);
|
||||||
|
|
||||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_POSTAGE, $orderEvent);
|
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_POSTAGE, $orderEvent);
|
||||||
}
|
}
|
||||||
catch (DeliveryException $ex) {
|
|
||||||
// The postage has been chosen, but changes dues to coupon causes an exception.
|
|
||||||
// Reset the postage data in the order
|
|
||||||
$orderEvent->setDeliveryModule(0);
|
|
||||||
|
|
||||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_MODULE, $orderEvent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect($couponCodeForm->getSuccessUrl());
|
$this->redirect($couponCodeForm->getSuccessUrl());
|
||||||
|
|||||||
Reference in New Issue
Block a user