Jump to content

Default Theme: Delivery Option Default Selection


Recommended Posts

Hi all

 

In order-carrier.tpl I added the following Javascript:

<script type="text/javascript">
{literal}
$( document ).ready(function() {
$.uniform.update($('#delivery_option_1_0').attr('checked',false));
$.uniform.update($('#delivery_option_1_1').attr('checked',true));
});
{/literal}
</script>

All it does is checks delivery option 1_1 radio (my second delivery option) when the page loads.

 

This works for me.  However, for some clients, the desired radio is selected, but then the first option is selected again.  Does anyone know where the code/javascript sits that forces the selection of the first option?  I want to strip that out of existence.

 

Thanks J 

 

Link to comment
Share on other sites

Hi,

 

If you have only 2 shipping methods which shows all the time, then it should have worked fine.

 

In case you are open to use some other one page checkout module, check our module on below link. It allows you to set default shipping method, you can even change name and image easily without need to modify code.

 

http://addons.prestashop.com/en/checkout-modules/18016-knowband-one-page-checkout-social-login-mailchimp.html

 

We also has a free version of it.

Link to comment
Share on other sites

  • 3 weeks later...

I'm gettting the same issue: the problem seems to be that prestashop remembers the option you last selected, and then pre-selects that option.

So what is happening is that the javascript selects the correct option, but then prestashop comes and does it's own thing.

 

It would be good to find out where in prestashop this is done

Link to comment
Share on other sites

Resolved the issue:

the problem is the makeup of the option id: #delivery_option_1_0

the First number is the id of the users shipping address selected in the first step in checkout,so this value needs to be dynamic in the javascript.

 

That's why it worked for one user, but not anyone else.

  • Like 1
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...