request = $request; $this->dispatcher = $dispatcher; } public function getPluginDescriptors() { return array( new SmartyPluginDescriptor("function", "socolissimoDeliveryPrice", $this, "socolissimoDeliveryPrice") ); } public function socolissimoDeliveryPrice($params, $smarty) { $deliveryMode = $params["delivery-mode"]; $country = Country::getShopLocation(); if (isset($params["country"])) { $country = CountryQuery::create()->findOneById($params["country"]); } $cartWeight = $this->request->getSession()->getSessionCart($this->dispatcher)->getWeight(); $cartAmount = $this->request->getSession()->getSessionCart($this->dispatcher)->getTaxedAmount($country); try { $price = SoColissimo::getPostageAmount( $country->getAreaId(), $cartWeight, $cartAmount, $deliveryMode ); } catch (DeliveryException $ex) { $smarty->assign('isValidMode', false); } $smarty->assign('deliveryModePrice', $price); } }