Browse Source

Merge branch 'develop' of https://gitea.laclic.fr/Laclic/LcShopBundle into develop

feature/export_comptable
Fab 4 years ago
parent
commit
8f67159b2b
2 changed files with 16 additions and 3 deletions
  1. +4
    -1
      ShopBundle/Controller/CitiesController.php
  2. +12
    -2
      ShopBundle/Services/Utils.php

+ 4
- 1
ShopBundle/Controller/CitiesController.php View File



$return = [] ; $return = [] ;
foreach($result as $city) { foreach($result as $city) {

$codesPostaux = $city->codesPostaux ;

$return[] = [ $return[] = [
'label' => $city->nom,
'label' => '<span class="city">'.$city->nom.'</span> <span class="zip">'.$codesPostaux[0].'</span>',
'value' => $city->code 'value' => $city->code
] ; ] ;
} }

+ 12
- 2
ShopBundle/Services/Utils.php View File

return $result; return $result;
} }


public function getZipByCity($city)
public function getZipByCity($city, $code = null)
{ {
$zip = null ; $zip = null ;
$returnCitiesSearchZip = json_decode($this->callCitiesApi('get', 'communes', ['nom' => $city, 'fields' => 'nom,codesPostaux'])) ;

$paramsSearch = [
'nom' => $city,
'fields' => 'nom,codesPostaux'
] ;

if($code != null && $code != 0) {
$paramsSearch['code'] = $code ;
}

$returnCitiesSearchZip = json_decode($this->callCitiesApi('get', 'communes', $paramsSearch)) ;


if($returnCitiesSearchZip) { if($returnCitiesSearchZip) {
foreach($returnCitiesSearchZip as $citySearchZip) { foreach($returnCitiesSearchZip as $citySearchZip) {

Loading…
Cancel
Save