VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: z-analysts on July 02, 2012, 17:13:55 PM

Title: No auto-selection of payment method in 2.0.8 or 2.0.8a?
Post by: z-analysts on July 02, 2012, 17:13:55 PM
I have one payment method and one shipment method. The shipment method IS auto-selected by not the payment method! It used to work in 2.0.6! What changed? How do I fix?

Thank you!
Title: Re: No auto-selection of payment method in 2.0.8 or 2.0.8a?
Post by: carsten888 on July 06, 2012, 10:43:29 AM
Same problem here!  :-\
Title: Re: No auto-selection of payment method in 2.0.8 or 2.0.8a?
Post by: mattcowan on July 08, 2012, 07:02:01 AM
This has something to do with the function CheckAutomaticSelectedPayment in components/com_virtuemart/helpers/cart.php...it seems that $virtuemart_paymentmethod_id has not been set somewhere and instead of returning true, the function is returning false.

This is not the right way to do it, but for a temporary solution you can set the function to return true and hard code the payment id inside the function like so.:


//...
} else {
$this->virtuemart_paymentmethod_id = 1; //or whatever your paymentmethod_id is...
$this->automaticSelectedPayment=true;
$this->setCartIntoSession();
return true;
}
} else {
return false;
}//...


Still looking for where this is originally going wrong myself.
Title: Re: No auto-selection of payment method in 2.0.8 or 2.0.8a?
Post by: carsten888 on July 08, 2012, 08:59:10 AM
Thank you very much. That makes it work for now. :D

I was struggling a bit as to which code to change to what, so here is for others:

VM 2.0.8c
components/com_virtuemart/helpers/cart.php
line: 1135

$this->automaticSelectedPayment=false;
$this->setCartIntoSession();
return false;

change to
$this->virtuemart_paymentmethod_id = 1;//payment id as in VM admin page > shop > payment methods (column 'id').
$this->automaticSelectedPayment=true;
$this->setCartIntoSession();
return true;


I'm still puzzeled as to why on my localhost (with a copy of the online database) the autoselection works fine without this hack ???
Title: Re: No auto-selection of payment method in 2.0.8 or 2.0.8a?
Post by: Milbo on July 08, 2012, 22:48:59 PM
There exists already some threads about this and it is a lot easier just to disable the klarna plugin. and or use version c
Title: Re: No auto-selection of payment method in 2.0.8 or 2.0.8a?
Post by: alatak on July 09, 2012, 13:52:47 PM
Hello,

You have to disabled the klarna plugin via the Joomla plugin manager.
Installing the c version will not help, because the installer is not removing or disabling an already installed plugin.