Added Model\Module::getModuleInstance() method

This commit is contained in:
Franck Allimant
2014-05-15 16:50:34 +02:00
parent 9c0cc178b4
commit 683664cb07
8 changed files with 27 additions and 7 deletions

View File

@@ -177,7 +177,7 @@ class CartController extends BaseFrontController
$deliveryAddress = AddressQuery::create()->findPk($order->chosenDeliveryAddress);
if (null !== $deliveryModule && null !== $deliveryAddress) {
$moduleInstance = $this->container->get(sprintf('module.%s', $deliveryModule->getCode()));
$moduleInstance = $deliveryModule->getModuleInstance($this->container);
$orderEvent = new OrderEvent($order);

View File

@@ -69,12 +69,14 @@ class CouponController extends BaseFrontController
/* recalculate postage amount */
$order = $this->getSession()->getOrder();
if (null !== $order) {
$deliveryModule = $order->getModuleRelatedByDeliveryModuleId();
$deliveryAddress = AddressQuery::create()->findPk($order->chosenDeliveryAddress);
if (null !== $deliveryModule && null !== $deliveryAddress) {
$moduleInstance = $this->container->get(sprintf('module.%s', $deliveryModule->getCode()));
$moduleInstance = $deliveryModule->getModuleInstance($this->container);
$orderEvent = new OrderEvent($order);

View File

@@ -88,7 +88,8 @@ class OrderController extends BaseFrontController
}
/* get postage amount */
$moduleInstance = $this->container->get(sprintf('module.%s', $deliveryModule->getCode()));
$moduleInstance = $deliveryModule->getModuleInstance($this->container);
$postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
$orderEvent = $this->getOrderEvent();