diff --git a/Makefile b/Makefile index d221014ad8a3cdefc25665c323fc8c0d63c8d77a..ce9467b069d0e69fe1be4ec23bb07de9551ef2dd 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ BASE=rules_shipping BASE_ADV=rules_shipping_advanced PLUGINTYPE=vmshipment ZIPBASE=opentools_vm2 -VERSION=4.1 +VERSION=4.2 PLUGINFILES=$(BASE).php $(BASE)_base.php $(BASE).script.php $(BASE).xml index.html PLUGINFILES_ADV=$(BASE_ADV).php $(BASE)_base.php $(BASE_ADV).script.php $(BASE_ADV).xml index.html diff --git a/releases/plg_opentools_vm2_rules_shipping_advanced_v4.2.zip b/releases/plg_opentools_vm2_rules_shipping_advanced_v4.2.zip new file mode 100644 index 0000000000000000000000000000000000000000..6e13499b88e8857efaa98c2d304095db2c33a278 Binary files /dev/null and b/releases/plg_opentools_vm2_rules_shipping_advanced_v4.2.zip differ diff --git a/releases/plg_opentools_vm2_rules_shipping_v4.2.zip b/releases/plg_opentools_vm2_rules_shipping_v4.2.zip new file mode 100644 index 0000000000000000000000000000000000000000..c18449590655273da5b794a561d1e480f6c1f791 Binary files /dev/null and b/releases/plg_opentools_vm2_rules_shipping_v4.2.zip differ diff --git a/rules_shipping.xml b/rules_shipping.xml index f283adf5339962a78217cce323d19f00a5a79445..9f534a97a35c6cc1c689445e1425ca72ee96ca00 100644 --- a/rules_shipping.xml +++ b/rules_shipping.xml @@ -6,7 +6,7 @@ <authorUrl>http://www.open-tools.net</authorUrl> <copyright>Copyright (C) 2013-2014, Reinhold Kainhofer</copyright> <license>GPL v3+</license> - <version>4.1</version> + <version>4.2</version> <description>VMSHIPMENT_RULES_DESC</description> <files> <filename plugin="rules_shipping">rules_shipping.php</filename> diff --git a/rules_shipping_advanced.xml b/rules_shipping_advanced.xml index a724f15ba7240d798d06407fe12d32f6ebb5a5ef..8a4a1f202146895bf9fe23ecff04561b050cf1b1 100644 --- a/rules_shipping_advanced.xml +++ b/rules_shipping_advanced.xml @@ -6,7 +6,7 @@ <authorUrl>http://www.open-tools.net</authorUrl> <copyright>Copyright (C) 2013-2014, Reinhold Kainhofer</copyright> <license>GPL v3+</license> - <version>4.1</version> + <version>4.2</version> <description>VMSHIPMENT_RULES_ADV_DESC</description> <files> <filename plugin="rules_shipping_advanced">rules_shipping_advanced.php</filename> diff --git a/rules_shipping_base.php b/rules_shipping_base.php index c67b044f44538a03fe302efef64e759af3c39226..d750f72b882bf67bacaa006a0d9d8990a479be90 100644 --- a/rules_shipping_base.php +++ b/rules_shipping_base.php @@ -558,8 +558,13 @@ class plgVmShipmentRules_Shipping_Base extends vmPSPlugin { $countriesModel = VmModel::getModel('country'); if (isset($address['virtuemart_country_id'])) { $data['countryid'] = $address['virtuemart_country_id']; + // The following is a workaround to make sure the cache is invalidated + // because if some other extension meanwhile called $countriesModel->getCountries, + // the cache will be modified, but the model's id will not be changes, so the + // getData call will return the wrong cache. + $countriesModel->setId(0); $countriesModel->setId($address['virtuemart_country_id']); - $country = $countriesModel->getData(); + $country = $countriesModel->getData($address['virtuemart_country_id']); if (!empty($country)) { $data['country'] = $country->country_name; $data['country2'] = $country->country_2_code; @@ -570,8 +575,13 @@ class plgVmShipmentRules_Shipping_Base extends vmPSPlugin { $statesModel = VmModel::getModel('state'); if (isset($address['virtuemart_state_id'])) { $data['stateid'] = $address['virtuemart_state_id']; + // The following is a workaround to make sure the cache is invalidated + // because if some other extension meanwhile called $countriesModel->getCountries, + // the cache will be modified, but the model's id will not be changes, so the + // getData call will return the wrong cache. + $statesModel->setId(0); $statesModel->setId($address['virtuemart_state_id']); - $state = $statesModel->getData(); + $state = $statesModel->getData($address['virtuemart_state_id']); if (!empty($state)) { $data['state'] = $state->state_name; $data['state2'] = $state->state_2_code;