getAreaForCountry($country)) { $select = $this->getRequest()->get('select-forfait'); if ($select !== null && $select !== "") $postage = $select; else $postage = $area->getPostage(); } else { throw new \InvalidArgumentException("Country or Area should not be null"); } return $postage === null ? 0 : $postage; } /** * This method is called by the Delivery loop, to check if the current module has to be displayed to the customer. * Override it to implements your delivery rules/ * * If you return true, the delivery method will de displayed to the customer * If you return false, the delivery method will not be displayed * * @param Country $country the country to deliver to. * * @return boolean */ public function isValidDelivery(Country $country) { // We should find an area for the country. return null !== $this->getAreaForCountry($country); } }