Discount Rules for WooCommerce - Version 1.4.11

Version Description

  • 11/04/17 =
  • Fix Warning in pricing table
Download this release

Release Info

Developer flycart
Plugin Icon 128x128 Discount Rules for WooCommerce
Version 1.4.11
Comparing to
See all releases

Code changes from version 1.4.10 to 1.4.11

includes/pricing-rules-3.php CHANGED
@@ -873,62 +873,64 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
873
  $this->organizeRules();
874
 
875
  $discount_range = array();
876
- foreach ($this->rules as $index => $rule) {
877
- $status = false;
878
-
879
- // Check with Active User Filter.
880
- if (isset($rule->customer)) {
881
  $status = false;
882
- if ($rule->customer == 'all') {
883
- $status = true;
884
- } else {
885
- $users = (is_string($rule->users_to_apply) ? json_decode($rule->users_to_apply, true) : array());
886
- $user_id = get_current_user_id();
887
- if (count(array_intersect($users, array($user_id))) > 0) {
888
  $status = true;
 
 
 
 
 
 
889
  }
890
  }
891
- }
892
-
893
- if ($rule->apply_to == 'specific_products') {
894
 
895
- // Check with Product Filter.
896
- $products_to_apply = json_decode($rule->product_to_apply);
 
 
897
 
898
- if ($rule->product_to_apply == null) $status = true;
899
 
900
- if ($rule->product_to_apply != null) {
901
- $status = false;
902
- if (array_intersect($products_to_apply, array($id)) > 0) {
903
- $status = true;
 
904
  }
905
- }
906
- } elseif ($rule->apply_to == 'specific_category') {
907
 
908
- // Check with Product Category Filter.
909
- $category = woo_dicount_rules_generalHelper::getCategoryByPost($id, true);
910
 
911
- if ($rule->category_to_apply == null) $status = true;
912
 
913
- if ($rule->category_to_apply != null) {
914
- $category_to_apply = json_decode($rule->category_to_apply);
915
- if(isset($rule->apply_child_categories) && $rule->apply_child_categories == 1){
916
- $category_to_apply = $this->getAllSubCategories($category_to_apply);
917
- }
918
- woo_dicount_rules_generalHelper::toInt($category_to_apply);
919
- $status = false;
920
- if (count(array_intersect($category_to_apply, $category)) > 0) {
921
- $status = true;
 
922
  }
923
- }
924
 
925
- } else if ($rule->apply_to == 'all_products') {
926
- $status = true;
927
- }
928
 
929
 
930
- if ($status) {
931
- $discount_range[] = (isset($rule->discount_range) ? json_decode($rule->discount_range) : array());
 
932
  }
933
  }
934
  return $discount_range;
873
  $this->organizeRules();
874
 
875
  $discount_range = array();
876
+ if(is_array($this->rules) && count($this->rules) > 0) {
877
+ foreach ($this->rules as $index => $rule) {
 
 
 
878
  $status = false;
879
+
880
+ // Check with Active User Filter.
881
+ if (isset($rule->customer)) {
882
+ $status = false;
883
+ if ($rule->customer == 'all') {
 
884
  $status = true;
885
+ } else {
886
+ $users = (is_string($rule->users_to_apply) ? json_decode($rule->users_to_apply, true) : array());
887
+ $user_id = get_current_user_id();
888
+ if (count(array_intersect($users, array($user_id))) > 0) {
889
+ $status = true;
890
+ }
891
  }
892
  }
 
 
 
893
 
894
+ if ($rule->apply_to == 'specific_products') {
895
+
896
+ // Check with Product Filter.
897
+ $products_to_apply = json_decode($rule->product_to_apply);
898
 
899
+ if ($rule->product_to_apply == null) $status = true;
900
 
901
+ if ($rule->product_to_apply != null) {
902
+ $status = false;
903
+ if (array_intersect($products_to_apply, array($id)) > 0) {
904
+ $status = true;
905
+ }
906
  }
907
+ } elseif ($rule->apply_to == 'specific_category') {
 
908
 
909
+ // Check with Product Category Filter.
910
+ $category = woo_dicount_rules_generalHelper::getCategoryByPost($id, true);
911
 
912
+ if ($rule->category_to_apply == null) $status = true;
913
 
914
+ if ($rule->category_to_apply != null) {
915
+ $category_to_apply = json_decode($rule->category_to_apply);
916
+ if (isset($rule->apply_child_categories) && $rule->apply_child_categories == 1) {
917
+ $category_to_apply = $this->getAllSubCategories($category_to_apply);
918
+ }
919
+ woo_dicount_rules_generalHelper::toInt($category_to_apply);
920
+ $status = false;
921
+ if (count(array_intersect($category_to_apply, $category)) > 0) {
922
+ $status = true;
923
+ }
924
  }
 
925
 
926
+ } else if ($rule->apply_to == 'all_products') {
927
+ $status = true;
928
+ }
929
 
930
 
931
+ if ($status) {
932
+ $discount_range[] = (isset($rule->discount_range) ? json_decode($rule->discount_range) : array());
933
+ }
934
  }
935
  }
936
  return $discount_range;
includes/pricing-rules.php CHANGED
@@ -873,62 +873,64 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
873
  $this->organizeRules();
874
 
875
  $discount_range = array();
876
- foreach ($this->rules as $index => $rule) {
877
- $status = false;
878
-
879
- // Check with Active User Filter.
880
- if (isset($rule->customer)) {
881
  $status = false;
882
- if ($rule->customer == 'all') {
883
- $status = true;
884
- } else {
885
- $users = (is_string($rule->users_to_apply) ? json_decode($rule->users_to_apply, true) : array());
886
- $user_id = get_current_user_id();
887
- if (count(array_intersect($users, array($user_id))) > 0) {
888
  $status = true;
 
 
 
 
 
 
889
  }
890
  }
891
- }
892
-
893
- if ($rule->apply_to == 'specific_products') {
894
 
895
- // Check with Product Filter.
896
- $products_to_apply = json_decode($rule->product_to_apply);
 
 
897
 
898
- if ($rule->product_to_apply == null) $status = true;
899
 
900
- if ($rule->product_to_apply != null) {
901
- $status = false;
902
- if (array_intersect($products_to_apply, array($id)) > 0) {
903
- $status = true;
 
904
  }
905
- }
906
- } elseif ($rule->apply_to == 'specific_category') {
907
 
908
- // Check with Product Category Filter.
909
- $category = woo_dicount_rules_generalHelper::getCategoryByPost($id, true);
910
 
911
- if ($rule->category_to_apply == null) $status = true;
912
 
913
- if ($rule->category_to_apply != null) {
914
- $category_to_apply = json_decode($rule->category_to_apply);
915
- if(isset($rule->apply_child_categories) && $rule->apply_child_categories == 1){
916
- $category_to_apply = $this->getAllSubCategories($category_to_apply);
917
- }
918
- woo_dicount_rules_generalHelper::toInt($category_to_apply);
919
- $status = false;
920
- if (count(array_intersect($category_to_apply, $category)) > 0) {
921
- $status = true;
 
922
  }
923
- }
924
 
925
- } else if ($rule->apply_to == 'all_products') {
926
- $status = true;
927
- }
928
 
929
 
930
- if ($status) {
931
- $discount_range[] = (isset($rule->discount_range) ? json_decode($rule->discount_range) : array());
 
932
  }
933
  }
934
  return $discount_range;
873
  $this->organizeRules();
874
 
875
  $discount_range = array();
876
+ if(is_array($this->rules) && count($this->rules) > 0){
877
+ foreach ($this->rules as $index => $rule) {
 
 
 
878
  $status = false;
879
+
880
+ // Check with Active User Filter.
881
+ if (isset($rule->customer)) {
882
+ $status = false;
883
+ if ($rule->customer == 'all') {
 
884
  $status = true;
885
+ } else {
886
+ $users = (is_string($rule->users_to_apply) ? json_decode($rule->users_to_apply, true) : array());
887
+ $user_id = get_current_user_id();
888
+ if (count(array_intersect($users, array($user_id))) > 0) {
889
+ $status = true;
890
+ }
891
  }
892
  }
 
 
 
893
 
894
+ if ($rule->apply_to == 'specific_products') {
895
+
896
+ // Check with Product Filter.
897
+ $products_to_apply = json_decode($rule->product_to_apply);
898
 
899
+ if ($rule->product_to_apply == null) $status = true;
900
 
901
+ if ($rule->product_to_apply != null) {
902
+ $status = false;
903
+ if (array_intersect($products_to_apply, array($id)) > 0) {
904
+ $status = true;
905
+ }
906
  }
907
+ } elseif ($rule->apply_to == 'specific_category') {
 
908
 
909
+ // Check with Product Category Filter.
910
+ $category = woo_dicount_rules_generalHelper::getCategoryByPost($id, true);
911
 
912
+ if ($rule->category_to_apply == null) $status = true;
913
 
914
+ if ($rule->category_to_apply != null) {
915
+ $category_to_apply = json_decode($rule->category_to_apply);
916
+ if(isset($rule->apply_child_categories) && $rule->apply_child_categories == 1){
917
+ $category_to_apply = $this->getAllSubCategories($category_to_apply);
918
+ }
919
+ woo_dicount_rules_generalHelper::toInt($category_to_apply);
920
+ $status = false;
921
+ if (count(array_intersect($category_to_apply, $category)) > 0) {
922
+ $status = true;
923
+ }
924
  }
 
925
 
926
+ } else if ($rule->apply_to == 'all_products') {
927
+ $status = true;
928
+ }
929
 
930
 
931
+ if ($status) {
932
+ $discount_range[] = (isset($rule->discount_range) ? json_decode($rule->discount_range) : array());
933
+ }
934
  }
935
  }
936
  return $discount_range;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flycart.org/
4
  Tags: woocommerce, ecommerce, discounts, coupons, promotion, campaigns, sales, price rules, advanced coupons, advanced discounts
5
  Requires at least: 4.4.1
6
  Tested up to: 4.7
7
- Stable tag: 1.4.10
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -110,6 +110,9 @@ More information could be found in the documentation
110
  5. Discounted price is applied in the Cart
111
 
112
  == Changelog ==
 
 
 
113
  = 1.4.10 - 10/04/17 =
114
  * WooCommerce 3.0 compatibility added
115
 
4
  Tags: woocommerce, ecommerce, discounts, coupons, promotion, campaigns, sales, price rules, advanced coupons, advanced discounts
5
  Requires at least: 4.4.1
6
  Tested up to: 4.7
7
+ Stable tag: 1.4.11
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
110
  5. Discounted price is applied in the Cart
111
 
112
  == Changelog ==
113
+ = 1.4.11 - 11/04/17 =
114
+ * Fix – Warning in pricing table
115
+
116
  = 1.4.10 - 10/04/17 =
117
  * WooCommerce 3.0 compatibility added
118
 
woo-discount-rules.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
- * Version: 1.4.10
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Requires at least: 4.6.1
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 1.4.11
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Requires at least: 4.6.1