Skip to content
Snippets Groups Projects
Commit 53fbc9c4 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Version 1.7.0: Add country-specific variables

parent 4acc904c
Branches
Tags V1.7
No related merge requests found
BASE=ordernumber
PLUGINTYPE=vmshopper
VERSION=1.6.2
VERSION=1.7.0
PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
# TRANSDIR=../../../administrator/language/
......
......@@ -62,6 +62,16 @@ class plgVmShopperOrdernumber extends vmShopperPlugin {
}
return self::randomString ($alphabet, $len);
}
/* Extract the country information from the given ID */
static function getCountryFromID ($country_id) {
$db = JFactory::getDBO();
$query = 'SELECT * FROM `#__virtuemart_countries` WHERE `virtuemart_country_id` = ' . (int)$country_id;
$db->setQuery($query);
return $db->loadObject();
}
/* Type 0 means order number, type 1 means invoice number, type 2 means customer number, 3 means order password */
......@@ -98,7 +108,6 @@ class plgVmShopperOrdernumber extends vmShopperPlugin {
}
if ($nrtype==2) {
// Customer number:
print_r($details);
$reps["[username]"] = $details->username;
$reps["[name]"] = $details->name;
$reps["[email]"] = $details->email;
......@@ -109,7 +118,13 @@ class plgVmShopperOrdernumber extends vmShopperPlugin {
$reps["[lastname]"] = $details->last_name;
$reps["[zip]"] = $details->zip;
$reps["[city]"] = $details->city;
$reps["[countryid]"] = $details->virtuemart_country_id;
$country = $this->getCountryFromID ($details->virtuemart_country_id);
$reps["[country]"] = $country->country_name;
$reps["[countrycode2]"] = $country->country_2_code;
$reps["[countrycode3]"] = $country->country_3_code;
$reps["[stateid]"] = $details->virtuemart_state_id;
$reps["[user_is_vendor]"] = $details->user_is_vendor;
}
......
......@@ -7,8 +7,8 @@
<authorUrl>http://www.kainhofer.com/</authorUrl>
<copyright>Copyright (C) 2012-2013 Reinhold Kainhofer. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3</license>
<version>1.6.2</version>
<releaseDate>2013-01-11</releaseDate>
<version>1.7.0</version>
<releaseDate>2013-01-23</releaseDate>
<releaseType>Minor update</releaseType>
<downloadUrl>http://www.kainhofer.com/virtuemart-2-extensions/vm2-ordernumber-plugin.html</downloadUrl>
......
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment