Discount Rules for WooCommerce - Version 1.4.39

Version Description

  • 12/01/18 =
  • Feature - Option: Any one of cheapest from all products for BOGO(Pro version)
  • Fix - Improvement in loading issue in product list page
Download this release

Release Info

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

Code changes from version 1.4.38 to 1.4.39

assets/css/style.css CHANGED
@@ -41,4 +41,7 @@
41
  .woo-support-in_pro{
42
  font-style: italic;
43
  color: #999;
 
 
 
44
  }
41
  .woo-support-in_pro{
42
  font-style: italic;
43
  color: #999;
44
+ }
45
+ .discount_product_option_list_con{
46
+ display: inline-block;
47
  }
assets/js/app.js CHANGED
@@ -156,14 +156,16 @@ function validateFields(){
156
  '<option value="percentage_discount"> Percentage Discount </option> <option value="price_discount">Price Discount </option> <option value="product_discount">Product Discount </option> </select></label> <label>Value ' +
157
  '<input type="text" name="discount_range[' + count + '][to_discount]" class="form-control price_discount_amount" value="" placeholder="ex. 50"> ';
158
  form += '<div class="price_discount_product_list_con hide">' +
159
- ' Apply for <select class="" name="discount_range['+count+'][discount_product_option]"><option value="all">All selected</option><option value="any_cheapest">Any one cheapest </option>' +
160
  '</select>';
 
161
  if($('#flycart_wdr_woocommerce_version').val() == 2){
162
  form += '<input type="hidden" class="wc-product-search" style="width: 250px" data-multiple="true" name="discount_range[' + count + '][discount_product][]" data-placeholder="Search for a product&hellip;" data-action="woocommerce_json_search_products_and_variations" data-selected=""/>';
163
  } else {
164
  form += '<select class="wc-product-search" multiple="multiple" style="width: 250px" name="discount_range[' + count + '][discount_product][]" data-placeholder="Search for a product&hellip;" data-action="woocommerce_json_search_products_and_variations"></select>'
165
  }
166
  form += '</div>';
 
167
  form += '</label> <label>Action <a href=javascript:void(0) class="button button-secondary form-control remove_discount_range">Remove</a></label> </div> </div>';
168
  } else {
169
  var form = '<div class="discount_rule_list"> <div class="form-group"><label>Min Quantity <input type="text" name="discount_range[' + count + '][min_qty]" class="form-control" value="" placeholder="ex. 1"></label>' +
@@ -176,7 +178,7 @@ function validateFields(){
176
  form += '</label> <label>Action <a href=javascript:void(0) class="button button-secondary form-control remove_discount_range">Remove</a></label> </div> </div>';
177
  }
178
  $('#discount_rule_list').append(form);
179
- $('.product_list').selectpicker('refresh');
180
  $('.wc-product-search').trigger( 'wc-enhanced-select-init' );
181
  });
182
 
@@ -399,13 +401,26 @@ function validateFields(){
399
  if($(this).val() == 'product_discount'){
400
  discount_amount.hide();
401
  price_discount_amount.removeClass('hide').show();
 
402
  } else {
403
  discount_amount.show();
404
  price_discount_amount.hide();
 
405
  }
406
  });
407
  $('.price_discount_type').trigger('change');
408
 
 
 
 
 
 
 
 
 
 
 
 
409
 
410
  // Saving Cart Rule.
411
  $('#saveCartRule').on('click', function (event) {
156
  '<option value="percentage_discount"> Percentage Discount </option> <option value="price_discount">Price Discount </option> <option value="product_discount">Product Discount </option> </select></label> <label>Value ' +
157
  '<input type="text" name="discount_range[' + count + '][to_discount]" class="form-control price_discount_amount" value="" placeholder="ex. 50"> ';
158
  form += '<div class="price_discount_product_list_con hide">' +
159
+ ' Apply for <select class="selectpicker discount_product_option" name="discount_range['+count+'][discount_product_option]"><option value="all">All selected</option><option value="any_cheapest">Any one cheapest from selected</option><option value="any_cheapest_from_all">Any one cheapest from all products</option>' +
160
  '</select>';
161
+ form += '<div class="discount_product_option_list_con">';
162
  if($('#flycart_wdr_woocommerce_version').val() == 2){
163
  form += '<input type="hidden" class="wc-product-search" style="width: 250px" data-multiple="true" name="discount_range[' + count + '][discount_product][]" data-placeholder="Search for a product&hellip;" data-action="woocommerce_json_search_products_and_variations" data-selected=""/>';
164
  } else {
165
  form += '<select class="wc-product-search" multiple="multiple" style="width: 250px" name="discount_range[' + count + '][discount_product][]" data-placeholder="Search for a product&hellip;" data-action="woocommerce_json_search_products_and_variations"></select>'
166
  }
167
  form += '</div>';
168
+ form += '</div>';
169
  form += '</label> <label>Action <a href=javascript:void(0) class="button button-secondary form-control remove_discount_range">Remove</a></label> </div> </div>';
170
  } else {
171
  var form = '<div class="discount_rule_list"> <div class="form-group"><label>Min Quantity <input type="text" name="discount_range[' + count + '][min_qty]" class="form-control" value="" placeholder="ex. 1"></label>' +
178
  form += '</label> <label>Action <a href=javascript:void(0) class="button button-secondary form-control remove_discount_range">Remove</a></label> </div> </div>';
179
  }
180
  $('#discount_rule_list').append(form);
181
+ $('.product_list,.selectpicker').selectpicker('refresh');
182
  $('.wc-product-search').trigger( 'wc-enhanced-select-init' );
183
  });
184
 
401
  if($(this).val() == 'product_discount'){
402
  discount_amount.hide();
403
  price_discount_amount.removeClass('hide').show();
404
+ $('.hide-for-product-discount').hide();
405
  } else {
406
  discount_amount.show();
407
  price_discount_amount.hide();
408
+ $('.hide-for-product-discount').show();
409
  }
410
  });
411
  $('.price_discount_type').trigger('change');
412
 
413
+ //on change discount_product_option in product discount
414
+ $(document).on('change', 'select.discount_product_option', function () {
415
+ var discount_product = $(this).closest('.price_discount_product_list_con').find('.discount_product_option_list_con');
416
+ if($(this).val() == 'any_cheapest_from_all'){
417
+ discount_product.addClass('hide');
418
+ } else {
419
+ discount_product.removeClass('hide');
420
+ }
421
+ });
422
+ $('select.discount_product_option').trigger('change');
423
+
424
 
425
  // Saving Cart Rule.
426
  $('#saveCartRule').on('click', function (event) {
helper/general-helper.php CHANGED
@@ -32,7 +32,6 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
32
  ob_start();
33
  $config = $data;
34
  $pro = $this->isPro;
35
- //$products = $this->getProductList();
36
  $category = $this->getCategoryList();
37
  //$users = $this->getUserList();
38
  FlycartWoocommerceVersion::wcVersion('3.0')? $flycart_wdr_woocommerce_version = 3: $flycart_wdr_woocommerce_version = 2;
@@ -85,42 +84,6 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
85
  return $tab;
86
  }
87
 
88
- /**
89
- * To Get Product List.
90
- *
91
- * @return array
92
- */
93
- public function getProductList()
94
- {
95
- $base = new FlycartWooDiscountBase();
96
- $base = $base->getBaseConfig();
97
- if (is_string($base)) $base = json_decode($base, true);
98
- $show_draft = 0;
99
- if(isset($base['show_draft']) && $base['show_draft'] == 1){
100
- $show_draft = 1;
101
- }
102
- if($show_draft){
103
- $postStatus = array('publish', 'pending', 'future', 'private', 'inherit');
104
- } else {
105
- $postStatus = array('publish', 'pending', 'draft', 'future', 'private', 'inherit');
106
- }
107
- $products = array();
108
- $posts_raw = get_posts(array(
109
- 'posts_per_page' => -1,
110
- 'post_type' => array('product', 'product_variation'),
111
- 'post_status' => $postStatus,
112
- 'fields' => 'ids',
113
- ));
114
-
115
- foreach ($posts_raw as $post_id) {
116
- $product = FlycartWoocommerceProduct::wc_get_product($post_id);
117
- $products[$post_id] = FlycartWoocommerceProduct::get_formatted_name($product);
118
- //$products[$post_id] = '#' . $post_id . ' ' . get_the_title($post_id);
119
- }
120
- asort($products);
121
- return $products;
122
- }
123
-
124
  /**
125
  * To Get All Countries.
126
  *
32
  ob_start();
33
  $config = $data;
34
  $pro = $this->isPro;
 
35
  $category = $this->getCategoryList();
36
  //$users = $this->getUserList();
37
  FlycartWoocommerceVersion::wcVersion('3.0')? $flycart_wdr_woocommerce_version = 3: $flycart_wdr_woocommerce_version = 2;
84
  return $tab;
85
  }
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  /**
88
  * To Get All Countries.
89
  *
includes/cart-rules.php CHANGED
@@ -66,6 +66,9 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
66
 
67
  public $postData;
68
 
 
 
 
69
  /**
70
  * FlycartWooDiscountRulesCartRules constructor.
71
  */
@@ -204,6 +207,8 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
204
  */
205
  public function getRules($onlyCount = false)
206
  {
 
 
207
  $posts = get_posts(array('post_type' => $this->post_type, 'numberposts' => '-1'));
208
  if ($onlyCount) return count($posts);
209
  if (isset($posts) && count($posts) > 0) {
@@ -213,6 +218,10 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
213
 
214
  $this->rules = $posts;
215
  }
 
 
 
 
216
  return $posts;
217
  }
218
 
66
 
67
  public $postData;
68
 
69
+ public static $rules_loaded = 0;
70
+ public static $cartRules;
71
+
72
  /**
73
  * FlycartWooDiscountRulesCartRules constructor.
74
  */
207
  */
208
  public function getRules($onlyCount = false)
209
  {
210
+ if(self::$rules_loaded) return $this->rules = self::$cartRules;
211
+
212
  $posts = get_posts(array('post_type' => $this->post_type, 'numberposts' => '-1'));
213
  if ($onlyCount) return count($posts);
214
  if (isset($posts) && count($posts) > 0) {
218
 
219
  $this->rules = $posts;
220
  }
221
+
222
+ self::$rules_loaded = 1;
223
+ self::$cartRules = $posts;
224
+
225
  return $posts;
226
  }
227
 
includes/pricing-rules.php CHANGED
@@ -56,6 +56,9 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
56
 
57
  public $postData;
58
 
 
 
 
59
  /**
60
  * FlycartWooDiscountRulesPricingRules constructor.
61
  */
@@ -286,6 +289,8 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
286
  */
287
  public function getRules($onlyCount = false)
288
  {
 
 
289
  $posts = get_posts(array('post_type' => $this->post_type, 'numberposts' => '-1'));
290
  if ($onlyCount) return count($posts);
291
  if (isset($posts) && count($posts) > 0) {
@@ -294,6 +299,8 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
294
  }
295
  $this->rules = $posts;
296
  }
 
 
297
  return $posts;
298
  }
299
 
@@ -955,7 +962,12 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
955
  $discount_product_option = isset($range->discount_product_option) ? $range->discount_product_option : 'all';
956
  $productIds = isset($range->discount_product) ? $range->discount_product : array();
957
  $productIds = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($productIds);
958
- if($discount_product_option == 'any_cheapest'){
 
 
 
 
 
959
  $productCheapest = $this->getCheapestProductFromCart($productIds);
960
  if(!empty($productCheapest)){
961
  $adjustment = array ( 'price_discount' => $productCheapest['percent'], 'product_ids' => array($productCheapest['product']) ) ;
@@ -987,23 +999,25 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
987
  /**
988
  * Get cheapest product
989
  * */
990
- public function getCheapestProductFromCart($products){
991
- if(empty($products)) return array();
 
 
992
  $cheapestProductValue = 0;
993
  $cart = FlycartWoocommerceCart::get_cart();
994
  foreach ($cart as $cart_item_key => $values) {
995
  $_product = $values['data'];
996
  $productId = FlycartWoocommerceProduct::get_id($_product);
997
- if(in_array($productId, $products)){
998
- if($cheapestProductValue == 0){
999
- $cheapestProductValue = FlycartWoocommerceProduct::get_price($_product);
1000
- $cheapestProduct = FlycartWoocommerceProduct::get_id($_product);
1001
- $quantity = $values['quantity'];
1002
- } else if($cheapestProductValue > FlycartWoocommerceProduct::get_price($_product)){
1003
- $cheapestProductValue = FlycartWoocommerceProduct::get_price($_product);
1004
- $cheapestProduct = FlycartWoocommerceProduct::get_id($_product);
1005
- $quantity = $values['quantity'];
1006
- }
1007
  }
1008
  }
1009
  if($cheapestProductValue > 0){
@@ -1484,21 +1498,29 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1484
  $discount_type = isset($value->discount_type) ? $value->discount_type : 0;
1485
  $to_discount = isset($value->to_discount) ? $value->to_discount : 0;
1486
  $product_discount = isset($value->discount_product) ? $value->discount_product : array();
 
1487
  $product_discount = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($product_discount);
1488
  if (isset($base_config['show_discount_title_table'])) {
1489
  }
1490
  $condition = $min .' - ' . $max;
1491
  if ($discount_type == 'product_discount') {
1492
- $discount = '';
1493
- if(count($product_discount)){
1494
- $htmlProduct = '';
1495
- foreach ($product_discount as $product_id){
1496
- $product = FlycartWoocommerceProduct::wc_get_product($product_id);
1497
- $htmlProduct .= FlycartWoocommerceProduct::get_title($product);
1498
- $htmlProduct .= ' ('.FlycartWoocommerceProduct::get_price_html($product).')<br>';
 
 
 
 
 
 
1499
  }
1500
- $discount = trim($htmlProduct, '<br>');
1501
  }
 
 
1502
  } else if ($discount_type == 'percentage_discount') {
1503
  $discount = $to_discount.' %';
1504
  } else {
@@ -1506,9 +1528,9 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1506
  }
1507
 
1508
  }
1509
- $dataReturn[$id]['title'] = $title;
1510
- $dataReturn[$id]['condition'] = $condition;
1511
- $dataReturn[$id]['discount'] = $discount;
1512
  }
1513
  }
1514
  }
56
 
57
  public $postData;
58
 
59
+ public static $rules_loaded = 0;
60
+ public static $pricingRules;
61
+
62
  /**
63
  * FlycartWooDiscountRulesPricingRules constructor.
64
  */
289
  */
290
  public function getRules($onlyCount = false)
291
  {
292
+ if(self::$rules_loaded) return $this->rules = self::$pricingRules;
293
+
294
  $posts = get_posts(array('post_type' => $this->post_type, 'numberposts' => '-1'));
295
  if ($onlyCount) return count($posts);
296
  if (isset($posts) && count($posts) > 0) {
299
  }
300
  $this->rules = $posts;
301
  }
302
+ self::$rules_loaded = 1;
303
+ self::$pricingRules = $posts;
304
  return $posts;
305
  }
306
 
962
  $discount_product_option = isset($range->discount_product_option) ? $range->discount_product_option : 'all';
963
  $productIds = isset($range->discount_product) ? $range->discount_product : array();
964
  $productIds = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($productIds);
965
+ if($discount_product_option == 'any_cheapest_from_all'){
966
+ $productCheapest = $this->getCheapestProductFromCart($productIds, 1);
967
+ if(!empty($productCheapest)){
968
+ $adjustment = array ( 'price_discount' => $productCheapest['percent'], 'product_ids' => array($productCheapest['product']) ) ;
969
+ }
970
+ } else if($discount_product_option == 'any_cheapest'){
971
  $productCheapest = $this->getCheapestProductFromCart($productIds);
972
  if(!empty($productCheapest)){
973
  $adjustment = array ( 'price_discount' => $productCheapest['percent'], 'product_ids' => array($productCheapest['product']) ) ;
999
  /**
1000
  * Get cheapest product
1001
  * */
1002
+ public function getCheapestProductFromCart($products, $all = 0){
1003
+ if(!$all){
1004
+ if(empty($products)) return array();
1005
+ }
1006
  $cheapestProductValue = 0;
1007
  $cart = FlycartWoocommerceCart::get_cart();
1008
  foreach ($cart as $cart_item_key => $values) {
1009
  $_product = $values['data'];
1010
  $productId = FlycartWoocommerceProduct::get_id($_product);
1011
+ if(!in_array($productId, $products) && !$all) continue;
1012
+
1013
+ if($cheapestProductValue == 0){
1014
+ $cheapestProductValue = FlycartWoocommerceProduct::get_price($_product);
1015
+ $cheapestProduct = FlycartWoocommerceProduct::get_id($_product);
1016
+ $quantity = $values['quantity'];
1017
+ } else if($cheapestProductValue > FlycartWoocommerceProduct::get_price($_product)){
1018
+ $cheapestProductValue = FlycartWoocommerceProduct::get_price($_product);
1019
+ $cheapestProduct = FlycartWoocommerceProduct::get_id($_product);
1020
+ $quantity = $values['quantity'];
1021
  }
1022
  }
1023
  if($cheapestProductValue > 0){
1498
  $discount_type = isset($value->discount_type) ? $value->discount_type : 0;
1499
  $to_discount = isset($value->to_discount) ? $value->to_discount : 0;
1500
  $product_discount = isset($value->discount_product) ? $value->discount_product : array();
1501
+ $discount_product_option = isset($value->discount_product_option) ? $value->discount_product_option : 'all';
1502
  $product_discount = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($product_discount);
1503
  if (isset($base_config['show_discount_title_table'])) {
1504
  }
1505
  $condition = $min .' - ' . $max;
1506
  if ($discount_type == 'product_discount') {
1507
+ $htmlProduct = '';
1508
+ if($discount_product_option == 'any_cheapest_from_all'){
1509
+ $htmlProduct .= esc_html__('Any cheapest one from cart', 'woo-discount-rules');
1510
+ } else {
1511
+ if($discount_product_option == 'any_cheapest'){
1512
+ $htmlProduct .= esc_html__('Any cheapest one of ', 'woo-discount-rules');
1513
+ }
1514
+ if(count($product_discount)){
1515
+ foreach ($product_discount as $product_id){
1516
+ $product = FlycartWoocommerceProduct::wc_get_product($product_id);
1517
+ $htmlProduct .= FlycartWoocommerceProduct::get_title($product);
1518
+ $htmlProduct .= ' ('.FlycartWoocommerceProduct::get_price_html($product).')<br>';
1519
+ }
1520
  }
 
1521
  }
1522
+
1523
+ $discount = trim($htmlProduct, '<br>');
1524
  } else if ($discount_type == 'percentage_discount') {
1525
  $discount = $to_discount.' %';
1526
  } else {
1528
  }
1529
 
1530
  }
1531
+ $dataReturn[$index.$id]['title'] = $title;
1532
+ $dataReturn[$index.$id]['condition'] = $condition;
1533
+ $dataReturn[$index.$id]['discount'] = $discount;
1534
  }
1535
  }
1536
  }
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
5
  Requires at least: 4.4.1
6
  Tested up to: 4.9
7
- Stable tag: 1.4.38
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -238,6 +238,10 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
238
 
239
  == Changelog ==
240
 
 
 
 
 
241
  = 1.4.38 - 09/01/18 =
242
  * Feature - Option to show sale tag in product page
243
 
4
  Tags: woocommerce, discounts, dynamic pricing, Buy One Get One Free, pricing deals, price rules, bulk discounts, advanced discounts
5
  Requires at least: 4.4.1
6
  Tested up to: 4.9
7
+ Stable tag: 1.4.39
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
238
 
239
  == Changelog ==
240
 
241
+ = 1.4.39 - 12/01/18 =
242
+ * Feature - Option: Any one of cheapest from all products for BOGO(Pro version)
243
+ * Fix - Improvement in loading issue in product list page
244
+
245
  = 1.4.38 - 09/01/18 =
246
  * Feature - Option to show sale tag in product page
247
 
view/template/discount-table.php CHANGED
@@ -28,11 +28,11 @@ $base_config = (is_string($data)) ? json_decode($data, true) : (is_array($data)
28
  <?php if (isset($base_config['show_discount_title_table'])) {
29
  if ($base_config['show_discount_title_table'] == 'show') {
30
  ?>
31
- <td><?php echo $table_data_content[$id]['title']; ?></td>
32
  <?php }
33
  } ?>
34
- <td><?php echo $table_data_content[$id]['condition']; ?></td>
35
- <td><?php echo $table_data_content[$id]['discount']; ?></td>
36
  </tr>
37
  <?php }
38
  $have_discount = true;
28
  <?php if (isset($base_config['show_discount_title_table'])) {
29
  if ($base_config['show_discount_title_table'] == 'show') {
30
  ?>
31
+ <td><?php echo $table_data_content[$index.$id]['title']; ?></td>
32
  <?php }
33
  } ?>
34
+ <td><?php echo $table_data_content[$index.$id]['condition']; ?></td>
35
+ <td><?php echo $table_data_content[$index.$id]['discount']; ?></td>
36
  </tr>
37
  <?php }
38
  $have_discount = true;
view/view-pricing-rules.php CHANGED
@@ -388,7 +388,7 @@ $rule_id = (isset($data->ID)) ? $data->ID : 0;
388
  <?php } ?>
389
  </option>
390
  </select></label>
391
- <label>Value
392
  <input type="text"
393
  name="discount_range[<?php echo $fieldIndex; ?>][to_discount]"
394
  class="form-control price_discount_amount"
@@ -398,15 +398,18 @@ $rule_id = (isset($data->ID)) ? $data->ID : 0;
398
  $products_list = (isset($discount->discount_product) ? $discount->discount_product : array());
399
  $discount_product_option = (isset($discount->discount_product_option) ? $discount->discount_product_option : 'all');
400
  ?>
401
- <div class="price_discount_product_list_con hide">
402
  <?php esc_html_e('Apply for', 'woo-discount-rules') ?>
403
- <select class="selectpicker" name="discount_range[<?php echo $fieldIndex; ?>][discount_product_option]">
404
  <option value="all"<?php echo ($discount_product_option == 'all')? ' selected="selected"': '' ?>><?php esc_html_e('All selected', 'woo-discount-rules') ?></option>
405
- <option value="any_cheapest"<?php echo ($discount_product_option == 'any_cheapest')? ' selected="selected"': '' ?>><?php esc_html_e('Any one cheapest', 'woo-discount-rules') ?></option>
 
406
  </select>
407
- <?php
408
- echo FlycartWoocommerceProduct::getProductAjaxSelectBox($products_list, "discount_range[".$fieldIndex."][discount_product]");
409
- ?>
 
 
410
  </div>
411
  </label>
412
 
388
  <?php } ?>
389
  </option>
390
  </select></label>
391
+ <label><span class="hide-for-product-discount">Value</span>
392
  <input type="text"
393
  name="discount_range[<?php echo $fieldIndex; ?>][to_discount]"
394
  class="form-control price_discount_amount"
398
  $products_list = (isset($discount->discount_product) ? $discount->discount_product : array());
399
  $discount_product_option = (isset($discount->discount_product_option) ? $discount->discount_product_option : 'all');
400
  ?>
401
+ <div class="price_discount_product_list_con">
402
  <?php esc_html_e('Apply for', 'woo-discount-rules') ?>
403
+ <select class="selectpicker discount_product_option" name="discount_range[<?php echo $fieldIndex; ?>][discount_product_option]">
404
  <option value="all"<?php echo ($discount_product_option == 'all')? ' selected="selected"': '' ?>><?php esc_html_e('All selected', 'woo-discount-rules') ?></option>
405
+ <option value="any_cheapest"<?php echo ($discount_product_option == 'any_cheapest')? ' selected="selected"': '' ?>><?php esc_html_e('Any one cheapest from selected', 'woo-discount-rules') ?></option>
406
+ <option value="any_cheapest_from_all"<?php echo ($discount_product_option == 'any_cheapest_from_all')? ' selected="selected"': '' ?>><?php esc_html_e('Any one cheapest from all products', 'woo-discount-rules') ?></option>
407
  </select>
408
+ <div class="discount_product_option_list_con hide">
409
+ <?php
410
+ echo FlycartWoocommerceProduct::getProductAjaxSelectBox($products_list, "discount_range[".$fieldIndex."][discount_product]");
411
+ ?>
412
+ </div>
413
  </div>
414
  </label>
415
 
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.38
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.39
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Requires at least: 4.6.1