News:

Support the VirtueMart project and become a member

Main Menu

Dependent payment method on shipping address

Started by concap, April 03, 2013, 06:30:26 AM

Previous topic - Next topic

concap

We have one VM payment method eway, which is working fine.

But would like to give customers option to checkout even without valid shipping method(mostly for items which are very heavy). This order would come up with Pending state and Customers shouldn't be able to confirm order(they should not be provided with screen where you put your credit card)

This would enable us to come back to customer with quote for heavy items.

Basically what I am asking is how to assign payment method to specific shipping method

Regards Ondrej VM 2.0.20b


concap

Solution is in \components\com_virtuemart\helpers\cart.php
I've simply hardcoded particular shipping method according total weight condition.



if (VmConfig::get('automatic_payment',1) && $checkAutomaticSelected ) {
$dispatcher = JDispatcher::getInstance();
$paymentCounter=0;
$returnValues = $dispatcher->trigger('plgVmOnCheckAutomaticSelectedPayment', array( $this, $cart_prices, &$paymentCounter));
foreach ($returnValues as $returnValue) {
  if ( isset($returnValue )) {
$nbPayment++;
    if($returnValue) $virtuemart_paymentmethod_id = $returnValue;
     }
    }
if ($nbPayment==1 && $virtuemart_paymentmethod_id) {
$this->virtuemart_paymentmethod_id = $virtuemart_paymentmethod_id;
$this->automaticSelectedPayment=true;
$this->setCartIntoSession();
return true;
} elseif($total_weight >= 10){
                                //Set payment method to FREE QUOTE
                                $this->virtuemart_paymentmethod_id = 6;
$this->automaticSelectedPayment=true;
$this->setCartIntoSession();
return true;
                        } elseif($total_weight < 10){
                                //Set payment method to Eway gateway
                                $this->virtuemart_paymentmethod_id = 1;
$this->automaticSelectedPayment=true;
$this->setCartIntoSession();
return true;
                        } else {
$this->automaticSelectedPayment=false;
$this->setCartIntoSession();
return false;
}
} else {
return false;
}

illusiondrmr

Is there any1 who could help us on how to make the payment method dependable on shipping method?

For example, inside the section of the payment method you have only 1 option : Shopper Group
It would be great if we had a box right under it like : Shipping Method IDs : ___ (and there you could enter 1,3,5).

Im willing to pay for a plugin like this, i will post this to the commercial jobs subforum as well..

concap

This would be really handy, cannot help you though