Discount Rules for WooCommerce - Version 1.6.12

Version Description

  • 21/08/18 =
  • Feature - Option to load ajax strike out for variable products from session storage for the second time(For improve performance while have more combination of variants)
  • Improvement - filter woo_discount_rules_price_rule_check_in_all_selected_attributes to handle add operation for specific attributes
  • Improvement - Settings page UI
  • Fix - In sart rules customer shipping code is not save if we choose as first element
  • Fix - Strike out in cart while displaying price excluding tax and the price entered by including tax
  • Fix - Applying BOGO for multiple product in cart strikeout for guest user
Download this release

Release Info

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

Code changes from version 1.6.11 to 1.6.12

assets/js/app.js CHANGED
@@ -167,11 +167,11 @@ function trigger_woocommerce_tooltip(){
167
  form += '</div>';
168
  form += '<div class="discount_product_option_more_cheapest_con hide">';
169
  form += '<select class="selectpicker discount_product_item_count_type" name="discount_range['+count+'][discount_product_item_type]">';
170
- form += '<option value="static">'+woo_discount_localization.fixed_item_count+'</option>';
171
  form += '<option value="dynamic">'+woo_discount_localization.dynamic_item_count+'</option>';
 
172
  form += '</select>';
173
  form += '<span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.fixed_item_count_tooltip+'"></span>';
174
- form += ' <label class="discount_product_items_count_field"> '+woo_discount_localization.item_count+' <span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.discount_number_of_item_tooltip+'"></span><input type="text" name="discount_range['+count+'][discount_product_items]" class="form-control discount_product_items_count_field" value="" placeholder="'+woo_discount_localization.place_holder_ex_1+'" /></label>';
175
  form += ' <label> '+woo_discount_localization.item_quantity+' <span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.discount_number_of_each_item_tooltip+'"></span><input type="text" name="discount_range['+count+'][discount_product_qty]" class="form-control" value="" placeholder="'+woo_discount_localization.place_holder_ex_1+'" /></label>';
176
  form += '</div>';
177
  form += '<div class="discount_product_option_list_con">';
@@ -850,6 +850,35 @@ function trigger_woocommerce_tooltip(){
850
  });
851
  });
852
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
853
  $('select#enable_free_shipping').on('change', function () {
854
  var option = $(this).val();
855
  if (option == 'woodiscountfree') {
167
  form += '</div>';
168
  form += '<div class="discount_product_option_more_cheapest_con hide">';
169
  form += '<select class="selectpicker discount_product_item_count_type" name="discount_range['+count+'][discount_product_item_type]">';
 
170
  form += '<option value="dynamic">'+woo_discount_localization.dynamic_item_count+'</option>';
171
+ form += '<option value="static">'+woo_discount_localization.fixed_item_count+'</option>';
172
  form += '</select>';
173
  form += '<span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.fixed_item_count_tooltip+'"></span>';
174
+ form += ' <label class="discount_product_items_count_field hide"> '+woo_discount_localization.item_count+' <span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.discount_number_of_item_tooltip+'"></span><input type="text" name="discount_range['+count+'][discount_product_items]" class="form-control discount_product_items_count_field hide" value="" placeholder="'+woo_discount_localization.place_holder_ex_1+'" /></label>';
175
  form += ' <label> '+woo_discount_localization.item_quantity+' <span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.discount_number_of_each_item_tooltip+'"></span><input type="text" name="discount_range['+count+'][discount_product_qty]" class="form-control" value="" placeholder="'+woo_discount_localization.place_holder_ex_1+'" /></label>';
176
  form += '</div>';
177
  form += '<div class="discount_product_option_list_con">';
850
  });
851
  });
852
 
853
+ $('#refresh_wdr_cache').on('click', function (event) {
854
+ event.preventDefault();
855
+ var loader = $('.woo_discount_loader_outer > .woo_discount_loader');
856
+ $.ajax({
857
+ url: ajax_url,
858
+ type: 'POST',
859
+ data: {action: 'resetWDRCache'},
860
+ beforeSend: function() {
861
+ loader.show();
862
+ },
863
+ complete: function() {
864
+ loader.hide();
865
+ },
866
+ success: function (response) {
867
+ //adminNotice();
868
+ jQuery('#woo-admin-message').html(' <div class="notice notice-success is-dismissable"><p>'+response+'</p></div>');
869
+ }
870
+ });
871
+ });
872
+
873
+ $('input[type=radio][name=enable_variable_product_cache]').change(function() {
874
+ if (this.value == '1') {
875
+ $('.enable_variable_product_cache_con').show();
876
+ } else {
877
+ $('.enable_variable_product_cache_con').hide();
878
+ }
879
+ });
880
+ $('input[type=radio][name=enable_variable_product_cache]:checked').trigger('change');
881
+
882
  $('select#enable_free_shipping').on('change', function () {
883
  var option = $(this).val();
884
  if (option == 'woodiscountfree') {
includes/discount-base.php CHANGED
@@ -358,6 +358,17 @@ if (!class_exists('FlycartWooDiscountBase')) {
358
  die();
359
  }
360
 
 
 
 
 
 
 
 
 
 
 
 
361
  /**
362
  * @return array
363
  */
358
  die();
359
  }
360
 
361
+ public function resetWDRCache(){
362
+ $price_discount = $this->getInstance('FlycartWooDiscountRulesPricingRules');
363
+ $result = $price_discount->updateLastUpdateTimeOfRule();
364
+ if($result){
365
+ esc_html_e('Cache cleared successfully', 'woo-discount-rules');
366
+ } else {
367
+ esc_html_e('Failed to clear cache', 'woo-discount-rules');
368
+ }
369
+ die();
370
+ }
371
+
372
  /**
373
  * @return array
374
  */
includes/pricing-rules.php CHANGED
@@ -59,11 +59,14 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
59
  */
60
  public $default_option = 'woo-discount-config';
61
 
 
 
62
  public $postData;
63
 
64
  public $bogo_matches;
65
 
66
  public static $rules_loaded = 0;
 
67
  public static $pricingRules;
68
  public static $product_categories = array();
69
  public static $product_attributes = array();
@@ -283,6 +286,41 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
283
  }
284
  }
285
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  }
287
 
288
  /**
@@ -310,11 +348,11 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
310
  /**
311
  * To Analyzing the Pricing Rules to Apply the Discount in terms of price.
312
  */
313
- public function analyse($woocommerce, $product_page = 0)
314
  {
315
  $this->organizeRules();
316
  $this->applyRules($product_page);
317
- if(!$product_page) $this->initAdjustment();
318
  }
319
 
320
  /**
@@ -1108,7 +1146,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1108
  case 'specific_attribute':
1109
  $notInProductList = !$this->isItemInProductList($rule['product_to_exclude'], $item);
1110
  $is_not_in_exclude_sale_items = !$this->isItemInSaleItems($rule['exclude_sale_items'], $item['data']);
1111
- if ($this->isItemInAttributeList($rule['type']['specific_attribute'], $item) && $notInProductList && $is_not_in_exclude_sale_items) {
1112
  $alreadyExists = 0;
1113
  if(isset($rule['type']['is_cumulative']) && $rule['type']['is_cumulative']){
1114
  $totalQuantityInThisAttribute = $this->getProductQuantityInThisAttribute($rule['type']['specific_attribute'], $rule['product_to_exclude'], $rule['exclude_sale_items'], $id);
@@ -1375,7 +1413,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1375
  }
1376
  }
1377
  if(!$alreadyExists){
1378
- $hasAttribute = $this->isItemInAttributeList($attribute, $cartItem);
1379
  self::$product_attributes[$rule_id][$product_id] = $hasAttribute;
1380
  }
1381
 
@@ -1780,20 +1818,21 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1780
  * @param $product
1781
  * @return bool
1782
  */
1783
- public function isItemInAttributeList($attribute_list, $product)
1784
  {
1785
  $parent_product = FlycartWoocommerceProduct::wc_get_product($product['product_id']);
1786
  $parent_id = FlycartWoocommerceProduct::get_parent_id($parent_product);
1787
  if($parent_id){
1788
  $parent_product = FlycartWoocommerceProduct::wc_get_product($parent_id);
1789
  }
1790
- $status = $this->hasAttributeInParentProduct($parent_product, $attribute_list);
 
1791
  if($status) return true;
1792
 
1793
  if (!isset($product['variation_id']) || !$product['variation_id'] ) return false;
1794
  if (!isset($product['variation']) || empty($product['variation']) ) return false;
1795
  if(empty($attribute_list)) return false;
1796
- $status = FlycartWooDiscountRulesAdvancedHelper::validateCartItemInSelectedAttributes($product['variation'], $attribute_list);
1797
 
1798
  return $status;
1799
  }
@@ -1803,10 +1842,12 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1803
  *
1804
  * @param object $product
1805
  * @param array $attribute_list
 
1806
  * @return boolean
1807
  * */
1808
- protected function hasAttributeInParentProduct($product, $attribute_list){
1809
- $status = 0;
 
1810
  if(FlycartWoocommerceVersion::wcVersion('3.0')){
1811
  $attributes_parent = $product->get_attributes();
1812
  } else {
@@ -1819,11 +1860,9 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1819
  $variation = $attributes->get_variation();
1820
  if(!(int)$variation){
1821
  $options = $attributes->get_options();
 
1822
  if(!empty($options) && is_array($options)){
1823
- if (count(array_intersect($attribute_list, $options)) > 0){
1824
- $status = true;
1825
- break;
1826
- }
1827
  }
1828
  }
1829
  }
@@ -1838,10 +1877,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1838
  $options[] = $attribute_term->term_id;
1839
  }
1840
  if(!empty($options) && is_array($options)){
1841
- if (count(array_intersect($attribute_list, $options)) > 0){
1842
- $status = true;
1843
- break;
1844
- }
1845
  }
1846
  }
1847
  }
@@ -1849,6 +1885,24 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1849
  }
1850
  }
1851
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1852
 
1853
  return $status;
1854
  }
@@ -1994,22 +2048,42 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1994
  public function priceTable()
1995
  {
1996
  global $product;
1997
-
1998
- if($product->is_type(array('variable', 'subscription_variation', 'variable-subscription'))){
1999
- $product_id = FlycartWoocommerceProduct::get_id($product);
2000
- echo '<div class="woo_discount_rules_variant_table" data-id="'.$product_id.'"></div>';
2001
- } else {
2002
- $this->loadPriceTable($product);
 
2003
  }
2004
  }
2005
 
2006
  public function getWooDiscountedPriceTableForVariant(){
 
2007
  if (isset($_REQUEST['id']) && $_REQUEST['id']) {
2008
- $product = FlycartWoocommerceProduct::wc_get_product($_REQUEST['id']);
2009
- $this->loadPriceTable($product);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2010
  exit;
2011
  }
2012
- echo '';exit;
2013
  }
2014
 
2015
  public function loadPriceTable($product)
@@ -2133,7 +2207,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2133
  } elseif ($rule->apply_to == 'specific_attribute') {
2134
  $status = false;
2135
  if(!empty($rule->attribute_to_apply)){
2136
- $status = $this->checkProductMatchedForSpecificAttributes($rule->attribute_to_apply, $product);
2137
  }
2138
 
2139
  //false;
@@ -2208,7 +2282,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2208
  return $discount_range;
2209
  }
2210
 
2211
- protected function checkProductMatchedForSpecificAttributes($attribute_to_apply, $product){
2212
  $status = 0;
2213
  $attribute_to_apply = json_decode($attribute_to_apply);
2214
  $attribute_to_apply = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($attribute_to_apply);
@@ -2216,7 +2290,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2216
  $product_id = FlycartWoocommerceProduct::get_id($product);
2217
  $item['product_id'] = $product_id;
2218
  $item['data'] = $product;
2219
- $status = $this->isItemInAttributeList($attribute_to_apply, $item);
2220
  if($status){
2221
  return true;
2222
  }
@@ -2254,7 +2328,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2254
  $item['variation_id'] = $product_id;
2255
  }
2256
  }
2257
- $status = $this->isItemInAttributeList($attribute_to_apply, $item);
2258
  if($status){
2259
  return true;
2260
  }
@@ -2508,7 +2582,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2508
  *
2509
  * @return bool
2510
  */
2511
- public function initAdjustment()
2512
  {
2513
  if(!FlycartWooDiscountRulesGeneralHelper::haveToApplyTheRules()) return false;
2514
 
@@ -2526,6 +2600,11 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2526
 
2527
  $cart_items = $woocommerce->cart->cart_contents;
2528
 
 
 
 
 
 
2529
  foreach ($cart_items as $cart_item_key => $cart_item) {
2530
  $this->applyAdjustment($cart_item, $cart_item_key, $type);
2531
  }
@@ -2799,7 +2878,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2799
  {
2800
  if(function_exists('is_user_logged_in')) if(!is_user_logged_in()){
2801
  global $woocommerce;
2802
- $this->analyse($woocommerce);
2803
  }
2804
 
2805
  $config = new FlycartWooDiscountBase();
@@ -2834,6 +2913,10 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2834
  if(get_option('woocommerce_tax_display_cart', 'incl') == 'incl'){
2835
  $additional_detail['discount_price'] = FlycartWoocommerceProduct::get_price_including_tax($cart_item['data'], 1, $additional_detail['discount_price']);
2836
  }
 
 
 
 
2837
  }
2838
  $new_price_to_display = $cart_item['woo_discount']['original_price'] - $additional_detail['discount_price'];
2839
  $new_price_to_display = FlycartWoocommerceProduct::wc_price($new_price_to_display);
@@ -2910,7 +2993,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2910
  {
2911
  $run_variation_strike_out_with_ajax = apply_filters('woo_discount_rules_run_variation_strike_out_with_ajax', true, $product);
2912
  if($run_variation_strike_out_with_ajax) {
2913
- if (!(defined('DOING_AJAX') && DOING_AJAX)) {
2914
  $parent_id = FlycartWoocommerceProduct::get_parent_id($product);
2915
  if ($parent_id) {
2916
  return $item_price;
@@ -2957,7 +3040,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2957
 
2958
  $run_variation_strike_out_with_ajax = apply_filters('woo_discount_rules_run_variation_strike_out_with_ajax', true, $product);
2959
  if($run_variation_strike_out_with_ajax){
2960
- if (!(defined('DOING_AJAX') && DOING_AJAX)) {
2961
  $parent_id = FlycartWoocommerceProduct::get_parent_id($product);
2962
  if($parent_id){
2963
  return $item_price;
@@ -3021,6 +3104,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3021
 
3022
  public function getWooDiscountedPriceForVariant(){
3023
  if (isset($_REQUEST['id']) && $_REQUEST['id'] && isset($_REQUEST['price_html']) && $_REQUEST['price_html'] != '') {
 
3024
  $product = FlycartWoocommerceProduct::wc_get_product($_REQUEST['id']);
3025
  $price_html_request = stripslashes($_REQUEST['price_html']);
3026
  $price_html = $this->replaceVisiblePrices($price_html_request, $product);
59
  */
60
  public $default_option = 'woo-discount-config';
61
 
62
+ public $last_update_time_field = 'wdr_price_rule_last_update';
63
+
64
  public $postData;
65
 
66
  public $bogo_matches;
67
 
68
  public static $rules_loaded = 0;
69
+ public static $rules_applied_already = 0;
70
  public static $pricingRules;
71
  public static $product_categories = array();
72
  public static $product_attributes = array();
286
  }
287
  }
288
  }
289
+
290
+ //For update the last update time of rule
291
+ $this->updateLastUpdateTimeOfRule();
292
+ }
293
+
294
+
295
+ /**
296
+ * For update the last update time of rule
297
+ *
298
+ * @return bool
299
+ */
300
+ public function updateLastUpdateTimeOfRule(){
301
+ $now = new DateTime("now", new DateTimeZone('UTC'));
302
+ $time = $now->getTimestamp();
303
+ if (get_option($this->last_update_time_field)) {
304
+ return update_option($this->last_update_time_field, $time);
305
+ } else {
306
+ return add_option($this->last_update_time_field, $time);
307
+ }
308
+ }
309
+
310
+ /**
311
+ * load price from cookie
312
+ *
313
+ * @return int
314
+ */
315
+ public function loadPriceTableFromCookie($cookie_set_time){
316
+ $time = get_option($this->last_update_time_field);
317
+ if (!empty($time) && !empty($cookie_set_time)) {
318
+ if($cookie_set_time >= $time){
319
+ return 1;
320
+ }
321
+ }
322
+
323
+ return 0;
324
  }
325
 
326
  /**
348
  /**
349
  * To Analyzing the Pricing Rules to Apply the Discount in terms of price.
350
  */
351
+ public function analyse($woocommerce, $product_page = 0, $cart_page_strikeout = 0)
352
  {
353
  $this->organizeRules();
354
  $this->applyRules($product_page);
355
+ if(!$product_page) $this->initAdjustment($cart_page_strikeout);
356
  }
357
 
358
  /**
1146
  case 'specific_attribute':
1147
  $notInProductList = !$this->isItemInProductList($rule['product_to_exclude'], $item);
1148
  $is_not_in_exclude_sale_items = !$this->isItemInSaleItems($rule['exclude_sale_items'], $item['data']);
1149
+ if ($this->isItemInAttributeList($rule['type']['specific_attribute'], $item, $id) && $notInProductList && $is_not_in_exclude_sale_items) {
1150
  $alreadyExists = 0;
1151
  if(isset($rule['type']['is_cumulative']) && $rule['type']['is_cumulative']){
1152
  $totalQuantityInThisAttribute = $this->getProductQuantityInThisAttribute($rule['type']['specific_attribute'], $rule['product_to_exclude'], $rule['exclude_sale_items'], $id);
1413
  }
1414
  }
1415
  if(!$alreadyExists){
1416
+ $hasAttribute = $this->isItemInAttributeList($attribute, $cartItem, $rule_id);
1417
  self::$product_attributes[$rule_id][$product_id] = $hasAttribute;
1418
  }
1419
 
1818
  * @param $product
1819
  * @return bool
1820
  */
1821
+ public function isItemInAttributeList($attribute_list, $product, $rule_order_id = 0)
1822
  {
1823
  $parent_product = FlycartWoocommerceProduct::wc_get_product($product['product_id']);
1824
  $parent_id = FlycartWoocommerceProduct::get_parent_id($parent_product);
1825
  if($parent_id){
1826
  $parent_product = FlycartWoocommerceProduct::wc_get_product($parent_id);
1827
  }
1828
+ $status = $this->hasAttributeInParentProduct($parent_product, $attribute_list, apply_filters('woo_discount_rules_price_rule_check_in_all_selected_attributes', false, $rule_order_id));
1829
+
1830
  if($status) return true;
1831
 
1832
  if (!isset($product['variation_id']) || !$product['variation_id'] ) return false;
1833
  if (!isset($product['variation']) || empty($product['variation']) ) return false;
1834
  if(empty($attribute_list)) return false;
1835
+ $status = FlycartWooDiscountRulesAdvancedHelper::validateCartItemInSelectedAttributes($product['variation'], $attribute_list, apply_filters('woo_discount_rules_price_rule_check_in_all_selected_attributes', false, $rule_order_id));
1836
 
1837
  return $status;
1838
  }
1842
  *
1843
  * @param object $product
1844
  * @param array $attribute_list
1845
+ * @param boolean $all_attr
1846
  * @return boolean
1847
  * */
1848
+ protected function hasAttributeInParentProduct($product, $attribute_list, $all_attr = false){
1849
+ $available_attributes = array();
1850
+ $status = false;
1851
  if(FlycartWoocommerceVersion::wcVersion('3.0')){
1852
  $attributes_parent = $product->get_attributes();
1853
  } else {
1860
  $variation = $attributes->get_variation();
1861
  if(!(int)$variation){
1862
  $options = $attributes->get_options();
1863
+
1864
  if(!empty($options) && is_array($options)){
1865
+ $available_attributes = array_merge($available_attributes, $options);
 
 
 
1866
  }
1867
  }
1868
  }
1877
  $options[] = $attribute_term->term_id;
1878
  }
1879
  if(!empty($options) && is_array($options)){
1880
+ $available_attributes = array_merge($available_attributes, $options);
 
 
 
1881
  }
1882
  }
1883
  }
1885
  }
1886
  }
1887
  }
1888
+ if(!empty($available_attributes)){
1889
+ if($all_attr){
1890
+ foreach ($attribute_list as $attribute_list_item){
1891
+ if(!in_array($attribute_list_item, $available_attributes)){
1892
+ $status = false;
1893
+ break;
1894
+ }
1895
+ $status = true;
1896
+ }
1897
+ } else {
1898
+ foreach ($attribute_list as $attribute_list_item){
1899
+ if(in_array($attribute_list_item, $available_attributes)){
1900
+ $status = true;
1901
+ break;
1902
+ }
1903
+ }
1904
+ }
1905
+ }
1906
 
1907
  return $status;
1908
  }
2048
  public function priceTable()
2049
  {
2050
  global $product;
2051
+ if(!empty($product)){
2052
+ if($product->is_type(array('variable', 'subscription_variation', 'variable-subscription'))){
2053
+ $product_id = FlycartWoocommerceProduct::get_id($product);
2054
+ echo '<div class="woo_discount_rules_variant_table" data-id="'.$product_id.'"></div>';
2055
+ } else {
2056
+ $this->loadPriceTable($product);
2057
+ }
2058
  }
2059
  }
2060
 
2061
  public function getWooDiscountedPriceTableForVariant(){
2062
+ $data = array('cookie' => 0, 'html' => '', 'time' => '');
2063
  if (isset($_REQUEST['id']) && $_REQUEST['id']) {
2064
+ $html = '';
2065
+ $cookie_set_time = '';
2066
+ if(isset($_REQUEST['time']) && !empty($_REQUEST['time'])){
2067
+ $cookie_set_time = $_REQUEST['time'];
2068
+ }
2069
+ $loadFromCookie = $this->loadPriceTableFromCookie($cookie_set_time);
2070
+ if(!$loadFromCookie){
2071
+ $product = FlycartWoocommerceProduct::wc_get_product($_REQUEST['id']);
2072
+ ob_start();
2073
+ $this->loadPriceTable($product);
2074
+ $html = ob_get_contents();
2075
+ ob_clean();
2076
+ ob_get_clean();
2077
+ }
2078
+
2079
+ $data['cookie'] = $this->loadPriceTableFromCookie($cookie_set_time);
2080
+ $data['html'] = $html;
2081
+ $now = new DateTime("now", new DateTimeZone('UTC'));
2082
+ $data['time'] = $now->getTimestamp();
2083
+ echo json_encode($data);
2084
  exit;
2085
  }
2086
+ echo json_encode($data);exit;
2087
  }
2088
 
2089
  public function loadPriceTable($product)
2207
  } elseif ($rule->apply_to == 'specific_attribute') {
2208
  $status = false;
2209
  if(!empty($rule->attribute_to_apply)){
2210
+ $status = $this->checkProductMatchedForSpecificAttributes($rule->attribute_to_apply, $product, $index);
2211
  }
2212
 
2213
  //false;
2282
  return $discount_range;
2283
  }
2284
 
2285
+ protected function checkProductMatchedForSpecificAttributes($attribute_to_apply, $product, $rule_order_id){
2286
  $status = 0;
2287
  $attribute_to_apply = json_decode($attribute_to_apply);
2288
  $attribute_to_apply = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($attribute_to_apply);
2290
  $product_id = FlycartWoocommerceProduct::get_id($product);
2291
  $item['product_id'] = $product_id;
2292
  $item['data'] = $product;
2293
+ $status = $this->isItemInAttributeList($attribute_to_apply, $item, $rule_order_id);
2294
  if($status){
2295
  return true;
2296
  }
2328
  $item['variation_id'] = $product_id;
2329
  }
2330
  }
2331
+ $status = $this->isItemInAttributeList($attribute_to_apply, $item, $rule_order_id);
2332
  if($status){
2333
  return true;
2334
  }
2582
  *
2583
  * @return bool
2584
  */
2585
+ public function initAdjustment($cart_page_strikeout = 0)
2586
  {
2587
  if(!FlycartWooDiscountRulesGeneralHelper::haveToApplyTheRules()) return false;
2588
 
2600
 
2601
  $cart_items = $woocommerce->cart->cart_contents;
2602
 
2603
+ if($cart_page_strikeout){
2604
+ if(self::$rules_applied_already) return false;
2605
+ }
2606
+ if(!self::$rules_applied_already) self::$rules_applied_already = 1;
2607
+
2608
  foreach ($cart_items as $cart_item_key => $cart_item) {
2609
  $this->applyAdjustment($cart_item, $cart_item_key, $type);
2610
  }
2878
  {
2879
  if(function_exists('is_user_logged_in')) if(!is_user_logged_in()){
2880
  global $woocommerce;
2881
+ $this->analyse($woocommerce, 0, 1);
2882
  }
2883
 
2884
  $config = new FlycartWooDiscountBase();
2913
  if(get_option('woocommerce_tax_display_cart', 'incl') == 'incl'){
2914
  $additional_detail['discount_price'] = FlycartWoocommerceProduct::get_price_including_tax($cart_item['data'], 1, $additional_detail['discount_price']);
2915
  }
2916
+ } else {
2917
+ if(get_option('woocommerce_tax_display_cart') == 'excl'){
2918
+ $additional_detail['discount_price'] = FlycartWoocommerceProduct::get_price_excluding_tax($cart_item['data'], 1, $additional_detail['discount_price']);
2919
+ }
2920
  }
2921
  $new_price_to_display = $cart_item['woo_discount']['original_price'] - $additional_detail['discount_price'];
2922
  $new_price_to_display = FlycartWoocommerceProduct::wc_price($new_price_to_display);
2993
  {
2994
  $run_variation_strike_out_with_ajax = apply_filters('woo_discount_rules_run_variation_strike_out_with_ajax', true, $product);
2995
  if($run_variation_strike_out_with_ajax) {
2996
+ if (!(defined('WOO_DISCOUNT_DOING_AJAX'))) {
2997
  $parent_id = FlycartWoocommerceProduct::get_parent_id($product);
2998
  if ($parent_id) {
2999
  return $item_price;
3040
 
3041
  $run_variation_strike_out_with_ajax = apply_filters('woo_discount_rules_run_variation_strike_out_with_ajax', true, $product);
3042
  if($run_variation_strike_out_with_ajax){
3043
+ if (!(defined('WOO_DISCOUNT_DOING_AJAX'))) {
3044
  $parent_id = FlycartWoocommerceProduct::get_parent_id($product);
3045
  if($parent_id){
3046
  return $item_price;
3104
 
3105
  public function getWooDiscountedPriceForVariant(){
3106
  if (isset($_REQUEST['id']) && $_REQUEST['id'] && isset($_REQUEST['price_html']) && $_REQUEST['price_html'] != '') {
3107
+ if (!defined('WOO_DISCOUNT_DOING_AJAX')) define('WOO_DISCOUNT_DOING_AJAX', 1);
3108
  $product = FlycartWoocommerceProduct::wc_get_product($_REQUEST['id']);
3109
  $price_html_request = stripslashes($_REQUEST['price_html']);
3110
  $price_html = $this->replaceVisiblePrices($price_html_request, $product);
loader.php CHANGED
@@ -109,6 +109,7 @@ if(!class_exists('FlycartWooDiscountRules')){
109
  add_action('wp_ajax_savePriceRule', array($this->discountBase, 'savePriceRule'));
110
  add_action('wp_ajax_saveCartRule', array($this->discountBase, 'saveCartRule'));
111
  add_action('wp_ajax_saveConfig', array($this->discountBase, 'saveConfig'));
 
112
  add_action('wp_ajax_loadProductSelectBox', array($this->discountBase, 'loadProductSelectBox'));
113
 
114
  add_action('wp_ajax_UpdateStatus', array($this->discountBase, 'updateStatus'));
@@ -144,6 +145,7 @@ if(!class_exists('FlycartWooDiscountRules')){
144
  $script = '<script>';
145
  $script .= 'jQuery( document ).ready( function() {';
146
  $do_product_page_strikeout = $this->discountBase->getConfigData('show_price_discount_on_product_page', 'dont');
 
147
  if($do_product_page_strikeout == 'show' && $runVariationStrikeoutAjax) {
148
  $script .= 'jQuery( ".single_variation_wrap" ).on( "show_variation", function ( event, variation, purchasable ) {';
149
  $script .= ' var container = jQuery(".single_variation .woocommerce-variation-price");';
@@ -168,20 +170,71 @@ if(!class_exists('FlycartWooDiscountRules')){
168
  });';
169
  $script .= ' });';
170
  }
171
- $script .= ' if(jQuery(".woo_discount_rules_variant_table").length > 0){
172
- var p_id = jQuery( ".woo_discount_rules_variant_table" ).attr("data-id");';
173
- $script .= ' jQuery.ajax({
174
- url: woo_discount_rules.ajax_url,
175
- type: "POST",
176
- data: {action: "loadWooDiscountedDiscountTable", id: p_id},
177
- beforeSend: function() {
178
- },
179
- complete: function() {
180
- },
181
- success: function (response) {
182
- jQuery(".woo_discount_rules_variant_table").html(response);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  }
184
- });';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  $script .= ' }';
186
  $script .= '});';
187
  $script .= '</script>';
@@ -264,13 +317,13 @@ if(!class_exists('FlycartWooDiscountRules')){
264
  * */
265
  public function includeScriptAndStyles(){
266
  // Enqueued script with localized data.
267
- wp_register_script( 'woo_discount_rules_site', WOO_DISCOUNT_URI . '/assets/js/woo_discount_rules.js', array(), WOO_DISCOUNT_VERSION );
268
  wp_localize_script('woo_discount_rules_site', 'woo_discount_rules', array(
269
  'home_url' => get_home_url(),
270
  'admin_url' => admin_url(),
271
  'ajax_url' => admin_url('admin-ajax.php')
272
  ));
273
- wp_enqueue_script( 'woo_discount_rules_site' );
274
  }
275
 
276
  /**
109
  add_action('wp_ajax_savePriceRule', array($this->discountBase, 'savePriceRule'));
110
  add_action('wp_ajax_saveCartRule', array($this->discountBase, 'saveCartRule'));
111
  add_action('wp_ajax_saveConfig', array($this->discountBase, 'saveConfig'));
112
+ add_action('wp_ajax_resetWDRCache', array($this->discountBase, 'resetWDRCache'));
113
  add_action('wp_ajax_loadProductSelectBox', array($this->discountBase, 'loadProductSelectBox'));
114
 
115
  add_action('wp_ajax_UpdateStatus', array($this->discountBase, 'updateStatus'));
145
  $script = '<script>';
146
  $script .= 'jQuery( document ).ready( function() {';
147
  $do_product_page_strikeout = $this->discountBase->getConfigData('show_price_discount_on_product_page', 'dont');
148
+ $enable_variable_product_cache = $this->discountBase->getConfigData('enable_variable_product_cache', 0);
149
  if($do_product_page_strikeout == 'show' && $runVariationStrikeoutAjax) {
150
  $script .= 'jQuery( ".single_variation_wrap" ).on( "show_variation", function ( event, variation, purchasable ) {';
151
  $script .= ' var container = jQuery(".single_variation .woocommerce-variation-price");';
170
  });';
171
  $script .= ' });';
172
  }
173
+ if($enable_variable_product_cache){
174
+ $script .= ' var woo_discount_rules_session_storage_id = "woo_discount_rules_session_storage_id_";
175
+ var woo_discount_rules_session_storage_time_id = "woo_discount_rules_session_storage_time_id_";
176
+ const WOO_DISCOUNT_RULES = {
177
+ checkSessionStorageExists: function (id) {
178
+ var name = woo_discount_rules_session_storage_id+id;
179
+ if (sessionStorage.getItem(name) === null) {
180
+ return false;
181
+ }
182
+ return true;
183
+ },
184
+ setSessionStorage: function (id, value) {
185
+ var name = woo_discount_rules_session_storage_id+id;
186
+ sessionStorage.setItem(name, value);
187
+ },
188
+ getSessionStorage: function (id) {
189
+ var name = woo_discount_rules_session_storage_id+id;
190
+ return sessionStorage.getItem(name);
191
+ },
192
+ setSessionStorageTime: function (id, value) {
193
+ var name = woo_discount_rules_session_storage_time_id+id;
194
+ sessionStorage.setItem(name, value);
195
+ },
196
+ getSessionStorageTime: function (id) {
197
+ var name = woo_discount_rules_session_storage_time_id+id;
198
+ return sessionStorage.getItem(name);
199
+ }
200
  }
201
+ ';
202
+ }
203
+
204
+ $script .= ' if(jQuery(".woo_discount_rules_variant_table").length > 0){
205
+ var p_id = jQuery( ".woo_discount_rules_variant_table" ).attr("data-id");';
206
+ if($enable_variable_product_cache) {
207
+ $script .= ' var already_exists = WOO_DISCOUNT_RULES.checkSessionStorageExists(p_id);';
208
+ $script .= ' var last_storage_time = WOO_DISCOUNT_RULES.getSessionStorageTime(p_id);';
209
+ } else {
210
+ $script .= ' var already_exists = 0;';
211
+ $script .= ' var last_storage_time = "";';
212
+ }
213
+ $script .= ' setTimeout(function(){
214
+ jQuery.ajax({
215
+ url: woo_discount_rules.ajax_url,
216
+ type: "POST",
217
+ data: {action: "loadWooDiscountedDiscountTable", id: p_id, loaded: already_exists, time: last_storage_time},
218
+ beforeSend: function() {
219
+ },
220
+ complete: function() {
221
+ },
222
+ success: function (response) {
223
+ responseData = jQuery.parseJSON(response);
224
+ if(responseData.cookie == "1" && already_exists){';
225
+ if($enable_variable_product_cache) {
226
+ $script .= ' jQuery(".woo_discount_rules_variant_table").html(WOO_DISCOUNT_RULES.getSessionStorage(p_id));';
227
+ }
228
+ $script .= ' } else {
229
+ jQuery(".woo_discount_rules_variant_table").html(responseData.html);';
230
+ if($enable_variable_product_cache) {
231
+ $script .= ' WOO_DISCOUNT_RULES.setSessionStorage(p_id, responseData.html);
232
+ WOO_DISCOUNT_RULES.setSessionStorageTime(p_id, responseData.time);';
233
+ }
234
+ $script .= ' }
235
+ }
236
+ });
237
+ }, 1);';
238
  $script .= ' }';
239
  $script .= '});';
240
  $script .= '</script>';
317
  * */
318
  public function includeScriptAndStyles(){
319
  // Enqueued script with localized data.
320
+ wp_register_script( 'woo_discount_rules_site', WOO_DISCOUNT_URI . '/assets/js/woo_discount_rules.js', array('jquery'), WOO_DISCOUNT_VERSION, true );
321
  wp_localize_script('woo_discount_rules_site', 'woo_discount_rules', array(
322
  'home_url' => get_home_url(),
323
  'admin_url' => admin_url(),
324
  'ajax_url' => admin_url('admin-ajax.php')
325
  ));
326
+ wp_enqueue_script( 'woo_discount_rules_site');
327
  }
328
 
329
  /**
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.6.11
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -308,6 +308,14 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
308
 
309
  == Changelog ==
310
 
 
 
 
 
 
 
 
 
311
  = 1.6.11 - 02/08/18 =
312
  * Fix - Duplicate apply of BOGO rules
313
 
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.6.12
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
308
 
309
  == Changelog ==
310
 
311
+ = 1.6.12 - 21/08/18 =
312
+ * Feature - Option to load ajax strike out for variable products from session storage for the second time(For improve performance while have more combination of variants)
313
+ * Improvement - filter woo_discount_rules_price_rule_check_in_all_selected_attributes to handle add operation for specific attributes
314
+ * Improvement - Settings page UI
315
+ * Fix - In sart rules customer shipping code is not save if we choose as first element
316
+ * Fix - Strike out in cart while displaying price excluding tax and the price entered by including tax
317
+ * Fix - Applying BOGO for multiple product in cart strikeout for guest user
318
+
319
  = 1.6.11 - 02/08/18 =
320
  * Fix - Duplicate apply of BOGO rules
321
 
view/settings.php CHANGED
@@ -18,338 +18,394 @@ $isPro = $flycartWooDiscountRulesPurchase->isPro();
18
  <form method="post" id="discount_config">
19
  <div class="col-md-12" align="right">
20
  <br/>
21
- <input type="submit" id="saveConfig" value="<?php esc_html_e('Save', 'woo-discount-rules'); ?>" class="btn btn-success">
22
  <?php echo FlycartWooDiscountRulesGeneralHelper::docsURLHTML('introduction/discount-price-rules-settings', 'settings', 'btn btn-info'); ?>
23
  </div>
24
  <div class="row">
25
- <div class="">
26
- <h4><?php esc_html_e('General Settings', 'woo-discount-rules'); ?></h4>
27
- <hr>
28
- </div>
29
- <div class="">
30
- <div class="row form-group">
31
- <div class="col-md-2">
32
- <label>
33
- <?php esc_html_e('License Key :', 'woo-discount-rules'); ?>
34
- </label>
 
 
 
35
  </div>
36
- <div class="col-md-6">
37
- <input type="text" class="" name="license_key" id="woo-disc-license-key"
38
- value="<?php if (isset($data['license_key'])) echo $data['license_key']; ?>"
39
- placeholder="<?php esc_attr_e('Your Unique License Key', 'woo-discount-rules'); ?>">
40
- <input type="button" id="woo-disc-license-check" value="<?php esc_attr_e('Validate Key', 'woo-discount-rules'); ?>" class="button button-info">
41
- <?php
42
- $verifiedLicense = get_option('woo_discount_rules_verified_key', 0);
43
- if (isset($data['license_key']) && $data['license_key'] != '') {
44
- if ($verifiedLicense) {
45
- ?>
46
- <span class="license-success">&#10004;</span>
 
47
  <?php
48
- } else {
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  ?>
50
- <div class="license-failed notice-message error inline notice-error notice-alt">
51
- <?php esc_html_e('License key seems to be Invalid. Please enter a valid license key', 'woo-discount-rules'); ?>
 
 
52
  </div>
53
- <?php
54
- }
55
- }
56
- ?>
57
- <?php echo FlycartWooDiscountRulesGeneralHelper::docsURLHTML('introduction/license-key-activation', 'license'); ?>
58
- <br>
59
- <div id="woo-disc-license-check-msg">
60
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  </div>
62
  </div>
63
  </div>
64
- <div class="row form-group">
65
- <div class="col-md-2">
66
- <label>
67
- <?php esc_html_e('Enable Bootstrap', 'woo-discount-rules'); ?>
68
- </label>
69
- </div>
70
- <?php $data['enable_bootstrap'] = (isset($data['enable_bootstrap']) ? $data['enable_bootstrap'] : 1); ?>
71
- <div class="col-md-6">
72
- <label><input type="radio" name="enable_bootstrap" value="1" <?php echo ($data['enable_bootstrap'] == 1)? 'checked': '' ?>/> <?php esc_html_e('Yes', 'woo-discount-rules'); ?></label>
73
- <label><input type="radio" name="enable_bootstrap" value="0" <?php echo ($data['enable_bootstrap'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
74
- </div>
75
- </div>
76
- <div class="row form-group">
77
- <div class="col-md-2">
78
- <label>
79
- <?php esc_html_e('Force refresh the cart widget while add and remove item to cart', 'woo-discount-rules'); ?>
80
- </label>
81
- </div>
82
- <?php $data['force_refresh_cart_widget'] = (isset($data['force_refresh_cart_widget']) ? $data['force_refresh_cart_widget'] : 0); ?>
83
- <div class="col-md-6">
84
- <label><input type="radio" name="force_refresh_cart_widget" value="1" <?php echo ($data['force_refresh_cart_widget'] == 1)? 'checked': '' ?>/> <?php esc_html_e('Yes', 'woo-discount-rules'); ?></label>
85
- <label><input type="radio" name="force_refresh_cart_widget" value="0" <?php echo ($data['force_refresh_cart_widget'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
86
- </div>
87
- </div>
88
- <div class="row form-group">
89
- <div class="col-md-2">
90
- <label>
91
- <?php esc_html_e('Disable the rules while have coupon(Third party) in cart', 'woo-discount-rules'); ?>
92
- </label>
93
- </div>
94
- <?php $data['do_not_run_while_have_third_party_coupon'] = (isset($data['do_not_run_while_have_third_party_coupon']) ? $data['do_not_run_while_have_third_party_coupon'] : 0); ?>
95
- <div class="col-md-6">
96
- <label><input type="radio" name="do_not_run_while_have_third_party_coupon" value="1" <?php echo ($data['do_not_run_while_have_third_party_coupon'] == 1)? 'checked': '' ?>/> <?php esc_html_e('Yes', 'woo-discount-rules'); ?></label>
97
- <label><input type="radio" name="do_not_run_while_have_third_party_coupon" value="0" <?php echo ($data['do_not_run_while_have_third_party_coupon'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
98
- </div>
99
- </div>
100
- <div class="row form-group">
101
- <div class="col-md-12">
102
- <h4><?php esc_html_e('Price rules settings', 'woo-discount-rules'); ?></h4>
103
- <hr>
104
- </div>
105
- </div>
106
- <div class="row form-group">
107
- <?php $data['price_setup'] = (isset($data['price_setup']) ? $data['price_setup'] : 'first'); ?>
108
- <div class="col-md-2">
109
- <label>
110
- <?php esc_html_e('Rule Setup for Price:', 'woo-discount-rules'); ?>
111
- </label>
112
- </div>
113
- <div class="col-md-6">
114
- <select class="selectpicker" name="price_setup">
115
- <option <?php if ($data['price_setup'] == 'first') { ?> selected=selected <?php } ?>
116
- value="first" selected="selected"><?php esc_html_e('Apply first matched rule', 'woo-discount-rules'); ?>
117
- </option>
118
- <option
119
- value="all" <?php if (!$pro) { ?> disabled <?php }
120
- if ($data['price_setup'] == 'all') { ?> selected=selected <?php } ?>>
121
- <?php if (!$pro) { ?>
122
- <?php esc_html_e('Apply all matched rules', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
123
- <?php } else { ?>
124
- <?php esc_html_e('Apply all matched rules', 'woo-discount-rules'); ?>
125
- <?php } ?>
126
- </option>
127
- <option
128
- value="biggest" <?php if (!$pro) { ?> disabled <?php }
129
- if ($data['price_setup'] == 'biggest') { ?> selected=selected <?php } ?>>
130
- <?php if (!$pro) { ?>
131
- <?php esc_html_e('Apply biggest discount', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
132
- <?php } else { ?>
133
- <?php esc_html_e('Apply biggest discount', 'woo-discount-rules'); ?>
134
- <?php } ?>
135
- </option>
136
- </select>
137
- </div>
138
- </div>
139
- <div class="row form-group">
140
- <?php $data['show_price_discount_on_product_page'] = (isset($data['show_price_discount_on_product_page']) ? $data['show_price_discount_on_product_page'] : 'dont'); ?>
141
- <div class="col-md-2">
142
- <label>
143
- <?php esc_html_e('Show Price discount on product page :', 'woo-discount-rules'); ?>
144
- </label>
145
- </div>
146
- <div class="col-md-6">
147
- <select class="selectpicker" name="show_price_discount_on_product_page" id="show_price_discount_on_product_page">
148
- <option <?php if ($data['show_price_discount_on_product_page'] == 'show') { ?> selected=selected <?php } ?>
149
- value="show"><?php esc_html_e('Show', 'woo-discount-rules'); ?>
150
- </option>
151
- <option <?php if ($data['show_price_discount_on_product_page'] == 'dont') { ?> selected=selected <?php } ?>
152
- value="dont"><?php esc_html_e("Don't Show", 'woo-discount-rules'); ?>
153
- </option>
154
- </select>
155
- <div class="notice notice-info"><p><?php esc_html_e('It displays only if any rule matches', 'woo-discount-rules'); ?></p></div>
156
- </div>
157
- </div>
158
- <div class="row form-group">
159
- <?php $data['show_sale_tag_on_product_page'] = (isset($data['show_sale_tag_on_product_page']) ? $data['show_sale_tag_on_product_page'] : 'dont'); ?>
160
- <div class="col-md-2">
161
- <label>
162
- <?php esc_html_e('Show Sale tag on product page :', 'woo-discount-rules'); ?>
163
- </label>
164
- </div>
165
- <div class="col-md-6">
166
- <select class="selectpicker" name="show_sale_tag_on_product_page">
167
- <option <?php if ($data['show_sale_tag_on_product_page'] == 'show') { ?> selected=selected <?php } ?>
168
- value="show"><?php esc_html_e('Show', 'woo-discount-rules'); ?>
169
- </option>
170
- <option <?php if ($data['show_sale_tag_on_product_page'] == 'dont') { ?> selected=selected <?php } ?>
171
- value="dont"><?php esc_html_e("Don't Show", 'woo-discount-rules'); ?>
172
- </option>
173
- </select>
174
- <div class="notice notice-info"><p><?php esc_html_e('It displays only if any rule matches', 'woo-discount-rules'); ?></p></div>
175
- </div>
176
- </div>
177
- <div class="row form-group">
178
- <?php $data['show_discount_table'] = (isset($data['show_discount_table']) ? $data['show_discount_table'] : 'show'); ?>
179
- <div class="col-md-2">
180
- <label>
181
- <?php esc_html_e('Discount Table :', 'woo-discount-rules'); ?>
182
- </label>
183
- </div>
184
- <div class="col-md-6">
185
- <select class="selectpicker" name="show_discount_table">
186
- <option <?php if ($data['show_discount_table'] == 'show') { ?> selected=selected <?php } ?>
187
- value="show"><?php esc_html_e('Show', 'woo-discount-rules'); ?>
188
- </option>
189
- <option <?php if ($data['show_discount_table'] == 'dont') { ?> selected=selected <?php } ?>
190
- value="dont"><?php esc_html_e("Don't Show", 'woo-discount-rules'); ?>
191
- </option>
192
- </select>
193
- </div>
194
- </div>
195
- <div class="row form-group">
196
- <?php $data['show_discount_title_table'] = (isset($data['show_discount_title_table']) ? $data['show_discount_title_table'] : 'show'); ?>
197
- <div class="col-md-2">
198
- <label>
199
- <?php esc_html_e('Show Discount Title on Table :', 'woo-discount-rules'); ?>
200
- </label>
201
- </div>
202
- <div class="col-md-6">
203
- <select class="selectpicker" name="show_discount_title_table">
204
- <option <?php if ($data['show_discount_title_table'] == 'show') { ?> selected=selected <?php } ?>
205
- value="show"><?php esc_html_e('Show', 'woo-discount-rules'); ?>
206
- </option>
207
- <option <?php if ($data['show_discount_title_table'] == 'dont') { ?> selected=selected <?php } ?>
208
- value="dont"><?php esc_html_e("Don't Show", 'woo-discount-rules'); ?>
209
- </option>
210
- </select>
211
- </div>
212
- </div>
213
- <div class="row form-group">
214
- <div class="col-md-2">
215
- <label>
216
- <?php esc_html_e('Show strikeout discount in cart item', 'woo-discount-rules'); ?>
217
- </label>
218
- </div>
219
- <?php $data['show_strikeout_in_cart'] = (isset($data['show_strikeout_in_cart']) ? $data['show_strikeout_in_cart'] : 1); ?>
220
- <div class="col-md-6">
221
- <label><input type="radio" name="show_strikeout_in_cart" value="1" <?php echo ($data['show_strikeout_in_cart'] == 1)? 'checked': '' ?>/> <?php esc_html_e('Yes', 'woo-discount-rules'); ?></label>
222
- <label><input type="radio" name="show_strikeout_in_cart" value="0" <?php echo ($data['show_strikeout_in_cart'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
223
- </div>
224
- </div>
225
- <div class="row form-group">
226
- <div class="col-md-2">
227
- <label>
228
- <?php esc_html_e('Auto add free product on coupon applied (For coupon based rules)', 'woo-discount-rules'); ?>
229
- </label>
230
- </div>
231
- <?php $data['add_free_product_on_coupon_applied'] = (isset($data['add_free_product_on_coupon_applied']) ? $data['add_free_product_on_coupon_applied'] : 0); ?>
232
- <div class="col-md-6">
233
- <label><input type="radio" name="add_free_product_on_coupon_applied" value="1" <?php echo ($data['add_free_product_on_coupon_applied'] == 1)? 'checked': '' ?>/> <?php esc_html_e('Yes', 'woo-discount-rules'); ?></label>
234
- <label><input type="radio" name="add_free_product_on_coupon_applied" value="0" <?php echo ($data['add_free_product_on_coupon_applied'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
235
- </div>
236
- </div>
237
- <div class="row form-group">
238
- <div class="col-md-12">
239
- <h4><?php esc_html_e('Cart rules settings', 'woo-discount-rules'); ?></h4>
240
- <hr>
241
- </div>
242
- </div>
243
- <div class="row form-group">
244
- <div class="col-md-2">
245
- <label>
246
- <?php esc_html_e('Coupon Name to be displayed :', 'woo-discount-rules'); ?>
247
- </label>
248
- </div>
249
- <div class="col-md-6">
250
- <input type="text" class="" name="coupon_name"
251
- value="<?php if (isset($data['coupon_name'])) echo $data['coupon_name']; ?>"
252
- placeholder="<?php esc_html_e('Discount Coupon Name', 'woo-discount-rules'); ?>">
253
- </div>
254
- </div>
255
- <div class="row form-group">
256
- <?php $data['cart_setup'] = (isset($data['cart_setup']) ? $data['cart_setup'] : 'first'); ?>
257
- <div class="col-md-2">
258
- <label>
259
- <?php esc_html_e('Rule Setup for Cart:', 'woo-discount-rules'); ?>
260
- </label>
261
- </div>
262
- <div class="col-md-6">
263
- <select class="selectpicker" name="cart_setup">
264
- <option <?php if ($data['cart_setup'] == 'first') { ?> selected=selected <?php } ?>
265
- value="first"><?php esc_html_e('Apply first matched rule', 'woo-discount-rules'); ?>
266
- </option>
267
- <option
268
- value="all" <?php if (!$pro) { ?> disabled <?php }
269
- if ($data['cart_setup'] == 'all') { ?> selected=selected <?php } ?>>
270
- <?php if (!$pro) { ?>
271
- <?php esc_html_e('Apply all matched rules', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
272
- <?php } else { ?>
273
- <?php esc_html_e('Apply all matched rules', 'woo-discount-rules'); ?>
274
- <?php } ?>
275
- </option>
276
- <option
277
- value="biggest" <?php if (!$pro) { ?> disabled <?php }
278
- if ($data['cart_setup'] == 'biggest') { ?> selected=selected <?php } ?>>
279
- <?php if (!$pro) { ?>
280
- <?php esc_html_e('Apply biggest discount', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
281
- <?php } else { ?>
282
- <?php esc_html_e('Apply biggest discount', 'woo-discount-rules'); ?>
283
- <?php } ?>
284
- </option>
285
- </select>
286
  </div>
287
  </div>
288
- <div class="row form-group">
289
- <div class="col-md-2">
290
- <label>
291
- <?php esc_html_e('Enable free shipping option', 'woo-discount-rules'); ?>
292
- </label>
293
- </div>
294
- <?php $data['enable_free_shipping'] = (isset($data['enable_free_shipping']) ? $data['enable_free_shipping'] : "none"); ?>
295
- <div class="col-md-6">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  <?php
297
- if(!$isPro){
298
- esc_html_e('Supported in PRO version', 'woo-discount-rules');
299
  ?>
300
- <select name="enable_free_shipping" id="enable_free_shipping" style="display: none">
301
- <option value="none"><?php esc_html_e('Disabled', 'woo-discount-rules'); ?></option>
302
- </select>
303
- <?php
304
- } else {
305
- ?>
306
- <select class="selectpicker" name="enable_free_shipping" id="enable_free_shipping">
307
- <option <?php if ($data['enable_free_shipping'] == "none") { ?> selected=selected <?php } ?>
308
- value="none"><?php esc_html_e('Disabled', 'woo-discount-rules'); ?>
309
- </option>
310
- <option <?php if ($data['enable_free_shipping'] == "free_shipping") { ?> selected=selected <?php } ?>
311
- value="free_shipping"><?php esc_html_e('Use Woocommerce free shipping', 'woo-discount-rules'); ?>
312
- </option>
313
- <option <?php if ($data['enable_free_shipping'] == "woodiscountfree") { ?> selected=selected <?php } ?>
314
- value="woodiscountfree"><?php esc_html_e('Use Woo-Discount free shipping', 'woo-discount-rules'); ?>
315
- </option>
316
- </select>
317
- <?php
318
- }
319
- ?>
 
 
 
 
 
 
 
 
 
 
320
  </div>
321
  </div>
322
- <?php
323
- if($isPro){
324
- ?>
325
- <div class="row form-group" id="woodiscount_settings_free_shipping_con">
326
- <div class="col-md-2">
327
- <label>
328
- <?php esc_html_e('Free shipping text to be displayed', 'woo-discount-rules'); ?>
329
- </label>
330
  </div>
331
- <div class="col-md-6">
332
- <?php $data['free_shipping_text'] = ((isset($data['free_shipping_text']) && !empty($data['free_shipping_text'])) ? $data['free_shipping_text'] : __( 'Free Shipping', 'woo-discount-rules' )); ?>
333
- <input type="text" class="" name="free_shipping_text"
334
- value="<?php echo $data['free_shipping_text']; ?>"
335
- placeholder="<?php esc_html_e('Free Shipping title', 'woo-discount-rules'); ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  </div>
337
- </div>
338
- <?php } ?>
339
- <div class="row form-group" style="display: none"><!-- Hide this because it is not required after v1.4.36 -->
340
- <div class="col-md-2">
341
- <label>
342
- <?php esc_html_e('Draft', 'woo-discount-rules'); ?>
343
- </label>
344
- </div>
345
- <div class="col-md-6">
346
- <?php
347
- $checked = 0;
348
- if (isset($data['show_draft']) && $data['show_draft'] == 1){
349
- $checked = 1;
350
- } ?>
351
- <input type="checkbox" class="" id="show_draft_1" name="show_draft"
352
- value="1" <?php if($checked){ echo 'checked'; } ?>> <label class="checkbox_label" for="show_draft_1"><?php esc_html_e('Exclude Draft products in product select box.', 'woo-discount-rules'); ?></label>
353
  </div>
354
  </div>
355
  </div>
18
  <form method="post" id="discount_config">
19
  <div class="col-md-12" align="right">
20
  <br/>
21
+ <input type="submit" id="saveConfig" value="<?php esc_html_e('Save', 'woo-discount-rules'); ?>" class="btn btn-success"/>
22
  <?php echo FlycartWooDiscountRulesGeneralHelper::docsURLHTML('introduction/discount-price-rules-settings', 'settings', 'btn btn-info'); ?>
23
  </div>
24
  <div class="row">
25
+ <ul class="nav nav-tabs">
26
+ <li class="active"><a data-toggle="tab" href="#wdr_s_general"><?php esc_html_e('General', 'woo-discount-rules'); ?></a></li>
27
+ <li><a data-toggle="tab" href="#wdr_s_price_rules"><?php esc_html_e('Price rules', 'woo-discount-rules'); ?></a></li>
28
+ <li><a data-toggle="tab" href="#wdr_s_cart_rules"><?php esc_html_e('Cart rules', 'woo-discount-rules'); ?></a></li>
29
+ <li><a data-toggle="tab" href="#wdr_s_performance"><?php esc_html_e('Performance', 'woo-discount-rules'); ?></a></li>
30
+ </ul>
31
+
32
+ <div class="tab-content">
33
+ <div id="wdr_s_general" class="tab-pane fade in active">
34
+ <div class="">
35
+ <br/>
36
+ <h4><?php esc_html_e('General Settings', 'woo-discount-rules'); ?></h4>
37
+ <hr>
38
  </div>
39
+ <div class="">
40
+ <div class="row form-group">
41
+ <div class="col-md-2">
42
+ <label>
43
+ <?php esc_html_e('License Key :', 'woo-discount-rules'); ?>
44
+ </label>
45
+ </div>
46
+ <div class="col-md-6">
47
+ <input type="text" class="" name="license_key" id="woo-disc-license-key"
48
+ value="<?php if (isset($data['license_key'])) echo $data['license_key']; ?>"
49
+ placeholder="<?php esc_attr_e('Your Unique License Key', 'woo-discount-rules'); ?>">
50
+ <input type="button" id="woo-disc-license-check" value="<?php esc_attr_e('Validate Key', 'woo-discount-rules'); ?>" class="button button-info">
51
  <?php
52
+ $verifiedLicense = get_option('woo_discount_rules_verified_key', 0);
53
+ if (isset($data['license_key']) && $data['license_key'] != '') {
54
+ if ($verifiedLicense) {
55
+ ?>
56
+ <span class="license-success">&#10004;</span>
57
+ <?php
58
+ } else {
59
+ ?>
60
+ <div class="license-failed notice-message error inline notice-error notice-alt">
61
+ <?php esc_html_e('License key seems to be Invalid. Please enter a valid license key', 'woo-discount-rules'); ?>
62
+ </div>
63
+ <?php
64
+ }
65
+ }
66
  ?>
67
+ <?php echo FlycartWooDiscountRulesGeneralHelper::docsURLHTML('introduction/license-key-activation', 'license'); ?>
68
+ <br>
69
+ <div id="woo-disc-license-check-msg">
70
+
71
  </div>
72
+ </div>
73
+ </div>
74
+ <div class="row form-group">
75
+ <div class="col-md-2">
76
+ <label>
77
+ <?php esc_html_e('Enable Bootstrap', 'woo-discount-rules'); ?>
78
+ </label>
79
+ </div>
80
+ <?php $data['enable_bootstrap'] = (isset($data['enable_bootstrap']) ? $data['enable_bootstrap'] : 1); ?>
81
+ <div class="col-md-6">
82
+ <label><input type="radio" name="enable_bootstrap" value="1" <?php echo ($data['enable_bootstrap'] == 1)? 'checked': '' ?>/> <?php esc_html_e('Yes', 'woo-discount-rules'); ?></label>
83
+ <label><input type="radio" name="enable_bootstrap" value="0" <?php echo ($data['enable_bootstrap'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
84
+ </div>
85
+ </div>
86
+ <div class="row form-group">
87
+ <div class="col-md-2">
88
+ <label>
89
+ <?php esc_html_e('Force refresh the cart widget while add and remove item to cart', 'woo-discount-rules'); ?>
90
+ </label>
91
+ </div>
92
+ <?php $data['force_refresh_cart_widget'] = (isset($data['force_refresh_cart_widget']) ? $data['force_refresh_cart_widget'] : 0); ?>
93
+ <div class="col-md-6">
94
+ <label><input type="radio" name="force_refresh_cart_widget" value="1" <?php echo ($data['force_refresh_cart_widget'] == 1)? 'checked': '' ?>/> <?php esc_html_e('Yes', 'woo-discount-rules'); ?></label>
95
+ <label><input type="radio" name="force_refresh_cart_widget" value="0" <?php echo ($data['force_refresh_cart_widget'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
96
+ </div>
97
+ </div>
98
+ <div class="row form-group">
99
+ <div class="col-md-2">
100
+ <label>
101
+ <?php esc_html_e('Disable the rules while have coupon(Third party) in cart', 'woo-discount-rules'); ?>
102
+ </label>
103
+ </div>
104
+ <?php $data['do_not_run_while_have_third_party_coupon'] = (isset($data['do_not_run_while_have_third_party_coupon']) ? $data['do_not_run_while_have_third_party_coupon'] : 0); ?>
105
+ <div class="col-md-6">
106
+ <label><input type="radio" name="do_not_run_while_have_third_party_coupon" value="1" <?php echo ($data['do_not_run_while_have_third_party_coupon'] == 1)? 'checked': '' ?>/> <?php esc_html_e('Yes', 'woo-discount-rules'); ?></label>
107
+ <label><input type="radio" name="do_not_run_while_have_third_party_coupon" value="0" <?php echo ($data['do_not_run_while_have_third_party_coupon'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
108
+ </div>
109
  </div>
110
  </div>
111
  </div>
112
+ <div id="wdr_s_price_rules" class="tab-pane fade">
113
+ <div class="">
114
+ <div class="row form-group">
115
+ <div class="col-md-12">
116
+ <br/>
117
+ <h4><?php esc_html_e('Price rules settings', 'woo-discount-rules'); ?></h4>
118
+ <hr>
119
+ </div>
120
+ </div>
121
+ <div class="row form-group">
122
+ <?php $data['price_setup'] = (isset($data['price_setup']) ? $data['price_setup'] : 'first'); ?>
123
+ <div class="col-md-2">
124
+ <label>
125
+ <?php esc_html_e('Rule Setup for Price:', 'woo-discount-rules'); ?>
126
+ </label>
127
+ </div>
128
+ <div class="col-md-6">
129
+ <select class="selectpicker" name="price_setup">
130
+ <option <?php if ($data['price_setup'] == 'first') { ?> selected=selected <?php } ?>
131
+ value="first" selected="selected"><?php esc_html_e('Apply first matched rule', 'woo-discount-rules'); ?>
132
+ </option>
133
+ <option
134
+ value="all" <?php if (!$pro) { ?> disabled <?php }
135
+ if ($data['price_setup'] == 'all') { ?> selected=selected <?php } ?>>
136
+ <?php if (!$pro) { ?>
137
+ <?php esc_html_e('Apply all matched rules', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
138
+ <?php } else { ?>
139
+ <?php esc_html_e('Apply all matched rules', 'woo-discount-rules'); ?>
140
+ <?php } ?>
141
+ </option>
142
+ <option
143
+ value="biggest" <?php if (!$pro) { ?> disabled <?php }
144
+ if ($data['price_setup'] == 'biggest') { ?> selected=selected <?php } ?>>
145
+ <?php if (!$pro) { ?>
146
+ <?php esc_html_e('Apply biggest discount', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
147
+ <?php } else { ?>
148
+ <?php esc_html_e('Apply biggest discount', 'woo-discount-rules'); ?>
149
+ <?php } ?>
150
+ </option>
151
+ </select>
152
+ </div>
153
+ </div>
154
+ <div class="row form-group">
155
+ <?php $data['show_price_discount_on_product_page'] = (isset($data['show_price_discount_on_product_page']) ? $data['show_price_discount_on_product_page'] : 'dont'); ?>
156
+ <div class="col-md-2">
157
+ <label>
158
+ <?php esc_html_e('Show Price discount on product page :', 'woo-discount-rules'); ?>
159
+ </label>
160
+ </div>
161
+ <div class="col-md-6">
162
+ <select class="selectpicker" name="show_price_discount_on_product_page" id="show_price_discount_on_product_page">
163
+ <option <?php if ($data['show_price_discount_on_product_page'] == 'show') { ?> selected=selected <?php } ?>
164
+ value="show"><?php esc_html_e('Show', 'woo-discount-rules'); ?>
165
+ </option>
166
+ <option <?php if ($data['show_price_discount_on_product_page'] == 'dont') { ?> selected=selected <?php } ?>
167
+ value="dont"><?php esc_html_e("Don't Show", 'woo-discount-rules'); ?>
168
+ </option>
169
+ </select>
170
+ <div class="notice notice-info"><p><?php esc_html_e('It displays only if any rule matches', 'woo-discount-rules'); ?></p></div>
171
+ </div>
172
+ </div>
173
+ <div class="row form-group">
174
+ <?php $data['show_sale_tag_on_product_page'] = (isset($data['show_sale_tag_on_product_page']) ? $data['show_sale_tag_on_product_page'] : 'dont'); ?>
175
+ <div class="col-md-2">
176
+ <label>
177
+ <?php esc_html_e('Show Sale tag on product page :', 'woo-discount-rules'); ?>
178
+ </label>
179
+ </div>
180
+ <div class="col-md-6">
181
+ <select class="selectpicker" name="show_sale_tag_on_product_page">
182
+ <option <?php if ($data['show_sale_tag_on_product_page'] == 'show') { ?> selected=selected <?php } ?>
183
+ value="show"><?php esc_html_e('Show', 'woo-discount-rules'); ?>
184
+ </option>
185
+ <option <?php if ($data['show_sale_tag_on_product_page'] == 'dont') { ?> selected=selected <?php } ?>
186
+ value="dont"><?php esc_html_e("Don't Show", 'woo-discount-rules'); ?>
187
+ </option>
188
+ </select>
189
+ <div class="notice notice-info"><p><?php esc_html_e('It displays only if any rule matches', 'woo-discount-rules'); ?></p></div>
190
+ </div>
191
+ </div>
192
+ <div class="row form-group">
193
+ <?php $data['show_discount_table'] = (isset($data['show_discount_table']) ? $data['show_discount_table'] : 'show'); ?>
194
+ <div class="col-md-2">
195
+ <label>
196
+ <?php esc_html_e('Discount Table :', 'woo-discount-rules'); ?>
197
+ </label>
198
+ </div>
199
+ <div class="col-md-6">
200
+ <select class="selectpicker" name="show_discount_table">
201
+ <option <?php if ($data['show_discount_table'] == 'show') { ?> selected=selected <?php } ?>
202
+ value="show"><?php esc_html_e('Show', 'woo-discount-rules'); ?>
203
+ </option>
204
+ <option <?php if ($data['show_discount_table'] == 'dont') { ?> selected=selected <?php } ?>
205
+ value="dont"><?php esc_html_e("Don't Show", 'woo-discount-rules'); ?>
206
+ </option>
207
+ </select>
208
+ </div>
209
+ </div>
210
+ <div class="row form-group">
211
+ <?php $data['show_discount_title_table'] = (isset($data['show_discount_title_table']) ? $data['show_discount_title_table'] : 'show'); ?>
212
+ <div class="col-md-2">
213
+ <label>
214
+ <?php esc_html_e('Show Discount Title on Table :', 'woo-discount-rules'); ?>
215
+ </label>
216
+ </div>
217
+ <div class="col-md-6">
218
+ <select class="selectpicker" name="show_discount_title_table">
219
+ <option <?php if ($data['show_discount_title_table'] == 'show') { ?> selected=selected <?php } ?>
220
+ value="show"><?php esc_html_e('Show', 'woo-discount-rules'); ?>
221
+ </option>
222
+ <option <?php if ($data['show_discount_title_table'] == 'dont') { ?> selected=selected <?php } ?>
223
+ value="dont"><?php esc_html_e("Don't Show", 'woo-discount-rules'); ?>
224
+ </option>
225
+ </select>
226
+ </div>
227
+ </div>
228
+ <div class="row form-group">
229
+ <div class="col-md-2">
230
+ <label>
231
+ <?php esc_html_e('Show strikeout discount in cart item', 'woo-discount-rules'); ?>
232
+ </label>
233
+ </div>
234
+ <?php $data['show_strikeout_in_cart'] = (isset($data['show_strikeout_in_cart']) ? $data['show_strikeout_in_cart'] : 1); ?>
235
+ <div class="col-md-6">
236
+ <label><input type="radio" name="show_strikeout_in_cart" value="1" <?php echo ($data['show_strikeout_in_cart'] == 1)? 'checked': '' ?>/> <?php esc_html_e('Yes', 'woo-discount-rules'); ?></label>
237
+ <label><input type="radio" name="show_strikeout_in_cart" value="0" <?php echo ($data['show_strikeout_in_cart'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
238
+ </div>
239
+ </div>
240
+ <div class="row form-group">
241
+ <div class="col-md-2">
242
+ <label>
243
+ <?php esc_html_e('Auto add free product on coupon applied (For coupon based rules)', 'woo-discount-rules'); ?>
244
+ </label>
245
+ </div>
246
+ <?php $data['add_free_product_on_coupon_applied'] = (isset($data['add_free_product_on_coupon_applied']) ? $data['add_free_product_on_coupon_applied'] : 0); ?>
247
+ <div class="col-md-6">
248
+ <label><input type="radio" name="add_free_product_on_coupon_applied" value="1" <?php echo ($data['add_free_product_on_coupon_applied'] == 1)? 'checked': '' ?>/> <?php esc_html_e('Yes', 'woo-discount-rules'); ?></label>
249
+ <label><input type="radio" name="add_free_product_on_coupon_applied" value="0" <?php echo ($data['add_free_product_on_coupon_applied'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
250
+ </div>
251
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  </div>
253
  </div>
254
+ <div id="wdr_s_cart_rules" class="tab-pane fade">
255
+ <div class="">
256
+ <div class="row form-group">
257
+ <div class="col-md-12">
258
+ <br/>
259
+ <h4><?php esc_html_e('Cart rules settings', 'woo-discount-rules'); ?></h4>
260
+ <hr>
261
+ </div>
262
+ </div>
263
+ <div class="row form-group">
264
+ <div class="col-md-2">
265
+ <label>
266
+ <?php esc_html_e('Coupon Name to be displayed :', 'woo-discount-rules'); ?>
267
+ </label>
268
+ </div>
269
+ <div class="col-md-6">
270
+ <input type="text" class="" name="coupon_name"
271
+ value="<?php if (isset($data['coupon_name'])) echo $data['coupon_name']; ?>"
272
+ placeholder="<?php esc_html_e('Discount Coupon Name', 'woo-discount-rules'); ?>">
273
+ </div>
274
+ </div>
275
+ <div class="row form-group">
276
+ <?php $data['cart_setup'] = (isset($data['cart_setup']) ? $data['cart_setup'] : 'first'); ?>
277
+ <div class="col-md-2">
278
+ <label>
279
+ <?php esc_html_e('Rule Setup for Cart:', 'woo-discount-rules'); ?>
280
+ </label>
281
+ </div>
282
+ <div class="col-md-6">
283
+ <select class="selectpicker" name="cart_setup">
284
+ <option <?php if ($data['cart_setup'] == 'first') { ?> selected=selected <?php } ?>
285
+ value="first"><?php esc_html_e('Apply first matched rule', 'woo-discount-rules'); ?>
286
+ </option>
287
+ <option
288
+ value="all" <?php if (!$pro) { ?> disabled <?php }
289
+ if ($data['cart_setup'] == 'all') { ?> selected=selected <?php } ?>>
290
+ <?php if (!$pro) { ?>
291
+ <?php esc_html_e('Apply all matched rules', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
292
+ <?php } else { ?>
293
+ <?php esc_html_e('Apply all matched rules', 'woo-discount-rules'); ?>
294
+ <?php } ?>
295
+ </option>
296
+ <option
297
+ value="biggest" <?php if (!$pro) { ?> disabled <?php }
298
+ if ($data['cart_setup'] == 'biggest') { ?> selected=selected <?php } ?>>
299
+ <?php if (!$pro) { ?>
300
+ <?php esc_html_e('Apply biggest discount', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
301
+ <?php } else { ?>
302
+ <?php esc_html_e('Apply biggest discount', 'woo-discount-rules'); ?>
303
+ <?php } ?>
304
+ </option>
305
+ </select>
306
+ </div>
307
+ </div>
308
+ <div class="row form-group">
309
+ <div class="col-md-2">
310
+ <label>
311
+ <?php esc_html_e('Enable free shipping option', 'woo-discount-rules'); ?>
312
+ </label>
313
+ </div>
314
+ <?php $data['enable_free_shipping'] = (isset($data['enable_free_shipping']) ? $data['enable_free_shipping'] : "none"); ?>
315
+ <div class="col-md-6">
316
+ <?php
317
+ if(!$isPro){
318
+ esc_html_e('Supported in PRO version', 'woo-discount-rules');
319
+ ?>
320
+ <select name="enable_free_shipping" id="enable_free_shipping" style="display: none">
321
+ <option value="none"><?php esc_html_e('Disabled', 'woo-discount-rules'); ?></option>
322
+ </select>
323
+ <?php
324
+ } else {
325
+ ?>
326
+ <select class="selectpicker" name="enable_free_shipping" id="enable_free_shipping">
327
+ <option <?php if ($data['enable_free_shipping'] == "none") { ?> selected=selected <?php } ?>
328
+ value="none"><?php esc_html_e('Disabled', 'woo-discount-rules'); ?>
329
+ </option>
330
+ <option <?php if ($data['enable_free_shipping'] == "free_shipping") { ?> selected=selected <?php } ?>
331
+ value="free_shipping"><?php esc_html_e('Use Woocommerce free shipping', 'woo-discount-rules'); ?>
332
+ </option>
333
+ <option <?php if ($data['enable_free_shipping'] == "woodiscountfree") { ?> selected=selected <?php } ?>
334
+ value="woodiscountfree"><?php esc_html_e('Use Woo-Discount free shipping', 'woo-discount-rules'); ?>
335
+ </option>
336
+ </select>
337
+ <?php echo FlycartWooDiscountRulesGeneralHelper::docsURLHTML('shipping-based-discounts/free-shipping-cart-based-rule', 'free_shipping');
338
+ }
339
+ ?>
340
+ </div>
341
+ </div>
342
  <?php
343
+ if($isPro){
 
344
  ?>
345
+ <div class="row form-group" id="woodiscount_settings_free_shipping_con">
346
+ <div class="col-md-2">
347
+ <label>
348
+ <?php esc_html_e('Free shipping text to be displayed', 'woo-discount-rules'); ?>
349
+ </label>
350
+ </div>
351
+ <div class="col-md-6">
352
+ <?php $data['free_shipping_text'] = ((isset($data['free_shipping_text']) && !empty($data['free_shipping_text'])) ? $data['free_shipping_text'] : __( 'Free Shipping', 'woo-discount-rules' )); ?>
353
+ <input type="text" class="" name="free_shipping_text"
354
+ value="<?php echo $data['free_shipping_text']; ?>"
355
+ placeholder="<?php esc_html_e('Free Shipping title', 'woo-discount-rules'); ?>">
356
+ </div>
357
+ </div>
358
+ <?php } ?>
359
+ <div class="row form-group" style="display: none"><!-- Hide this because it is not required after v1.4.36 -->
360
+ <div class="col-md-2">
361
+ <label>
362
+ <?php esc_html_e('Draft', 'woo-discount-rules'); ?>
363
+ </label>
364
+ </div>
365
+ <div class="col-md-6">
366
+ <?php
367
+ $checked = 0;
368
+ if (isset($data['show_draft']) && $data['show_draft'] == 1){
369
+ $checked = 1;
370
+ } ?>
371
+ <input type="checkbox" class="" id="show_draft_1" name="show_draft"
372
+ value="1" <?php if($checked){ echo 'checked'; } ?>> <label class="checkbox_label" for="show_draft_1"><?php esc_html_e('Exclude Draft products in product select box.', 'woo-discount-rules'); ?></label>
373
+ </div>
374
+ </div>
375
  </div>
376
  </div>
377
+ <div id="wdr_s_performance" class="tab-pane fade">
378
+ <div class="">
379
+ <div class="row form-group">
380
+ <div class="col-md-12">
381
+ <br/>
382
+ <h4><?php esc_html_e('Performance settings', 'woo-discount-rules'); ?></h4>
383
+ <hr>
384
+ </div>
385
  </div>
386
+ <?php $data['enable_variable_product_cache'] = (isset($data['enable_variable_product_cache']) ? $data['enable_variable_product_cache'] : 0); ?>
387
+ <div class="row form-group">
388
+ <div class="col-md-2">
389
+ <label>
390
+ <?php esc_html_e('Enable cache for variable products table content', 'woo-discount-rules'); ?>
391
+ </label>
392
+ </div>
393
+
394
+ <div class="col-md-6">
395
+ <label><input type="radio" name="enable_variable_product_cache" value="1" <?php echo ($data['enable_variable_product_cache'] == 1)? 'checked': '' ?>/> <?php esc_html_e('Yes', 'woo-discount-rules'); ?></label>
396
+ <label><input type="radio" name="enable_variable_product_cache" value="0" <?php echo ($data['enable_variable_product_cache'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
397
+ </div>
398
+ </div>
399
+ <div class="row form-group enable_variable_product_cache_con">
400
+ <div class="col-md-2">
401
+ <label>
402
+ <?php esc_html_e('Clear cache', 'woo-discount-rules'); ?>
403
+ </label>
404
+ </div>
405
+ <div class="col-md-6">
406
+ <input type="button" id="refresh_wdr_cache" value="<?php esc_attr_e('Clear cache', 'woo-discount-rules'); ?>" class="btn btn-warning">
407
+ </div>
408
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
  </div>
410
  </div>
411
  </div>
view/view-cart-rules.php CHANGED
@@ -145,7 +145,6 @@ $do_not_run_while_have_third_party_coupon = $woo_settings->getConfigData('do_not
145
  $type = $rule_type;
146
  }
147
  }
148
-
149
  // Dummy Entry for One Rule at starting.
150
  // Note : Must having at least one rule on starting.
151
  $rule = (!is_null($rule) ? $rule : array(0 => '1'));
@@ -310,7 +309,7 @@ $do_not_run_while_have_third_party_coupon = $woo_settings->getConfigData('do_not
310
  <?php } ?>
311
  </option>
312
  <option
313
- <?php if (!$pro) { ?> disabled <?php } else { ?> value="customer_shipping_zip" <?php
314
  }
315
  if ($type == 'customer_shipping_zip_code') { ?> selected=selected <?php } ?>>
316
  <?php if (!$pro) { ?>
145
  $type = $rule_type;
146
  }
147
  }
 
148
  // Dummy Entry for One Rule at starting.
149
  // Note : Must having at least one rule on starting.
150
  $rule = (!is_null($rule) ? $rule : array(0 => '1'));
309
  <?php } ?>
310
  </option>
311
  <option
312
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="customer_shipping_zip_code" <?php
313
  }
314
  if ($type == 'customer_shipping_zip_code') { ?> selected=selected <?php } ?>>
315
  <?php if (!$pro) { ?>
view/view-pricing-rules.php CHANGED
@@ -667,8 +667,8 @@ $do_not_run_while_have_third_party_coupon = $woo_settings->getConfigData('do_not
667
  $discount_product_item_type = (isset($discount->discount_product_item_type) ? $discount->discount_product_item_type : 'static');
668
  ?>
669
  <select class="selectpicker discount_product_item_count_type" name="discount_range[<?php echo $fieldIndex; ?>][discount_product_item_type]">
670
- <option value="static"<?php echo ($discount_product_item_type == 'static')? ' selected="selected"': '' ?>><?php esc_html_e('Fixed item count', 'woo-discount-rules') ?></option>
671
  <option value="dynamic"<?php echo ($discount_product_item_type == 'dynamic')? ' selected="selected"': '' ?>><?php esc_html_e('Dynamic item count', 'woo-discount-rules') ?></option>
 
672
  </select>
673
  <span class="woocommerce-help-tip" data-tip="<?php esc_attr_e('Fixed item count - You need to provide item count manually. Dynamic item count - System will choose dynamically based on cart', 'woo-discount-rules'); ?>"></span>
674
  <label class="discount_product_items_count_field"><?php esc_html_e('Item count', 'woo-discount-rules'); ?> <span class="woocommerce-help-tip" data-tip="<?php esc_attr_e('Discount for number of item(s) in cart', 'woo-discount-rules'); ?>"></span>
667
  $discount_product_item_type = (isset($discount->discount_product_item_type) ? $discount->discount_product_item_type : 'static');
668
  ?>
669
  <select class="selectpicker discount_product_item_count_type" name="discount_range[<?php echo $fieldIndex; ?>][discount_product_item_type]">
 
670
  <option value="dynamic"<?php echo ($discount_product_item_type == 'dynamic')? ' selected="selected"': '' ?>><?php esc_html_e('Dynamic item count', 'woo-discount-rules') ?></option>
671
+ <option value="static"<?php echo ($discount_product_item_type == 'static')? ' selected="selected"': '' ?>><?php esc_html_e('Fixed item count', 'woo-discount-rules') ?></option>
672
  </select>
673
  <span class="woocommerce-help-tip" data-tip="<?php esc_attr_e('Fixed item count - You need to provide item count manually. Dynamic item count - System will choose dynamically based on cart', 'woo-discount-rules'); ?>"></span>
674
  <label class="discount_product_items_count_field"><?php esc_html_e('Item count', 'woo-discount-rules'); ?> <span class="woocommerce-help-tip" data-tip="<?php esc_attr_e('Discount for number of item(s) in cart', 'woo-discount-rules'); ?>"></span>
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.6.11
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.6.12
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/