Hello,
I am using VirtueMart 3.0.12 and Joomla! 3.4.5 .
I can see that i have 3 digit State codes[State (3) Code] already there in Configuration -> Countries -> Australia [States] -> States.
Currently, i am using paypal sandbox to test payments. When i tried to place an order, and i got redirected to Paypal.
And Instead of NSW, i can see NS as state code.
I tried searching in shop configuration to change state code from 2 digit to 3 digit, but i cannot find any configuration in shop to change it.
Please help me with this so that, i can use 3 digit state code [State (3) Code]. Attached along a screenshot of Paypal payment page where it shows 2 digit state code instead of 3 digit.
Thank you in advance.
in plugins\vmpayment\paypal\paypal\helpers\paypalstd.php try changing
$post_variables['state'] = isset($address->virtuemart_state_id) ? ShopFunctions::getStateByID($address->virtuemart_state_id, 'state_2_code') : '';
to
$post_variables['state'] = isset($address->virtuemart_state_id) ? ShopFunctions::getStateByID($address->virtuemart_state_id, 'state_3_code') : '';
GJC Web Design, thank you very much for getting back to me.
I tried applying the change you suggested. But instead of showing NSW (New South Wales), it is now showing "AC" . It was "NS" before.
don't see how
it is a very simple func
$fld Field to return: state_name (default), state_2_code or state_3_code.
static public function getStateByID ($id, $fld = 'state_name') {
if (empty($id)) {
return '';
}
$db = JFactory::getDBO ();
$q = 'SELECT ' . $db->escape ($fld) . ' AS fld FROM `#__virtuemart_states` WHERE virtuemart_state_id = "' . (int)$id . '"';
$db->setQuery ($q);
$r = $db->loadObject ();
return $r->fld;
}
We found ourselves for Australian addresses, we need to pass the full state name to PayPal, not the state code. Found this by googling in the past but can't seem to find the reference to it now.
This is what we use and seems to work last time I checked a couple months ago, haven't checked it recently though.
Quote$post_variables['state'] = isset($address->virtuemart_state_id) ? ShopFunctions::getStateByID($address->virtuemart_state_id, 'state_name') : '';