Discount Rules for WooCommerce - Version 1.7.11

Version Description

  • 13/02/19 =
  • Fix - Discount table not showing data
Download this release

Release Info

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

Code changes from version 1.7.10 to 1.7.11

helper/general-helper.php CHANGED
@@ -825,5 +825,16 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
825
  }
826
  }
827
  }
 
 
 
 
 
 
 
 
 
 
 
828
  }
829
  }
825
  }
826
  }
827
  }
828
+
829
+ /**
830
+ * Is countable object or array
831
+ * */
832
+ public static function is_countable($data){
833
+ if((is_array($data) || is_object($data))){
834
+ if(is_object($data)) $data = (array)$data;
835
+ if(count($data)) return true;
836
+ }
837
+ return false;
838
+ }
839
  }
840
  }
includes/cart-rules.php CHANGED
@@ -1722,7 +1722,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1722
  $discounted_products = (isset($rule_set->cart_discounted_products)) ? $rule_set->cart_discounted_products : '[]';
1723
  $products = json_decode($discounted_products);
1724
  $rule_discount_quantity = (isset($rule_set->product_discount_quantity)) ? $rule_set->product_discount_quantity : 0;
1725
- if(is_array($products) && count($products)){
1726
  foreach ($products as $discounted_product_id) {
1727
  if(array_key_exists($discounted_product_id,$cart))
1728
  {
1722
  $discounted_products = (isset($rule_set->cart_discounted_products)) ? $rule_set->cart_discounted_products : '[]';
1723
  $products = json_decode($discounted_products);
1724
  $rule_discount_quantity = (isset($rule_set->product_discount_quantity)) ? $rule_set->product_discount_quantity : 0;
1725
+ if(FlycartWooDiscountRulesGeneralHelper::is_countable($products)){
1726
  foreach ($products as $discounted_product_id) {
1727
  if(array_key_exists($discounted_product_id,$cart))
1728
  {
includes/pricing-rules.php CHANGED
@@ -1645,7 +1645,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1645
  public function getAdjustmentAmount($item, $quantity, $discount_ranges, $product_page, $bogo, $product_to_exclude = array())
1646
  {
1647
  $adjustment = array();
1648
- if(is_array($discount_ranges) && count($discount_ranges)){
1649
  foreach($discount_ranges as $discount_range) {
1650
  if (!is_array($discount_range) && !is_object($discount_range)) return false;
1651
  $range = is_array($discount_range) ? (object) $discount_range : $discount_range;
@@ -2744,7 +2744,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2744
  $table = $table_data;
2745
  if(is_array($table) && count($table)){
2746
  foreach ($table as $index => $item) {
2747
- if(is_array($item) && count($item)){
2748
  foreach ($item as $id => $value) {
2749
  if(isset($value->rule_method) && $value->rule_method == 'product_based'){
2750
  $title = $value->title;
1645
  public function getAdjustmentAmount($item, $quantity, $discount_ranges, $product_page, $bogo, $product_to_exclude = array())
1646
  {
1647
  $adjustment = array();
1648
+ if(FlycartWooDiscountRulesGeneralHelper::is_countable($discount_ranges)){
1649
  foreach($discount_ranges as $discount_range) {
1650
  if (!is_array($discount_range) && !is_object($discount_range)) return false;
1651
  $range = is_array($discount_range) ? (object) $discount_range : $discount_range;
2744
  $table = $table_data;
2745
  if(is_array($table) && count($table)){
2746
  foreach ($table as $index => $item) {
2747
+ if(FlycartWooDiscountRulesGeneralHelper::is_countable($item)){
2748
  foreach ($item as $id => $value) {
2749
  if(isset($value->rule_method) && $value->rule_method == 'product_based'){
2750
  $title = $value->title;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flycart.org/
4
  Tags: woocommerce, discounts, dynamic pricing, Buy One Get One Free, pricing deals, price rules, bulk discounts, advanced discounts, pricing deals
5
  Requires at least: 4.4.1
6
  Tested up to: 5.0
7
- Stable tag: 1.7.10
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -312,6 +312,9 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
312
 
313
  == Changelog ==
314
 
 
 
 
315
  = 1.7.10 - 13/02/19 =
316
  * Fix - Warning: Invalid argument supplied for foreach()
317
 
4
  Tags: woocommerce, discounts, dynamic pricing, Buy One Get One Free, pricing deals, price rules, bulk discounts, advanced discounts, pricing deals
5
  Requires at least: 4.4.1
6
  Tested up to: 5.0
7
+ Stable tag: 1.7.11
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
312
 
313
  == Changelog ==
314
 
315
+ = 1.7.11 - 13/02/19 =
316
+ * Fix - Discount table not showing data
317
+
318
  = 1.7.10 - 13/02/19 =
319
  * Fix - Warning: Invalid argument supplied for foreach()
320
 
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.7.10
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 1.7.11
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/