Prestashop on delivery select hide/show payment method

I'm trying to figure out how to show/hide payment method on delivery method select.

I tryed couple solutions but it didn't worked for me.

One of them is this one:

<script>
   $(document).ready(function(){
       toggleFields();

       $('.delivery_option_radio').on('change', function() {
           toggleFields();
       });
   });

   function toggleFields() {
       if ($('#delivery_option_3_0').is(':checked')) {
          alert("Selected")
       } else {
          alert("Not Selected");
       }
   }
</script>

Problem is that it works just 2 times. Example:

Page loads, alert box appears and shows: Selected, then I select other radio button it shows "Not Selected" and then it stops working.

Any solutions ? I found this tutorial here:

http://jsfiddle.net/ngaK8

I read that it could be something with ajax.. that I have to reload my jQuery because delivery radio buttons uses ajax to calculate total price.

Answers:

Answer

No need to another code development hassle. Use very good and free Ship to Pay module . Works with 1.6/1.5 and even with 1.4

How its works? You have ex. Cash on Delivery shipping/payment method. So in next Payment step Your customer will not see any Bankwire, PayPal, Pick Up in Store options just one Cash on Delivery COD method.

Next example. Customer want Pick up order directly in store. He choose Delivery option Pick up in Store and in Payment mehtods will not see Cash on Delivery payment method or PayPal/Bankwire options.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.