Prestashop on delivery select hide/show payment method

☆樱花仙子☆ 提交于 2019-12-11 09:26:17

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/28972366/prestashop-on-delivery-select-hide-show-payment-method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!