Jump to content

I need a help for my code for auto select


tapukatata

Recommended Posts

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

Edited by diyan1234 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...