Commit 39585a08 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

V6.0: Public release after the library factorization; Also improve evaluate_for_XXX functions

parent 3fb3ca68
......@@ -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
......
......@@ -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>
......
......@@ -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>
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment