VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: bobchain on May 13, 2013, 11:29:14 AM

Title: payment method depending from shipping method
Post by: bobchain on May 13, 2013, 11:29:14 AM
Hello everyone,
is there a way to set up methods of payment based on the shipping method chosen?

if not possible directly with virtuemart, you know of a plugin that provides this functionality?


Thanks all for your help.

J: 2.5.8
VM 2.0.20a
Title: Re: payment method depending from shipping method
Post by: rido21 on July 01, 2013, 17:12:01 PM
I have the same question.
Title: Re: payment method depending from shipping method
Post by: illusiondrmr on July 02, 2013, 13:10:52 PM
Hi there,

There have been plenty topics regarding this feature but unfortunately there is nothing like this until now.
I've even posted in the "commercial jobs" section about it, but got no response :
http://forum.virtuemart.net/index.php?topic=115143.msg387872#msg387872

It would be nice if something like this comes up in the next update or even a commercial plugin ..

Title: Re: payment method depending from shipping method
Post by: big2000 on October 29, 2013, 20:33:13 PM
Hello, Right now I'll show how to make this work. I have three shipping methods and two payment methods. When you select shipment_id_1 or shipment_id_3 it will leave only payment_id_1 and when shipment_id_2 is selected only payment_id_2 will stay.
First you will have to make backup of your page.
Next step: Go to index.php of you template and in <head> section put this code (best just above </head>):


<script type="text/javascript">

var now = false;

function show(id, event)
{
hide();
document.getElementById(id).style.display = 'block';
id = now;
}

var tag;

function hide()
{
  if(now)
  {
  document.getElementById(now).style.display = 'none';
  }
}


jQuery(document).ready(function(){


if(localStorage.getItem("odb") == "no") {
   if (localStorage.getItem("click") == "yes") {
     jQuery('#payment_id_1').click()
     localStorage.setItem("click", "no"); 
   }else{
    localStorage.setItem("click", "no"); 
   }
        jQuery("label[for='payment_id_2']").hide()
            jQuery('#payment_id_2').hide()
        jQuery("label[for='payment_id_1']").show()
            jQuery('#payment_id_1').show()
          }else{
           if (localStorage.getItem("click") == "yes") {
     jQuery('#payment_id_2').click()
     localStorage.setItem("click", "no"); 
   }else{
    localStorage.setItem("click", "no"); 
   }
           
           jQuery('#payment_id_2').show()
        jQuery("label[for='payment_id_2']").show()
          jQuery('#payment_id_1').hide()
        jQuery("label[for='payment_id_1']").hide()
          }


  jQuery('#shipment_id_1').click(function(){
localStorage.setItem("click", "yes"); 
   localStorage.setItem("show", "yes");
localStorage.setItem("odb", "no"); 

    });
 
      jQuery('#shipment_id_2').click(function(){
localStorage.setItem("click", "yes"); 
   localStorage.setItem("show", "yes");
localStorage.setItem("odb", "yes"); 

    });
       jQuery('#shipment_id_3').click(function(){
localStorage.setItem("click", "yes"); 
   localStorage.setItem("show", "yes");
localStorage.setItem("odb", "no"); 

    });
 
  });


     
 
</script>


There are some extra lines in code and I will try to add some features in my next post.
I hope it will help. If you have any questions plz mail me on km@viktoria.com.pl
Title: Re: payment method depending from shipping method
Post by: illusiondrmr on November 05, 2013, 14:43:33 PM
Thanks for sharing ! I will give it a try in my next project for sure !