diff --git a/Makefile b/Makefile index ca3d1492d6257f9215f5b721df40dc7dc3b697c0..14371bb5541e41dddbe02939dde81a713aa69029 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ BASE=rules_shipping BASE_ADV=rules_shipping_advanced PLUGINTYPE=vmshipment ZIPBASE=opentools_vm2 -VERSION=3.1 +VERSION=3.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/language/en-GB/en-GB.plg_vmshipment_rules_shipping.ini b/language/en-GB/en-GB.plg_vmshipment_rules_shipping.ini index e54ce7f9370b831828cbdcbb371a9805e2af6f61..91c1d037f9633b630de1daa761f4ce1ebcf78486 100644 --- a/language/en-GB/en-GB.plg_vmshipment_rules_shipping.ini +++ b/language/en-GB/en-GB.plg_vmshipment_rules_shipping.ini @@ -13,6 +13,10 @@ VMSHIPMENT_RULES_PLUGIN_ADV="<b>Shipment based on general rules (weight, product VMSHIPMENT_RULES_HELP="<div style='background: #DDDDDD; padding:5px; margin:3px;'><h2>Overview of the Rules Syntax</h2><ul><li>Each line contains one rule consisting of several <b>conditions and assignments in arbitrary order and separated by semicolons</b>. </li><li>The <b>first matching rule is used</b> to calculate the shipping costs. If its shipping cost is set to <tt>NoShipping</tt>, then this method will not offer any shipping at all.</li><li>All rule parts with <b>comparison operators (<, <=, =<, ==, !=, <>, >=, =>, >)</b> are conditions.</li><li> Supported <b>variables (case-insensitive)</b>: <b><tt>Amount</tt></b>, <b><tt>Weight</tt></b>, <b><tt>ZIP</tt></b>, <b><tt>Products</tt></b> (number of different products), <b><tt>Articles</tt></b> (counted with quantity), <b><tt>Volume</tt></b> (total volume of the order) and <b><tt>MinVolume</tt>, <tt>MinLength</tt>, <tt>MinWidth</tt>, <tt>MinHeight</tt></b> as well as the same variables with <tt>Max</tt> instead of <tt>Min</tt>.</li><li>A condition can consist of multiple chained comparisons.</li><li>All rule parts of the form <b><tt>[VARIABLE]=VALUE</tt> are assignments</b>, with <tt>[VARIABLE]</tt> being one of <b><tt>Name</tt></b> (optional name of the rule, displayed in the cart and invoice), <b><tt>Shipping</tt></b> (shipping cost without tax if the rule matches) and <b><tt>ShippingWithTax</tt></b> (shipping cost including taxes if the rule matches). The <tt>Shipping=</tt> can be left out (<tt>ShippingWithTax=</tt> can not be left out). I.e. a rule part consisting only of a numerical value is understood as net shipping cost without tax.</li></ul><p>EXAMPLE: A rule named "Europe" that sets shipping costs of 4.50 for order amounts from 50 to less than 100, and free shipping from 100€ on would be:</p><blockquote><tt>Name=Europe; 50<=Amount<100; Shipping=4.50<br>Name=Free Shipping; 100<= Amount; 0</tt></blockquote>><p>See also the the <a href='http://www.kainhofer.com/component/content/article/22-virtuemart-2-extensions/45-vm2-shipping-by-rules.html'>Plugin's documentation</a> and <a href='http://www.kainhofer.com/component/content/article.html?id=46'>Rules Examples</a>.</p></div>" VMSHIPMENT_RULES_HELP_ADV="<div style='background: #DDDDDD; padding: 5px; margin: 3px;'><h2>Overview of the Rules Syntax</h2><ul><li>Each line contains one rule consisting of several <strong>conditions and assignments in arbitrary order and separated by semicolons</strong>.</li><li>The <strong>first matching rule is used</strong> to calculate the shipping costs. If its shipping cost is set to <tt>NoShipping</tt>, then this method will not offer any shipping at all.</li><li>All rule parts with <strong>comparison operators (<, <=, =<, ==, !=, <>, >=, =>, >)</strong> are conditions.</li><li>Supported <strong>variables (case-insensitive)</strong>: <strong><tt>Amount</tt></strong>, <strong><tt>Weight</tt></strong>, <strong><tt>ZIP</tt></strong>, <strong><tt>Products</tt></strong> (number of different products), <strong><tt>Articles</tt></strong> (counted with quantity), <strong><tt>Volume</tt></strong> (total volume of the order) and <strong><tt>MinVolume</tt>, <tt>MinLength</tt>, <tt>MinWidth</tt>, <tt>MinHeight</tt></strong> as well as the same variables with <tt>Max</tt> instead of <tt>Min</tt>.</li><li>A condition can consist of multiple chained comparisons. In the advanced version, the OR operator is available.</li><li>All rule parts of the form <strong><tt>[VARIABLE]=VALUE</tt> are assignments</strong>; allowed variables are <strong><tt>Name</tt></strong> (of the rule), <strong><tt>Shipping</tt></strong> and <strong><tt>ShippingWithTax</tt></strong>. The '<tt>Shipping='</tt> can be left out.</li><li>In the advanced version, all expressions may contain <strong>arbitrary basic arithmetic expressions (+, -, *, /, %, ^ and parentheses)</strong> of the above variables and functions like max(..), min(..), round(..), ceil(..), floor(..), day(), month(), etc..</li><li><strong>Alphanumeric postal codes</strong> are supported by the variables <tt>UK_Outward, UK_Area, UK_District, UK_Subdistrict, Canada_FSA, Canada_Area, Canada_Urban, Canada_Subarea, ZIP1, ZIP2, ZIP3, ZIP4, ZIP5</tt> and <tt>ZIP6</tt> in the advanced version.</li></ul><p>EXAMPLE: A rule named 'Europe' that sets shipping costs of 5€ plus 1.50€ per article for order amounts from 50 to less than 100, and free shipping from 100€ on would be:</p><blockquote><tt>Name=Europe; 50<=Amount<100; Shipping=5+1.50*Articles<br />Name=Free Shipping; 100<= Amount; 0</tt></blockquote><p>See also the the <a href='http://www.kainhofer.com/component/content/article/22-virtuemart-2-extensions/45-vm2-shipping-by-rules.html'>Plugin's documentation</a> and <a href='http://www.kainhofer.com/component/content/article.html?id=46'>Rules Examples</a>.</p></div>" +VMSHIPMENT_RULES_LOGOS="Logo" +VMSHIPMENT_RULES_LOGOS_DESC="Select the logo that is displayed to the user for this shipping method." +VMSHIPMENT_RULES_WEIGHT_UNIT="Weight Unit" +VMSHIPMENT_RULES_WEIGHT_UNIT_DESC="The Weight Unit in which the Weight is given" VMSHIPMENT_RULES_LENGTH_UNIT="Length Unit" VMSHIPMENT_RULES_LENGTH_UNIT_DESC="The length unit, in which the length, width and heights are given, and from which the volume is calculated." diff --git a/releases/plg_opentools_vm2_rules_shipping_advanced_v3.2.zip b/releases/plg_opentools_vm2_rules_shipping_advanced_v3.2.zip new file mode 100644 index 0000000000000000000000000000000000000000..7cd03f76fabbd374e85019ba3acf0cc737921aca Binary files /dev/null and b/releases/plg_opentools_vm2_rules_shipping_advanced_v3.2.zip differ diff --git a/releases/plg_opentools_vm2_rules_shipping_v3.2.zip b/releases/plg_opentools_vm2_rules_shipping_v3.2.zip new file mode 100644 index 0000000000000000000000000000000000000000..1f3d5ccb513f802c8fe38f153e5a252508a5de54 Binary files /dev/null and b/releases/plg_opentools_vm2_rules_shipping_v3.2.zip differ diff --git a/rules_shipping.xml b/rules_shipping.xml index ef943d57c93b8fb22bb458e2ffc14cea42985c71..2c97179728e4f0243e43536d89176d8f17974552 100644 --- a/rules_shipping.xml +++ b/rules_shipping.xml @@ -6,7 +6,7 @@ <authorUrl>http://www.open-tools.net</authorUrl> <copyright>Copyright (C) 2013, Reinhold Kainhofer</copyright> <license>GPL v3+</license> - <version>3.1</version> + <version>3.2</version> <description>VMSHIPMENT_RULES_DESC</description> <files> <filename plugin="rules_shipping">rules_shipping.php</filename> @@ -29,12 +29,12 @@ <params> <param type="vmjpluginwarning" /> <param type="spacer" default='VMSHIPMENT_RULES_PLUGIN' level="level1" /> - <param name="shipment_logos" type="vmfiles" label="VMSHIPMENT_WEIGHT_COUNTRIES_LOGOS" - description="VMSHIPMENT_WEIGHT_COUNTRIES_LOGOS_DESC" + <param name="shipment_logos" type="vmfiles" label="VMSHIPMENT_RULES_LOGOS" + description="VMSHIPMENT_RULES_LOGOS_DESC" directory="/images/stories/virtuemart/shipment" default="default" hide_default="1" hide_none="1" stripext="0" exclude="^_" /> - <param name="weight_unit" type="vmweightunit" size="10" default="" label="VMSHIPMENT_WEIGHT_COUNTRIES_WEIGHT_UNIT" description="VMSHIPMENT_WEIGHT_COUNTRIES_WEIGHT_UNIT_DESC"/> + <param name="weight_unit" type="vmweightunit" size="10" default="" label="VMSHIPMENT_RULES_WEIGHT_UNIT" description="VMSHIPMENT_RULES_WEIGHT_UNIT_DESC"/> <param name="length_unit" type="vmlengthunit" size="10" default="" label="VMSHIPMENT_RULES_LENGTH_UNIT" description="VMSHIPMENT_RULES_LENGTH_UNIT_DESC"/> <param type="rklabel" default='VMSHIPMENT_RULES_HELP' /> diff --git a/rules_shipping_advanced.xml b/rules_shipping_advanced.xml index 283c55cc0c34fe28789494bd9e8e76c2475a6bf9..3357816f68009765db3c8123db51244a11261fce 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, Reinhold Kainhofer</copyright> <license>GPL v3+</license> - <version>3.0.2</version> + <version>3.2</version> <description>VMSHIPMENT_RULES_ADV_DESC</description> <files> <filename plugin="rules_shipping_advanced">rules_shipping_advanced.php</filename> @@ -28,12 +28,12 @@ <params> <param type="vmjpluginwarning" /> <param type="rklabel" default='VMSHIPMENT_RULES_PLUGIN_ADV' level="level1" /> - <param name="shipment_logos" type="vmfiles" label="VMSHIPMENT_WEIGHT_COUNTRIES_LOGOS" - description="VMSHIPMENT_WEIGHT_COUNTRIES_LOGOS_DESC" + <param name="shipment_logos" type="vmfiles" label="VMSHIPMENT_RULES_LOGOS" + description="VMSHIPMENT_RULES_LOGOS_DESC" directory="/images/stories/virtuemart/shipment" default="default" hide_default="1" hide_none="1" stripext="0" exclude="^_" /> - <param name="weight_unit" type="vmweightunit" size="10" default="" label="VMSHIPMENT_WEIGHT_COUNTRIES_WEIGHT_UNIT" description="VMSHIPMENT_WEIGHT_COUNTRIES_WEIGHT_UNIT_DESC"/> + <param name="weight_unit" type="vmweightunit" size="10" default="" label="VMSHIPMENT_RULES_WEIGHT_UNIT" description="VMSHIPMENT_RULES_WEIGHT_UNIT_DESC"/> <param name="length_unit" type="vmlengthunit" size="10" default="" label="VMSHIPMENT_RULES_LENGTH_UNIT" description="VMSHIPMENT_RULES_LENGTH_UNIT_DESC"/> <param type="rklabel" default='VMSHIPMENT_RULES_HELP_ADV' /> diff --git a/rules_shipping_base.php b/rules_shipping_base.php index 6856ab05ac2581cc01cdfb084031cf72f7d0873a..57fb8482320379ebdcefafc5e4c431712f7b0038 100644 --- a/rules_shipping_base.php +++ b/rules_shipping_base.php @@ -440,7 +440,7 @@ class plgVmShipmentRules_Shipping_Base extends vmPSPlugin { } $statesModel = VmModel::getModel('state'); - if (isset($address['virtuemart_country_id'])) { + if (isset($address['virtuemart_state_id'])) { $statesModel->setId($address['virtuemart_state_id']); $state = $statesModel->getData(); $data['stateid'] = $state->virtuemart_state_id; @@ -874,7 +874,7 @@ class ShippingRule { function matches($vals) { // First, check the country, if any conditions are given: - if (count ($this->countries) > 0 && !in_array ($vals['country'], $this->countries)) + if (count ($this->countries) > 0 && !in_array ($vals['countryid'], $this->countries)) return False; foreach ($this->conditions as $c) {