. */ /* */ /*************************************************************************************/ namespace SoColissimo\Controller; use SoColissimo\WebService\FindById; use Symfony\Component\HttpFoundation\JsonResponse; use Thelia\Controller\Front\BaseFrontController; use Thelia\Core\HttpFoundation\Response; use Thelia\Core\Template\TemplateDefinition; use Thelia\Model\ConfigQuery; /** * Class SearchCityController * @package IciRelais\Controller * @author Thelia */ class GetSpecificLocation extends BaseFrontController { public function get($countryid, $zipcode, $city, $address="") { $content = $this->renderRaw( "getSpecificLocationSoColissimo", array( "_countryid_" => $countryid, "_zipcode_" => $zipcode, "_city_" => $city, "_address_" => $address ) ); $response = new Response($content, 200, $headers = array('Content-Type' => 'application/json')); return $response; } public function getPointInfo($point_id) { $req = new FindById(); $req->setId($point_id) ->setLangue("FR") ->setDate(date("d/m/Y")) ->setAccountNumber(ConfigQuery::read('socolissimo_login')) ->setPassword(ConfigQuery::read('socolissimo_pwd')) ; $response = $req->exec(); $response = new JsonResponse($response); return $response; } public function search() { $countryid = $this->getRequest()->query->get('countryid'); $zipcode = $this->getRequest()->query->get('zipcode'); $city = $this->getRequest()->query->get('city'); $addressId = $this->getRequest()->query->get('address'); return $this->get($countryid, $zipcode, $city, $addressId); } /** * @return ParserInterface instance parser */ protected function getParser($template = null) { $parser = $this->container->get("thelia.parser"); // Define the template that should be used $parser->setTemplateDefinition( new TemplateDefinition( 'module_socolissimo', TemplateDefinition::FRONT_OFFICE ) ); return $parser; } }