Hi,
I have 2 Payment Methods - 1 for country India (PayA) and another for other countries (PayB)
and same way I have 2 Shipment Methods - 1 for country India (ShipA) and another for other countries (ShipB).
If the Bill To Address is for country India, the PayA and ShipA methods are selected.
However, if the user selects the Ship To address as something which is of country other than India, say UK. Both Payment Method and Shipment method selected are PayB and ShipB respectively.
In fact, the Payment method should have been based on Bill To address i.e. PayA and Shipment method based on Ship To address i.e. ShipB.
Can you advise where does the code is for selecting the payment/shipment methods.
Using VM 2.0.26d, tried in Vm 2.6 as well.
Anther issue:
Once user has different Bill To and Ship To address, when he decides to switch to same Bill/Ship To using Use for the shipto same as billto address checkbox, the Payment and Shipment methods are not refreshed. Not sure if this is a bug.
Thanks.
Any help or suggestion on this will be highly appreciated.
QuoteCan you advise where does the code is for selecting the payment/shipment methods.
in each method - function checkConditions()
normally something like
$countries = $method->countries;
$address = (($cart->ST == 0) ? $cart->BT : $cart->ST);
********************
if (in_array ($address['virtuemart_country_id'], $countries) || count ($countries) == 0) {
//this is a valid method
QuoteOnce user has different Bill To and Ship To address, when he decides to switch to same Bill/Ship To using Use for the shipto same as billto address checkbox, the Payment and Shipment methods are not refreshed. Not sure if this is a bug.
not a bug - the chk box does nothing except hide the ship to by JS and set a flag
the logic should then be done in the ship/payment method when checking out although I notice a few ship plugins don't even test the $cart->STsameAsBT
I always use in my plugins
if($cart->STsameAsBT == 0){
$address = (($cart->ST == 0 ) ? $cart->BT : $cart->ST);
}else{
$address = $cart->BT;
}
Thanks for the clue!
Quotein each method - function checkConditions()
normally something like
$countries = $method->countries;
$address = (($cart->ST == 0) ? $cart->BT : $cart->ST);
In the payment modules, I modified
$address = (($cart->ST == 0) ? $cart->BT : $cart->ST);
to
$address = $cart->BT ;
so that always the Payment method is based on Bill To address.
Can we do this with Override files, so that when the VM versions are upgraded, we don't have to hack the core files again?
Quotenot a bug - the chk box does nothing except hide the ship to by JS and set a flag
the logic should then be done in the ship/payment method when checking out although I notice a few ship plugins don't even test the $cart->STsameAsBT
I always use in my plugins
Code:
if($cart->STsameAsBT == 0){
$address = (($cart->ST == 0 ) ? $cart->BT : $cart->ST);
}else{
$address = $cart->BT;
}
I'm not using any 3rd party plugins, just using VM Shipment - weight_countries. Even in standard plugin I could not find the check for ST same as BT.
Can you give a hint where to add the below code:
if($cart->STsameAsBT == 0){
$address = (($cart->ST == 0 ) ? $cart->BT : $cart->ST);
}else{
$address = $cart->BT;
}
QuoteCan we do this with Override files, so that when the VM versions are upgraded, we don't have to hack the core files again?
what I would do is just clone the weight plugin - call it something else so it installs as a different plug - then won't get over written
QuoteI'm not using any 3rd party plugins, just using VM Shipment - weight_countries. Even in standard plugin I could not find the check for ST same as BT.
replace line 212
$address = (($cart->ST == 0) ? $cart->BT : $cart->ST);
In plugins/vmshipment/weight_countries/weight_countries.php, I replaced line 212
$address = (($cart->ST == 0) ? $cart->BT : $cart->ST);
with
if($cart->STsameAsBT == 0){
$address = (($cart->ST == 0 ) ? $cart->BT : $cart->ST);
}else{
$address = $cart->BT;
}
But still, the Shipment Method is not changed/refreshed when the user selects "Use for the shipto same as billto address" checkbox.
and it never will!!!!
Quotenot a bug - the chk box does nothing except hide the ship to by JS and set a flag
the dirty work is done once you confirm