Joomla 2.5.14, Virtuemart 2.0.24, PHP 5.4.12 & PHP 5.3.27
I created two payment methods and I put them each to other shopper groups.
Payment 1 - default, anonymous
Payment 2 - gold
When I am not logged in and I have som products in the cart, I choose Payment 1. Then I log in with the user, which is in the gold shoppergroup. But after it I have still choosed Payment 1 method.
If I am trying it with the shipment methods, it works properly.
Remove anonymous from payment one.
Thank you for your answer. Yes, it can be solved with it.
But, it is not logical if shipment method can do that without problems.
I deployed little modified payment plugin to get free payment fees from inserted value.
Customers put products into cart and they choose payment 1. After login they get basic (lower, in my case) fees for anonymous and default. But they must have higher prices from shopper group gold. If they are not logged in and I remove anonymous from payment 1 - We are sorry, no payment method... So I can modify this message to - Please login to get payment method and... But it is still not the right solution.
If I turn on debugging in Joomla, I see SQL queries to get payment methods by currently selected group. I am debugging vmpsplugin.php with XDebug right now, if I will get the answer, I will post it here.
Maybe it must be as it is, maybe not.
Sorry, I am wrong. It works if there are no other payments methods by shopper group, b/c plugin methods will select the right one automatically.
So, problem is, when it is like that:
Payment 1/Shipment 1 - default, anonymous
Payment 2/Shipment 2 - gold
Payment 3/Shipment 3 - default, anonymous
Payment 4/Shipment 4 - gold
When anonymous are shopping and choose Payment 1 and Shipment 1, they will get some fees. But after login they have still Payment 1 and Shipment 1, even if they are in gold shopper group.
I understand, that Virtuemart can't magically know, which payment or shipment must be selected after login with other shopper group rights. So maybe having one method with multiple conditions by shopper groups can handle it better.
You are able to checkout with the wrong payment/shipment?
Yes, I am. But it is not what I want, of course. This is problem I open thread for.
As a temporary solution I am preparing new cart class method to check same name of the methods by the shopping groups, because this is what I need. Customers maybe don't want to log in only for getting shipments & payments fees, if I remove anonymous group. I can do some mods and add link to popup service terms in No shipment/payment method message, where I can have fees, but it is same, if I do something more.
Example:
id 1 Payment/Shipment - anonymous, default
id 2 Payment/Shipment - gold
id 3 Payment 2/Shipment 2 - anonymous, default
id 4 Payment 2/Shipment 2 - gold
Anonymous are shopping, they choose Payment. After that they log in. Method will look which group they belongs to and look for same name. And choose it.
So Anonymous:
Payment - 3.99 € (id 1)
Shipment - 3.29 € (id 1)
After login:
Payment - 4.99 (id 2)
Shipment - 4.29 (id 2)