Discount Rules for WooCommerce - Version 1.7.2

Version Description

  • 04/12/18 =
  • Fix - Dependent rule not saving
  • Improvement - Text improvement
Download this release

Release Info

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

Code changes from version 1.7.1 to 1.7.2

assets/js/app.js CHANGED
@@ -26,92 +26,96 @@ function validateWDRBOGOFields(){
26
  jQuery.each( wdr_invalid_tags, function( key, container ) {
27
  jQuery(container).removeClass('wdr_invalid');
28
  });
29
- jQuery.each( discount_rule_range, function( key, container ) {
30
- var price_discount_type = jQuery(container).find('select.price_discount_type');
31
- if(price_discount_type.val() == 'product_discount'){
32
- var discount_product_option = jQuery(container).find('select.discount_product_option');
33
- if(jQuery.inArray(discount_product_option.val(), ['all', 'same_product']) !== -1){
34
- var discount_bogo_qty = jQuery(container).find('input.discount_bogo_qty');
35
- if(discount_bogo_qty.val() == '' || discount_bogo_qty.val() == null){
36
- discount_bogo_qty.addClass('wdr_invalid');
37
- returnValue = false;
38
- } else {
39
- discount_bogo_qty.removeClass('wdr_invalid');
40
- }
41
- }
42
- if(jQuery.inArray(discount_product_option.val(), ['more_than_one_cheapest_from_all', 'more_than_one_cheapest', 'more_than_one_cheapest_from_cat']) !== -1){
43
- var discount_product_qty = jQuery(container).find('input.discount_product_qty');
44
- if(discount_product_qty.val() == '' || discount_product_qty.val() == null){
45
- discount_product_qty.addClass('wdr_invalid');
46
- returnValue = false;
47
- } else {
48
- discount_product_qty.removeClass('wdr_invalid');
49
  }
50
- var discount_product_item_count_type = jQuery(container).find('select.discount_product_item_count_type');
51
- if(discount_product_item_count_type.val() == 'static'){
52
- var discount_product_items_count_field = jQuery(container).find('input.discount_product_items_count_field');
53
- if(discount_product_items_count_field.val() == '' || discount_product_items_count_field.val() == null){
54
- discount_product_items_count_field.addClass('wdr_invalid');
55
  returnValue = false;
56
  } else {
57
- discount_product_items_count_field.removeClass('wdr_invalid');
 
 
 
 
 
 
 
 
 
 
58
  }
59
  }
60
- }
61
- if(jQuery.inArray(discount_product_option.val(), ['more_than_one_cheapest_from_cat']) !== -1){
62
- var category_list = jQuery(container).find('select.category_list');
63
- if(category_list.val() == '' || category_list.val() == null){
64
- jQuery(container).find('.bootstrap-select.category_list > button').addClass('wdr_invalid');
65
- returnValue = false;
66
- } else {
67
- jQuery(container).find('.bootstrap-select.category_list > button').removeClass('wdr_invalid');
68
  }
69
- }
70
- //discount_category_option_list_con
71
- if(jQuery.inArray(discount_product_option.val(), ['all', 'any_cheapest', 'more_than_one_cheapest']) !== -1){
72
- var product_field = jQuery(container).find('select.wc-product-search');
73
- if(product_field.val() == '' || product_field.val() == null){
74
- jQuery(container).find('.select2-selection').addClass('wdr_invalid');
75
- returnValue = false;
76
- } else {
77
- jQuery(container).find('.select2-selection').removeClass('wdr_invalid');
78
  }
79
- }
80
 
81
- var discount_product_discount_type = jQuery(container).find('select.discount_product_discount_type');
82
- if(discount_product_discount_type.val() == 'limited_percent'){
83
- var discount_product_percent_field = jQuery(container).find('input.discount_product_percent_field');
84
- if(discount_product_percent_field.val() == '' || discount_product_percent_field.val() == null){
85
- discount_product_percent_field.addClass('wdr_invalid');
 
 
 
 
 
 
 
 
 
86
  returnValue = false;
87
  } else {
88
- discount_product_percent_field.removeClass('wdr_invalid');
89
  }
90
  }
91
- } else if(jQuery.inArray(price_discount_type.val(), ['percentage_discount', 'price_discount']) !== -1){
92
- var price_discount_amount = jQuery(container).find('input.price_discount_amount');
93
- if(price_discount_amount.val() == '' || price_discount_amount.val() == null){
94
- price_discount_amount.addClass('wdr_invalid');
95
  returnValue = false;
96
  } else {
97
- price_discount_amount.removeClass('wdr_invalid');
98
  }
99
- }
100
- var discount_range_min_qty = jQuery(container).find('input.discount_range_min_qty');
101
- if(discount_range_min_qty.val() == '' || discount_range_min_qty.val() == null){
102
- discount_range_min_qty.addClass('wdr_invalid');
103
- returnValue = false;
104
- } else {
105
- discount_range_min_qty.removeClass('wdr_invalid');
106
- }
107
- var discount_range_max_qty = jQuery(container).find('input.discount_range_max_qty');
108
- if(discount_range_max_qty.val() == '' || discount_range_max_qty.val() == null){
109
- discount_range_max_qty.addClass('wdr_invalid');
110
- returnValue = false;
111
- } else {
112
- discount_range_max_qty.removeClass('wdr_invalid');
113
- }
114
- });
115
  if(returnValue == false){
116
  discount_rule_range.find('.wdr_invalid').first().focus();
117
  jQuery('a.discount_tab').trigger('click');
26
  jQuery.each( wdr_invalid_tags, function( key, container ) {
27
  jQuery(container).removeClass('wdr_invalid');
28
  });
29
+
30
+ var price_rule_method = jQuery('select#price_rule_method').val();
31
+ if(price_rule_method == 'qty_based'){
32
+ jQuery.each( discount_rule_range, function( key, container ) {
33
+ var price_discount_type = jQuery(container).find('select.price_discount_type');
34
+ if(price_discount_type.val() == 'product_discount'){
35
+ var discount_product_option = jQuery(container).find('select.discount_product_option');
36
+ if(jQuery.inArray(discount_product_option.val(), ['all', 'same_product']) !== -1){
37
+ var discount_bogo_qty = jQuery(container).find('input.discount_bogo_qty');
38
+ if(discount_bogo_qty.val() == '' || discount_bogo_qty.val() == null){
39
+ discount_bogo_qty.addClass('wdr_invalid');
40
+ returnValue = false;
41
+ } else {
42
+ discount_bogo_qty.removeClass('wdr_invalid');
43
+ }
 
 
 
 
 
44
  }
45
+ if(jQuery.inArray(discount_product_option.val(), ['more_than_one_cheapest_from_all', 'more_than_one_cheapest', 'more_than_one_cheapest_from_cat']) !== -1){
46
+ var discount_product_qty = jQuery(container).find('input.discount_product_qty');
47
+ if(discount_product_qty.val() == '' || discount_product_qty.val() == null){
48
+ discount_product_qty.addClass('wdr_invalid');
 
49
  returnValue = false;
50
  } else {
51
+ discount_product_qty.removeClass('wdr_invalid');
52
+ }
53
+ var discount_product_item_count_type = jQuery(container).find('select.discount_product_item_count_type');
54
+ if(discount_product_item_count_type.val() == 'static'){
55
+ var discount_product_items_count_field = jQuery(container).find('input.discount_product_items_count_field');
56
+ if(discount_product_items_count_field.val() == '' || discount_product_items_count_field.val() == null){
57
+ discount_product_items_count_field.addClass('wdr_invalid');
58
+ returnValue = false;
59
+ } else {
60
+ discount_product_items_count_field.removeClass('wdr_invalid');
61
+ }
62
  }
63
  }
64
+ if(jQuery.inArray(discount_product_option.val(), ['more_than_one_cheapest_from_cat']) !== -1){
65
+ var category_list = jQuery(container).find('select.category_list');
66
+ if(category_list.val() == '' || category_list.val() == null){
67
+ jQuery(container).find('.bootstrap-select.category_list > button').addClass('wdr_invalid');
68
+ returnValue = false;
69
+ } else {
70
+ jQuery(container).find('.bootstrap-select.category_list > button').removeClass('wdr_invalid');
71
+ }
72
  }
73
+ //discount_category_option_list_con
74
+ if(jQuery.inArray(discount_product_option.val(), ['all', 'any_cheapest', 'more_than_one_cheapest']) !== -1){
75
+ var product_field = jQuery(container).find('select.wc-product-search');
76
+ if(product_field.val() == '' || product_field.val() == null){
77
+ jQuery(container).find('.select2-selection').addClass('wdr_invalid');
78
+ returnValue = false;
79
+ } else {
80
+ jQuery(container).find('.select2-selection').removeClass('wdr_invalid');
81
+ }
82
  }
 
83
 
84
+ var discount_product_discount_type = jQuery(container).find('select.discount_product_discount_type');
85
+ if(discount_product_discount_type.val() == 'limited_percent'){
86
+ var discount_product_percent_field = jQuery(container).find('input.discount_product_percent_field');
87
+ if(discount_product_percent_field.val() == '' || discount_product_percent_field.val() == null){
88
+ discount_product_percent_field.addClass('wdr_invalid');
89
+ returnValue = false;
90
+ } else {
91
+ discount_product_percent_field.removeClass('wdr_invalid');
92
+ }
93
+ }
94
+ } else if(jQuery.inArray(price_discount_type.val(), ['percentage_discount', 'price_discount']) !== -1){
95
+ var price_discount_amount = jQuery(container).find('input.price_discount_amount');
96
+ if(price_discount_amount.val() == '' || price_discount_amount.val() == null){
97
+ price_discount_amount.addClass('wdr_invalid');
98
  returnValue = false;
99
  } else {
100
+ price_discount_amount.removeClass('wdr_invalid');
101
  }
102
  }
103
+ var discount_range_min_qty = jQuery(container).find('input.discount_range_min_qty');
104
+ if(discount_range_min_qty.val() == '' || discount_range_min_qty.val() == null){
105
+ discount_range_min_qty.addClass('wdr_invalid');
 
106
  returnValue = false;
107
  } else {
108
+ discount_range_min_qty.removeClass('wdr_invalid');
109
  }
110
+ var discount_range_max_qty = jQuery(container).find('input.discount_range_max_qty');
111
+ if(discount_range_max_qty.val() == '' || discount_range_max_qty.val() == null){
112
+ discount_range_max_qty.addClass('wdr_invalid');
113
+ returnValue = false;
114
+ } else {
115
+ discount_range_max_qty.removeClass('wdr_invalid');
116
+ }
117
+ });
118
+ }
 
 
 
 
 
 
 
119
  if(returnValue == false){
120
  discount_rule_range.find('.wdr_invalid').first().focus();
121
  jQuery('a.discount_tab').trigger('click');
i18n/languages/woo-discount-rules.pot CHANGED
@@ -947,7 +947,7 @@ msgid "Tip: Install pro package before validating the licence"
947
  msgstr ""
948
 
949
  #: view/settings.php:83
950
- msgid "Enable Bootstrap (applies only for the rule engine in the backend.)"
951
  msgstr ""
952
 
953
  #: view/settings.php:88 view/settings.php:105 view/settings.php:117
947
  msgstr ""
948
 
949
  #: view/settings.php:83
950
+ msgid "Enable dropdowns (applies only for the rule engine in the backend.)"
951
  msgstr ""
952
 
953
  #: view/settings.php:88 view/settings.php:105 view/settings.php:117
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: 4.9
7
- Stable tag: 1.7.1
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -308,6 +308,10 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
308
 
309
  == Changelog ==
310
 
 
 
 
 
311
  = 1.7.1 - 29/11/18 =
312
  * Fix - BOGO validation in backend
313
  * Fix - Warning: get_html_translation_table() expects at most 2 parameters, 3 given
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: 4.9
7
+ Stable tag: 1.7.2
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
308
 
309
  == Changelog ==
310
 
311
+ = 1.7.2 - 04/12/18 =
312
+ * Fix - Dependent rule not saving
313
+ * Improvement - Text improvement
314
+
315
  = 1.7.1 - 29/11/18 =
316
  * Fix - BOGO validation in backend
317
  * Fix - Warning: get_html_translation_table() expects at most 2 parameters, 3 given
view/settings.php CHANGED
@@ -80,7 +80,7 @@ $isPro = $flycartWooDiscountRulesPurchase->isPro();
80
  <div class="row form-group">
81
  <div class="col-md-2">
82
  <label>
83
- <?php esc_html_e('Enable Bootstrap (applies only for the rule engine in the backend.)', 'woo-discount-rules'); ?>
84
  </label>
85
  </div>
86
  <?php $data['enable_bootstrap'] = (isset($data['enable_bootstrap']) ? $data['enable_bootstrap'] : 1); ?>
80
  <div class="row form-group">
81
  <div class="col-md-2">
82
  <label>
83
+ <?php esc_html_e('Enable dropdowns (applies only for the rule engine in the backend.)', 'woo-discount-rules'); ?>
84
  </label>
85
  </div>
86
  <?php $data['enable_bootstrap'] = (isset($data['enable_bootstrap']) ? $data['enable_bootstrap'] : 1); ?>
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.1
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.2
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/