diff --git a/Makefile b/Makefile index 3289f16e67a595aa8e4db50ee4a3f2cc61094b06..d3689e3e2f5154eb7dcc41c9724cd04afd0105ec 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ BASE=rules_shipping BASE_ADV=rules_shipping_advanced PLUGINTYPE=vmshipment ZIPBASE=opentools_vm -VERSION=5.99.1 +VERSION=6.0 PLUGINFILES=$(BASE).php $(BASE)_base.php $(BASE)_framework_joomla.php $(BASE).script.php $(BASE).xml index.html PLUGINFILES_ADV=$(BASE_ADV).php $(BASE)_base.php $(BASE)_framework_joomla.php $(BASE_ADV).script.php $(BASE_ADV).xml index.html diff --git a/releases/plg_opentools_vm_rules_shipping_advanced_v6.0.zip b/releases/plg_opentools_vm_rules_shipping_advanced_v6.0.zip new file mode 100644 index 0000000000000000000000000000000000000000..98503790b105d0bec835ee1f6fdd175a643ffe9f Binary files /dev/null and b/releases/plg_opentools_vm_rules_shipping_advanced_v6.0.zip differ diff --git a/releases/plg_opentools_vm_rules_shipping_v6.0.zip b/releases/plg_opentools_vm_rules_shipping_v6.0.zip new file mode 100644 index 0000000000000000000000000000000000000000..4d1cef3aa98d75e97e3b3f9945e3c1f5f790f146 Binary files /dev/null and b/releases/plg_opentools_vm_rules_shipping_v6.0.zip differ diff --git a/rules_shipping.xml b/rules_shipping.xml index 7711e204a53699cf060c3dc463707281816dc055..9db2d2c5bd6348686c53ac8becb422415c9a19b1 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>5.99.1</version> + <version>6.0</version> <description>OTSHIPMENT_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 188815a03863d9af945f5f7c2a9755d0260ef3d6..e39e5d72ce70c9e0f348188782c7f5985851b76e 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>5.99.1</version> + <version>6.0</version> <description>OTSHIPMENT_RULES_ADV_DESC</description> <files> <filename plugin="rules_shipping_advanced">rules_shipping_advanced.php</filename> diff --git a/rules_shipping_framework_joomla.php b/rules_shipping_framework_joomla.php index 3792c516e0124bf1bcdd7f48141d21fecad955f8..6862d3b8e131a77e89f183d3cec236f10886f4ba 100644 --- a/rules_shipping_framework_joomla.php +++ b/rules_shipping_framework_joomla.php @@ -17,6 +17,17 @@ if (!class_exists( 'RulesShippingFramework' )) // $test=new asdfasdsf(); class RulesShippingFrameworkJoomla extends RulesShippingFramework { + /* Constructor: Register the available scopings */ + function _construct() { + parent::_construct(); + $this->registerScopings(array( + "categories" => 'categories', + "products" => 'products', + "skus" => 'products', + "vendors" => 'vendors', + "manufacturers" => 'manufacturers', + )); + } function getCustomFunctions() { // Let other plugins add custom functions! // The onVmShippingRulesRegisterCustomFunctions() trigger is expected to return an array of the form: @@ -327,14 +338,14 @@ class RulesShippingFrameworkJoomla extends RulesShippingFramework { /** Filter the given array of products and return only those that belong to the categories, manufacturers, * vendors or products given in the $filter_conditions. The $filter_conditions is an array of the form: - * array( 'skus'=>array(....), 'categories'=>array(1,2,3,42), 'manufacturers'=>array(77,78,83), 'vendors'=>array(1,2)) + * array( 'products'=>array(....), 'categories'=>array(1,2,3,42), 'manufacturers'=>array(77,78,83), 'vendors'=>array(1,2)) * Notice that giving an empty array for any of the keys means "no restriction" and is exactly the same * as leaving out the entry altogether */ public function filterProducts($products, $filter_conditions) { $result = array(); foreach ($products as $p) { - if (!empty($filter_conditions['skus']) && !in_array($p->product_sku, $filter_conditions['skus'])) + if (!empty($filter_conditions['products']) && !in_array($p->product_sku, $filter_conditions['products'])) continue; if (!empty($filter_conditions['categories']) && count(array_intersect($filter_conditions['categories'], $p->categories))==0) continue;