I need help with my code. I have a prestashop shipping module where I have a list with cities and shipping carrier offices. In some cities there are more than one shipping carrier offices and when anyone select the city after that must chose a shipping carrier office. BUT for some cities there is just one shipping carrier office and I want to auto select it after choosing the city.
Here is what I have added:
if($('#office_name_select option').length == 2){
$('#office_name_select option:last-child').attr('selected','selected');
$('#office_name_select').trigger('chosen:updated');
$('#office_name_select').trigger('change');
}
also:
}
if(data.length == 1){
$('#office_name_select option:last-child').attr('selected','selected');
The code is working for Fron Office but after that the selected city and auto selected (if it is only one) shipping carrier office they are not saved in Back Office.
Any ideas how Can I resolve the problem?
Here is Diff Checker: https://www.diffchecker.com/hicaG2EE