Discount Rules for WooCommerce - Version 1.4.3

Version Description

Download this release

Release Info

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

Code changes from version 1.4.2 to 1.4.3

assets/css/style.css CHANGED
@@ -4,4 +4,11 @@
4
 
5
  .show {
6
  display: block !important;
 
 
 
 
 
 
 
7
  }
4
 
5
  .show {
6
  display: block !important;
7
+ }
8
+ .checkbox_label{
9
+ margin-bottom: 0;
10
+ }
11
+ #category_list,
12
+ .apply_child_categories{
13
+ margin-top: 10px;
14
  }
assets/js/app.js CHANGED
@@ -225,7 +225,7 @@ jQuery.noConflict();
225
  '<optgroup label="Cart Item Count"><option value="item_count_least">Count of cart items at least</option><option value="item_count_less">Count of cart items less than</option></optgroup>' +
226
  '<optgroup label="Quantity Sum"><option value="quantity_least">Sum of item quantities at least</option><option value="quantity_less">Sum of item quantities less than</option></optgroup><!-- At least one of these should present in the cart to apply. -->' +
227
  //'<optgroup label="Products In Cart"><option value="products_atleast_one">At least one product in cart</option><!-- These products should not present in the cart to apply. --><option value="products_not_in">None of selected products in cart</option></optgroup>' +
228
- //'<optgroup label="Categories In Cart"><!-- At least one of these should present in the cart to apply. --><option value="categories_atleast_one">At least one category in cart</option><!-- These Category should not present in the cart to apply. --><option value="categories_not_in">None of selected categories in cart</option></optgroup>' +
229
  '<optgroup label="Customer Details (must be logged in)"><option value="users_in">User in list</option><option value="roles_in">User role in list</option><option value="shipping_countries_in">Shipping country in list</option></optgroup></select></label></div>' +
230
  '<div class="col-md-3 form-group"><label> Value<div id="general_' + count + '"><input type="text" name="discount_rule[' + count + '][option_value]"></div>' +
231
  '<div id="user_div_' + count + '"><select id="cart_user_list_' + count + '" class="user_list selectpicker" multiple name="discount_rule[' + count + '][users_to_apply][]"></select></div>' +
225
  '<optgroup label="Cart Item Count"><option value="item_count_least">Count of cart items at least</option><option value="item_count_less">Count of cart items less than</option></optgroup>' +
226
  '<optgroup label="Quantity Sum"><option value="quantity_least">Sum of item quantities at least</option><option value="quantity_less">Sum of item quantities less than</option></optgroup><!-- At least one of these should present in the cart to apply. -->' +
227
  //'<optgroup label="Products In Cart"><option value="products_atleast_one">At least one product in cart</option><!-- These products should not present in the cart to apply. --><option value="products_not_in">None of selected products in cart</option></optgroup>' +
228
+ //'<optgroup label="Categories In Cart"><!-- At least one of these should present in the cart to apply. --><option value="categories_atleast_one">At least one category in cart</option><!-- These Category should not present in the cart to apply. --><!--<option value="categories_not_in">None of selected categories in cart</option>--></optgroup>' +
229
  '<optgroup label="Customer Details (must be logged in)"><option value="users_in">User in list</option><option value="roles_in">User role in list</option><option value="shipping_countries_in">Shipping country in list</option></optgroup></select></label></div>' +
230
  '<div class="col-md-3 form-group"><label> Value<div id="general_' + count + '"><input type="text" name="discount_rule[' + count + '][option_value]"></div>' +
231
  '<div id="user_div_' + count + '"><select id="cart_user_list_' + count + '" class="user_list selectpicker" multiple name="discount_rule[' + count + '][users_to_apply][]"></select></div>' +
helper/general-helper.php CHANGED
@@ -89,11 +89,23 @@ if ( ! class_exists( 'woo_dicount_rules_generalHelper' ) ) {
89
  */
90
  public function getProductList()
91
  {
 
 
 
 
 
 
 
 
 
 
 
 
92
  $products = array();
93
  $posts_raw = get_posts(array(
94
  'posts_per_page' => -1,
95
  'post_type' => 'product',
96
- 'post_status' => array('publish', 'pending', 'draft', 'future', 'private', 'inherit'),
97
  'fields' => 'ids',
98
  ));
99
 
89
  */
90
  public function getProductList()
91
  {
92
+ $base = new woo_dicount_rules_WooDiscountBase();
93
+ $base = $base->getBaseConfig();
94
+ if (is_string($base)) $base = json_decode($base, true);
95
+ $show_draft = 0;
96
+ if(isset($base['show_draft']) && $base['show_draft'] == 1){
97
+ $show_draft = 1;
98
+ }
99
+ if($show_draft){
100
+ $postStatus = array('publish', 'pending', 'future', 'private', 'inherit');
101
+ } else {
102
+ $postStatus = array('publish', 'pending', 'draft', 'future', 'private', 'inherit');
103
+ }
104
  $products = array();
105
  $posts_raw = get_posts(array(
106
  'posts_per_page' => -1,
107
  'post_type' => 'product',
108
+ 'post_status' => $postStatus,
109
  'fields' => 'ids',
110
  ));
111
 
includes/cart-rules.php CHANGED
@@ -116,6 +116,19 @@ if (!class_exists('woo_dicount_rules_cartRules')) {
116
  // Encoding String with Space.
117
  $slug = str_replace(' ', '-', $slug);
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  if ($id) {
120
  $post = array(
121
  'ID' => $id,
@@ -135,20 +148,9 @@ if (!class_exists('woo_dicount_rules_cartRules')) {
135
  'post_status' => 'publish'
136
  );
137
  $id = wp_insert_post($post);
 
138
  }
139
 
140
- $form = array(
141
- 'rule_name',
142
- 'rule_descr',
143
- 'date_from',
144
- 'date_to',
145
- 'apply_to',
146
- 'discount_type',
147
- 'to_discount',
148
- 'discount_rule',
149
- 'rule_order'
150
- );
151
-
152
  foreach ($request['discount_rule'] as $index => $value) {
153
  $request['discount_rule'][$index] = woo_dicount_rules_generalHelper::makeString($value);
154
  }
@@ -456,8 +458,7 @@ if (!class_exists('woo_dicount_rules_cartRules')) {
456
  $today = strtotime(date('m/d/Y'));
457
 
458
  // Validating Rule with Date of Expiry.
459
- if ((($date_from <= $today) && ($date_to >= $today)) || ($date_from == '' && $date_to == '')) {
460
-
461
  // Validating the Rule with its Order ID.
462
  if (isset($rule->rule_order)) {
463
  // If Order ID is '-', then this rule not going to implement.
@@ -535,7 +536,6 @@ if (!class_exists('woo_dicount_rules_cartRules')) {
535
  $discount = 0;
536
  $discounts = array();
537
  if (!isset($this->rule_sets)) return false;
538
-
539
  // Processing the Totals.
540
  foreach ($this->rule_sets as $index => $rule) {
541
  if ($rule['enabled'] == true) {
@@ -655,11 +655,42 @@ if (!class_exists('woo_dicount_rules_cartRules')) {
655
  }
656
  return true;
657
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
658
 
659
  }
660
 
661
  }
662
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
663
  /**
664
  * Get cart total amount
665
  *
116
  // Encoding String with Space.
117
  $slug = str_replace(' ', '-', $slug);
118
 
119
+ $form = array(
120
+ 'rule_name',
121
+ 'rule_descr',
122
+ 'date_from',
123
+ 'date_to',
124
+ 'apply_to',
125
+ 'discount_type',
126
+ 'to_discount',
127
+ 'discount_rule',
128
+ 'rule_order',
129
+ 'status'
130
+ );
131
+
132
  if ($id) {
133
  $post = array(
134
  'ID' => $id,
148
  'post_status' => 'publish'
149
  );
150
  $id = wp_insert_post($post);
151
+ $request['status'] = 'publish';
152
  }
153
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  foreach ($request['discount_rule'] as $index => $value) {
155
  $request['discount_rule'][$index] = woo_dicount_rules_generalHelper::makeString($value);
156
  }
458
  $today = strtotime(date('m/d/Y'));
459
 
460
  // Validating Rule with Date of Expiry.
461
+ if (($date_from <= $today) && (($date_to == '') || ($date_to >= $today))) {
 
462
  // Validating the Rule with its Order ID.
463
  if (isset($rule->rule_order)) {
464
  // If Order ID is '-', then this rule not going to implement.
536
  $discount = 0;
537
  $discounts = array();
538
  if (!isset($this->rule_sets)) return false;
 
539
  // Processing the Totals.
540
  foreach ($this->rule_sets as $index => $rule) {
541
  if ($rule['enabled'] == true) {
655
  }
656
  return true;
657
  break;
658
+ /*case 'categories_atleast_one':
659
+ if(count($rule)){
660
+ $w_categories = $this->getCartProductCaregories();
661
+ if(count($w_categories)){
662
+ foreach ($rule as $cat){
663
+ if(in_array($cat, $w_categories)){
664
+ return true;
665
+ }
666
+ }
667
+ }
668
+ }
669
+ return false;
670
+ break;*/
671
 
672
  }
673
 
674
  }
675
 
676
+ /**
677
+ * To get product categories
678
+ * */
679
+ /*public function getCartProductCaregories(){
680
+ global $woocommerce;
681
+ $product_cat_id = array();
682
+ if(count($woocommerce->cart->cart_contents)){
683
+ foreach ($woocommerce->cart->cart_contents as $cartItem) {
684
+ $terms = get_the_terms( $cartItem['product_id'], 'product_cat' );
685
+ if($terms)
686
+ foreach ($terms as $term) {
687
+ $product_cat_id[] = $term->term_id;
688
+ }
689
+ }
690
+ }
691
+ return $product_cat_id;
692
+ }*/
693
+
694
  /**
695
  * Get cart total amount
696
  *
includes/discount-base.php CHANGED
@@ -276,6 +276,11 @@ if (!class_exists('woo_dicount_rules_WooDiscountBase')) {
276
  }
277
 
278
  if (is_array($request)) {
 
 
 
 
 
279
  foreach ($params as $index => $item) {
280
  // $params[$index] = woo_dicount_rules_generalHelper::makeString($item);
281
  $params[$index] = $item;
276
  }
277
 
278
  if (is_array($request)) {
279
+ if(isset($params['show_draft']) && $params['show_draft']){
280
+ $params['show_draft'] = 1;
281
+ } else {
282
+ $params['show_draft'] = 0;
283
+ }
284
  foreach ($params as $index => $item) {
285
  // $params[$index] = woo_dicount_rules_generalHelper::makeString($item);
286
  $params[$index] = $item;
includes/pricing-rules.php CHANGED
@@ -152,6 +152,20 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
152
 
153
  if ($apply_to == 'specific_category') {
154
  $apply_to = 'category_to_apply';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  } elseif ($apply_to == 'specific_products') {
156
  $apply_to = 'product_to_apply';
157
  }
@@ -324,7 +338,7 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
324
  $today = strtotime(date('m/d/Y'));
325
 
326
  // Validating Rule with Date of Expiry.
327
- if (($date_from <= $today) && (($date_to == '') || ($date_to > $today))) {
328
 
329
  // Validating the Rule with its Order ID.
330
  if (isset($rule->rule_order)) {
@@ -424,8 +438,23 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
424
  $rule_sets[$index]['type']['specific_products'] = $this->checkWithProducts($rule, $woocommerce);
425
  }
426
  } else if ($rule->apply_to == 'specific_category') {
 
 
 
 
 
 
427
  if (isset($rule->category_to_apply)) {
428
  $rule_sets[$index]['type']['specific_category'] = $this->checkWithCategory($rule, $woocommerce);
 
 
 
 
 
 
 
 
 
429
  }
430
  } else {
431
  $rule_sets[$index]['type'] = 'all';
@@ -457,6 +486,27 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
457
  $this->rule_sets = $rule_sets;
458
  }
459
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
460
  /**
461
  * Fetch back the Matched rules.
462
  *
@@ -488,6 +538,10 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
488
 
489
  case 'specific_category':
490
  if ($this->isItemInCategoryList($rule['type']['specific_category'], $item)) {
 
 
 
 
491
  $applied_rules[$i]['amount'] = $this->getAdjustmentAmount($quantity, $this->array_first($rule['discount']));
492
  $applied_rules[$i]['name'] = $rule['name'];
493
  $applied_rules[$i]['item'] = $index;
@@ -513,6 +567,31 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
513
  $this->matched_sets[$index] = $applied_rules;
514
  }
515
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
516
  /**
517
  * Return the First index.
518
  *
@@ -618,12 +697,10 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
618
  $product_category = woo_dicount_rules_generalHelper::getCategoryByPost($product);
619
 
620
  $status = false;
621
-
622
- // Simple Check with Active Categories.
623
- if (count(array_intersect($category_list, array_keys($all_category))) > 0) {
624
- if (count(array_intersect($category_list, $product_category)) == 1) {
625
- $status = true;
626
- }
627
  }
628
 
629
  return $status;
@@ -797,6 +874,22 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
797
  $discount_range = '';
798
  foreach ($this->rules as $index => $rule) {
799
  $status = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
800
  if ($rule->apply_to == 'specific_products') {
801
 
802
  // Check with Product Filter.
@@ -814,11 +907,14 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
814
 
815
  // Check with Product Category Filter.
816
  $category = woo_dicount_rules_generalHelper::getCategoryByPost($id, true);
817
- $category_to_apply = json_decode($rule->category_to_apply);
818
 
819
  if ($rule->category_to_apply == null) $status = true;
820
 
821
  if ($rule->category_to_apply != null) {
 
 
 
 
822
  woo_dicount_rules_generalHelper::toInt($category_to_apply);
823
  $status = false;
824
  if (count(array_intersect($category_to_apply, $category)) > 0) {
@@ -830,19 +926,7 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
830
  $status = true;
831
  }
832
 
833
- // Check with Active User Filter.
834
- if (isset($rule->customer)) {
835
- $status = false;
836
- if ($rule->customer == 'all') {
837
- $status = true;
838
- } else {
839
- $users = (is_string($rule->users_to_apply) ? json_decode($rule->users_to_apply, true) : array());
840
- $user_id = get_current_user_id();
841
- if (count(array_intersect($users, array($user_id))) > 0) {
842
- $status = true;
843
- }
844
- }
845
- }
846
  if ($status) {
847
  $discount_range[] = (isset($rule->discount_range) ? json_decode($rule->discount_range) : array());
848
  }
152
 
153
  if ($apply_to == 'specific_category') {
154
  $apply_to = 'category_to_apply';
155
+ if(isset($request['is_cumulative']) && $request['is_cumulative'] == 1){
156
+ $request['is_cumulative'] = 1;
157
+ } else {
158
+ $request['is_cumulative'] = 0;
159
+ }
160
+ $form[] = 'is_cumulative';
161
+
162
+ if(isset($request['apply_child_categories']) && $request['apply_child_categories'] == 1){
163
+ $request['apply_child_categories'] = 1;
164
+ } else {
165
+ $request['apply_child_categories'] = 0;
166
+ }
167
+ $form[] = 'apply_child_categories';
168
+
169
  } elseif ($apply_to == 'specific_products') {
170
  $apply_to = 'product_to_apply';
171
  }
338
  $today = strtotime(date('m/d/Y'));
339
 
340
  // Validating Rule with Date of Expiry.
341
+ if (($date_from <= $today) && (($date_to == '') || ($date_to >= $today))) {
342
 
343
  // Validating the Rule with its Order ID.
344
  if (isset($rule->rule_order)) {
438
  $rule_sets[$index]['type']['specific_products'] = $this->checkWithProducts($rule, $woocommerce);
439
  }
440
  } else if ($rule->apply_to == 'specific_category') {
441
+ if (isset($rule->apply_child_categories) && $rule->apply_child_categories) {
442
+ $rule_sets[$index]['type']['apply_child_categories'] = 1;
443
+ } else {
444
+ $rule_sets[$index]['type']['apply_child_categories'] = 0;
445
+ }
446
+
447
  if (isset($rule->category_to_apply)) {
448
  $rule_sets[$index]['type']['specific_category'] = $this->checkWithCategory($rule, $woocommerce);
449
+ if($rule_sets[$index]['type']['apply_child_categories']){
450
+ $cat = $rule_sets[$index]['type']['specific_category'];
451
+ $rule_sets[$index]['type']['specific_category'] = $this->getAllSubCategories($cat);
452
+ }
453
+ }
454
+ if (isset($rule->is_cumulative) && $rule->is_cumulative) {
455
+ $rule_sets[$index]['type']['is_cumulative'] = 1;
456
+ } else {
457
+ $rule_sets[$index]['type']['is_cumulative'] = 0;
458
  }
459
  } else {
460
  $rule_sets[$index]['type'] = 'all';
486
  $this->rule_sets = $rule_sets;
487
  }
488
 
489
+ /**
490
+ * Get all sub categories
491
+ * */
492
+ public function getAllSubCategories($cat){
493
+ $category_with_sub_cat = $cat;
494
+ foreach($cat as $c) {
495
+ $args = array('hierarchical' => 1,
496
+ 'show_option_none' => '',
497
+ 'hide_empty' => 0,
498
+ 'parent' => $c,
499
+ 'taxonomy' => 'product_cat');
500
+ $categories = get_categories( $args );
501
+ foreach($categories as $category) {
502
+ $category_with_sub_cat[] = $category->term_id;
503
+ }
504
+ }
505
+ $category_with_sub_cat = array_unique($category_with_sub_cat);
506
+
507
+ return $category_with_sub_cat;
508
+ }
509
+
510
  /**
511
  * Fetch back the Matched rules.
512
  *
538
 
539
  case 'specific_category':
540
  if ($this->isItemInCategoryList($rule['type']['specific_category'], $item)) {
541
+ if(isset($rule['type']['is_cumulative']) && $rule['type']['is_cumulative']){
542
+ $totalQuantityInThisCategory = $this->getProductQuantityInThisCategory($rule['type']['specific_category']);
543
+ $quantity = $totalQuantityInThisCategory;
544
+ }
545
  $applied_rules[$i]['amount'] = $this->getAdjustmentAmount($quantity, $this->array_first($rule['discount']));
546
  $applied_rules[$i]['name'] = $rule['name'];
547
  $applied_rules[$i]['item'] = $index;
567
  $this->matched_sets[$index] = $applied_rules;
568
  }
569
 
570
+ /**
571
+ * Get quantity of products in specific category
572
+ * */
573
+ public function getProductQuantityInThisCategory($category){
574
+ global $woocommerce;
575
+ $quantity = 0;
576
+ if(count($woocommerce->cart->cart_contents)){
577
+ foreach ($woocommerce->cart->cart_contents as $cartItem) {
578
+ $terms = get_the_terms( $cartItem['product_id'], 'product_cat' );
579
+ if($terms){
580
+ $has = 0;
581
+ foreach ($terms as $term) {
582
+ if(in_array($term->term_id, $category)){
583
+ $has = 1;
584
+ }
585
+ }
586
+ if($has){
587
+ $quantity = $quantity + $cartItem['quantity'];
588
+ }
589
+ }
590
+ }
591
+ }
592
+ return $quantity;
593
+ }
594
+
595
  /**
596
  * Return the First index.
597
  *
697
  $product_category = woo_dicount_rules_generalHelper::getCategoryByPost($product);
698
 
699
  $status = false;
700
+ //check any one of category matches
701
+ $result = !empty(array_intersect($product_category, $category_list));
702
+ if($result){
703
+ $status = true;
 
 
704
  }
705
 
706
  return $status;
874
  $discount_range = '';
875
  foreach ($this->rules as $index => $rule) {
876
  $status = false;
877
+
878
+ // Check with Active User Filter.
879
+ if (isset($rule->customer)) {
880
+ // print_r($rule->customer);exit;
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.
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) {
926
  $status = true;
927
  }
928
 
929
+
 
 
 
 
 
 
 
 
 
 
 
 
930
  if ($status) {
931
  $discount_range[] = (isset($rule->discount_range) ? json_decode($rule->discount_range) : array());
932
  }
loader.php CHANGED
@@ -3,7 +3,7 @@ if (!defined('ABSPATH')) exit; // Exit if accessed directly
3
  /**
4
  * Version of Woo Discount Rules.
5
  */
6
- define('WOO_DISCOUNT_VERSION', '1.4.2');
7
  /**
8
  * Required Version of WooCommerce to Run.
9
  */
@@ -24,7 +24,9 @@ define('WOO_DISCOUNT_PLUGIN_BASENAME', plugin_basename(__FILE__));
24
  include_once('includes/discount-base.php');
25
  include_once('includes/pricing-rules.php');
26
  include_once('helper/general-helper.php');
27
- require_once('helper/FlycartInput/FInput.php');
 
 
28
 
29
  // --------------------------------------------------GENERAL HOOK-------------------------------------------------------
30
 
3
  /**
4
  * Version of Woo Discount Rules.
5
  */
6
+ define('WOO_DISCOUNT_VERSION', '1.4.3');
7
  /**
8
  * Required Version of WooCommerce to Run.
9
  */
24
  include_once('includes/discount-base.php');
25
  include_once('includes/pricing-rules.php');
26
  include_once('helper/general-helper.php');
27
+ if(!class_exists('\FlycartInput\FInput') && !class_exists('FInput')){
28
+ require_once('helper/FlycartInput/FInput.php');
29
+ }
30
 
31
  // --------------------------------------------------GENERAL HOOK-------------------------------------------------------
32
 
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.2
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
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.3
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
view/settings.php CHANGED
@@ -149,6 +149,22 @@ if (is_string($data)) $data = json_decode($data, true);
149
  </select>
150
  </div>
151
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  </div>
153
  </div>
154
  <input type="hidden" id="ajax_path" value="<?php echo admin_url('admin-ajax.php') ?>">
149
  </select>
150
  </div>
151
  </div>
152
+ <div class="row form-group">
153
+ <div class="col-md-2">
154
+ <label>
155
+ Draft
156
+ </label>
157
+ </div>
158
+ <div class="col-md-6">
159
+ <?php
160
+ $checked = 0;
161
+ if (isset($data['show_draft']) && $data['show_draft'] == 1){
162
+ $checked = 1;
163
+ } ?>
164
+ <input type="checkbox" class="" id="show_draft_1" name="show_draft"
165
+ value="1" <?php if($checked){ echo 'checked'; } ?>> <label class="checkbox_label" for="show_draft_1">Exclude Draft products in product select box.</label>
166
+ </div>
167
+ </div>
168
  </div>
169
  </div>
170
  <input type="hidden" id="ajax_path" value="<?php echo admin_url('admin-ajax.php') ?>">
view/view-cart-rules.php CHANGED
@@ -213,25 +213,26 @@ if (empty($discount_rules)) {
213
  <!-- cart-->
214
  <!-- </option>-->
215
  <!-- </optgroup>-->
216
- <!-- <optgroup label="Categories In Cart">-->
217
- <!-- <!-- At least one of these should present in the cart to apply. -->
218
 
219
- <!-- <option-->
220
- <!-- value="categories_atleast_one"-->
221
- <?php //if ($type == 'categories_atleast_one') { ?><!-- selected=selected -->
222
- <?php //} ?><!-->
223
- <!-- At least one category in-->
224
- <!-- cart-->
225
- <!-- </option>-->
226
- <!-- <!-- These Category should not present in the cart to apply. -->
227
- <!-- <option-->
228
- <!-- value="categories_not_in"-->
 
229
  <?php //if ($type == 'categories_not_in') { ?><!-- selected=selected -->
230
  <?php //} ?><!-->
231
  <!-- None of selected categories in-->
232
  <!-- cart-->
233
  <!-- </option>-->
234
- <!-- </optgroup>-->
235
  <optgroup label="Customer Details (must be logged in)">
236
  <option
237
  <?php if (!$pro) { ?> disabled <?php } else { ?> value="users_in" <?php
213
  <!-- cart-->
214
  <!-- </option>-->
215
  <!-- </optgroup>-->
216
+ <!-- <optgroup label="Categories In Cart">-->
217
+ <!-- At least one of these should present in the cart to apply. -->
218
 
219
+ <!-- <option-->
220
+ <!-- --><?php //if (!$pro) { ?><!-- disabled --><?php //} else { ?><!-- value="categories_atleast_one" --><?php
221
+ // } ?>
222
+ <!-- --><?php //if ($type == 'categories_atleast_one') { ?><!-- selected="selected"-->
223
+ <!-- --><?php //} ?><!-->-->
224
+ <!-- At least one category in-->
225
+ <!-- cart-->
226
+ <!-- </option>-->
227
+ <!-- These Category should not present in the cart to apply.
228
+ <option
229
+ value="categories_not_in"
230
  <?php //if ($type == 'categories_not_in') { ?><!-- selected=selected -->
231
  <?php //} ?><!-->
232
  <!-- None of selected categories in-->
233
  <!-- cart-->
234
  <!-- </option>-->
235
+ <!-- </optgroup>-->
236
  <optgroup label="Customer Details (must be logged in)">
237
  <option
238
  <?php if (!$pro) { ?> disabled <?php } else { ?> value="users_in" <?php
view/view-pricing-rules.php CHANGED
@@ -179,6 +179,12 @@ $rule_id = (isset($data->ID)) ? $data->ID : 0;
179
  value="<?php echo $index; ?>"<?php if (in_array($index, $category_list)) { ?> selected=selected <?php } ?>><?php echo $value; ?></option>
180
  <?php } ?>
181
  </select>
 
 
 
 
 
 
182
  </div>
183
  </div>
184
  </div>
179
  value="<?php echo $index; ?>"<?php if (in_array($index, $category_list)) { ?> selected=selected <?php } ?>><?php echo $value; ?></option>
180
  <?php } ?>
181
  </select>
182
+ <?php $is_cumulative = (isset($data->is_cumulative))? $data->is_cumulative : 0 ?>
183
+ <input type="checkbox" name="is_cumulative" id="is_cumulative" value="1" <?php if($is_cumulative) { echo "checked"; } ?>> <label class="checkbox_label" for="is_cumulative">Is Cumulative</label>
184
+ <div class="apply_child_categories">
185
+ <?php $apply_child_categories = (isset($data->apply_child_categories))? $data->apply_child_categories : 0 ?>
186
+ <input type="checkbox" name="apply_child_categories" id="apply_child_categories" value="1" <?php if($apply_child_categories) { echo "checked"; } ?>> <label class="checkbox_label" for="apply_child_categories">Apply Child Categories</label>
187
+ </div>
188
  </div>
189
  </div>
190
  </div>
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.2
9
  * Requires at least: 4.6.1
10
  */
11
 
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 1.4.3
9
  * Requires at least: 4.6.1
10
  */
11