Skip to content

Commit

Permalink
Merge pull request #49 from EaDesgin/feature/2525-Added-condition-for…
Browse files Browse the repository at this point in the history
…-undefined

#2525:Added condition for undefined
  • Loading branch information
eadesignro authored Sep 25, 2018
2 parents 0d372e2 + ef3831d commit ec5d881
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions view/frontend/web/js/form/element/city.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,22 @@ define([
var string = JSON.stringify($eaCitiesJson),
obj = JSON.parse(string),
romania = obj.RO,
romanianRegions = romania[value],
parentCity = $("[name ='shippingAddress.city']"),
currentRegionCities = romanianRegions.cities;
romanianRegions,
parentCity,
currentRegionCities;

romanianRegions = romania[value];

if(romanianRegions === undefined){

this.hide();

return romanianRegions;
}

parentCity = $("[name ='shippingAddress.city']");

currentRegionCities = romanianRegions.cities;

var cityOptions = [];
$.each(currentRegionCities, function (index, cityOptionValue) {
Expand Down Expand Up @@ -71,14 +84,6 @@ define([
this.show();
parentCity.hide();
}
$(document).on('change', "[name='city_id']", function () {

var cityIdValue = $("#shipping-new-address-form [name = 'city_id'] option:selected").text(),
cityValue = $("#shipping-new-address-form [name= 'city']").val();

cityValue = cityIdValue;

});
}
});
});
Expand Down

0 comments on commit ec5d881

Please sign in to comment.