Discount Rules for WooCommerce - Version 2.1.0

Version Description

  • 13/08/20 =
  • Fix - Fatal error when WooCommerce is deactivated.
  • Fix - Displays only 10 item in sale page for attribute based rules.
  • Fix - Disable strikeout if option is disabled for variable products.
  • Fix - PHP 7.x warnings.
  • Fix - Timeout warnings while checking for update.
  • Fix - Warning while having grouped product.
  • Improvement - Report based on cart quantities.
  • Improvement - Added Aelia Currency Switcher Compatible.
  • Improvement - Removed create collate while create table.
  • Improvement - Privilege and CSRF check for all requests.
  • Improvement - Choose free shipping as default only when applicable.
Download this release

Release Info

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

Code changes from version 2.0.2 to 2.1.0

common.php CHANGED
@@ -2,58 +2,64 @@
2
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
3
 
4
  add_action('wp_ajax_awdr_auto_install_pro_plugin', function (){
5
- FlycartWooDiscountRulesExistingPROUpdater::installProPlugin();
6
- exit;
 
 
 
 
7
  });
8
  add_action('wp_ajax_awdr_switch_version', function (){
9
  $version = isset($_REQUEST['version'])? $_REQUEST['version']: '';
10
  $page = isset($_REQUEST['page'])? $_REQUEST['page']: '';
11
  $return['status'] = false;
12
  $return['message'] = esc_html__('Invalid request', WDR_TEXT_DOMAIN);
13
- if($version !== '' && $page !== ''){
14
- $url = admin_url('admin.php?page=' . $page . '&awdr_switch_plugin_to=' . $version);
15
- $do_switch = true;
16
- if (!isAWDREnvironmentCompatible()) {
17
- $return['message'] = __('Discount Rules 2.0 requires minimum PHP version of ', WDR_TEXT_DOMAIN) . ' ' . WDR_REQUIRED_PHP_VERSION;
18
- wp_send_json_success($return);
19
- }
20
- if (!isAWDRWooCompatible()) {
21
- $return['message'] = __('Discount Rules 2.0 requires at least Woocommerce', WDR_TEXT_DOMAIN) . ' ' . WDR_WC_REQUIRED_VERSION;
22
- wp_send_json_success($return);
23
- }
24
- if (defined('WDR_BACKWARD_COMPATIBLE')) {
25
- if(WDR_BACKWARD_COMPATIBLE == true){
26
- if ($version == "v2") {
27
- if (!defined('WDR_PRO')) {
28
- $do_switch = false;
29
- }
30
- }
31
  }
32
- }
33
- if($do_switch){
34
- $return['status'] = true;
35
- $return['message'] = '';
36
- $return['url'] = $url;
37
- } else {
38
- $has_auto_update = false;
39
- if (!is_multisite()) {
40
- if(class_exists('FlycartWooDiscountRulesExistingPROUpdater')){
41
- if(FlycartWooDiscountRulesExistingPROUpdater::availableAutoInstall()){
42
- $has_auto_update = true;
43
  }
44
  }
45
  }
46
- if($has_auto_update){
47
- $return['type'] = 'auto_install';
48
- $message = __('<p>Since 2.0, you need BOTH Core and Pro (2.0) packages installed and activated.</p>', WDR_TEXT_DOMAIN);
49
- $message .= __('<p><b>Why we made this change?</b></p>', WDR_TEXT_DOMAIN);
50
- $message .= __('<p>This arrangement is to avoid the confusion in the installation and upgrade process. Many users first install the core free version. Then purchase the PRO version and try to install it over the free version. Since both free and pro packages have same names, wordpress asks them to uninstall free and then install pro. As you can see, this is quite confusing for the end users.</p>', WDR_TEXT_DOMAIN);
51
- $message .= __('<p>As a result, starting from 2.0, we now have two packs: 1. Core 2. PRO.</p>', WDR_TEXT_DOMAIN);
52
- $message .= '<p><button type="button" class="awdr_auto_install_pro_plugin btn btn-info">'.__('Download and Install', WDR_TEXT_DOMAIN).'</button></p>';
53
- $return['message'] = $message;
54
  } else {
55
- $return['message'] = __('Since 2.0, you need BOTH Core and Pro (2.0) packages installed and activated. Please download the Pro 2.0 pack from My Downloads page in our site, install and activate it. <a href="https://docs.flycart.org/en/articles/4006520-switching-to-2-0-from-v1-x-versions?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=switch_to_v2" target="_blank">Here is a guide and video tutorial</a>', WDR_TEXT_DOMAIN);
56
- $return['type'] = 'manual_install';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
  }
59
  }
2
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
3
 
4
  add_action('wp_ajax_awdr_auto_install_pro_plugin', function (){
5
+ if (current_user_can( 'manage_woocommerce' )) {
6
+ FlycartWooDiscountRulesExistingPROUpdater::installProPlugin();
7
+ exit;
8
+ } else {
9
+ die(__('Authentication required', WDR_TEXT_DOMAIN));
10
+ }
11
  });
12
  add_action('wp_ajax_awdr_switch_version', function (){
13
  $version = isset($_REQUEST['version'])? $_REQUEST['version']: '';
14
  $page = isset($_REQUEST['page'])? $_REQUEST['page']: '';
15
  $return['status'] = false;
16
  $return['message'] = esc_html__('Invalid request', WDR_TEXT_DOMAIN);
17
+ if (current_user_can( 'manage_woocommerce' )) {
18
+ if($version !== '' && $page !== ''){
19
+ $url = admin_url('admin.php?page=' . $page . '&awdr_switch_plugin_to=' . $version);
20
+ $do_switch = true;
21
+ if (!isAWDREnvironmentCompatible()) {
22
+ $return['message'] = __('Discount Rules 2.0 requires minimum PHP version of ', WDR_TEXT_DOMAIN) . ' ' . WDR_REQUIRED_PHP_VERSION;
23
+ wp_send_json_success($return);
 
 
 
 
 
 
 
 
 
 
 
24
  }
25
+ if (!isAWDRWooCompatible()) {
26
+ $return['message'] = __('Discount Rules 2.0 requires at least Woocommerce', WDR_TEXT_DOMAIN) . ' ' . WDR_WC_REQUIRED_VERSION;
27
+ wp_send_json_success($return);
28
+ }
29
+ if (defined('WDR_BACKWARD_COMPATIBLE')) {
30
+ if(WDR_BACKWARD_COMPATIBLE == true){
31
+ if ($version == "v2") {
32
+ if (!defined('WDR_PRO')) {
33
+ $do_switch = false;
34
+ }
 
35
  }
36
  }
37
  }
38
+ if($do_switch){
39
+ $return['status'] = true;
40
+ $return['message'] = '';
41
+ $return['url'] = $url;
 
 
 
 
42
  } else {
43
+ $has_auto_update = false;
44
+ if (!is_multisite()) {
45
+ if(class_exists('FlycartWooDiscountRulesExistingPROUpdater')){
46
+ if(FlycartWooDiscountRulesExistingPROUpdater::availableAutoInstall()){
47
+ $has_auto_update = true;
48
+ }
49
+ }
50
+ }
51
+ if($has_auto_update){
52
+ $return['type'] = 'auto_install';
53
+ $message = __('<p>Since 2.0, you need BOTH Core and Pro (2.0) packages installed and activated.</p>', WDR_TEXT_DOMAIN);
54
+ $message .= __('<p><b>Why we made this change?</b></p>', WDR_TEXT_DOMAIN);
55
+ $message .= __('<p>This arrangement is to avoid the confusion in the installation and upgrade process. Many users first install the core free version. Then purchase the PRO version and try to install it over the free version. Since both free and pro packages have same names, wordpress asks them to uninstall free and then install pro. As you can see, this is quite confusing for the end users.</p>', WDR_TEXT_DOMAIN);
56
+ $message .= __('<p>As a result, starting from 2.0, we now have two packs: 1. Core 2. PRO.</p>', WDR_TEXT_DOMAIN);
57
+ $message .= '<p><button type="button" class="awdr_auto_install_pro_plugin btn btn-info">'.__('Download and Install', WDR_TEXT_DOMAIN).'</button></p>';
58
+ $return['message'] = $message;
59
+ } else {
60
+ $return['message'] = __('Since 2.0, you need BOTH Core and Pro (2.0) packages installed and activated. Please download the Pro 2.0 pack from My Downloads page in our site, install and activate it. <a href="https://docs.flycart.org/en/articles/4006520-switching-to-2-0-from-v1-x-versions?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=switch_to_v2" target="_blank">Here is a guide and video tutorial</a>', WDR_TEXT_DOMAIN);
61
+ $return['type'] = 'manual_install';
62
+ }
63
  }
64
  }
65
  }
i18n/languages/woo-discount-rules.pot CHANGED
@@ -12,29 +12,34 @@ msgstr ""
12
  "X-Generator: Loco https://localise.biz/\n"
13
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;"
14
 
15
- #: common.php:12
 
 
 
 
 
16
  msgid "Invalid request"
17
  msgstr ""
18
 
19
- #: common.php:17
20
  msgid "Discount Rules 2.0 requires minimum PHP version of "
21
  msgstr ""
22
 
23
- #: common.php:21
24
  msgid "Discount Rules 2.0 requires at least Woocommerce"
25
  msgstr ""
26
 
27
- #: common.php:48
28
  msgid ""
29
  "<p>Since 2.0, you need BOTH Core and Pro (2.0) packages installed and "
30
  "activated.</p>"
31
  msgstr ""
32
 
33
- #: common.php:49
34
  msgid "<p><b>Why we made this change?</b></p>"
35
  msgstr ""
36
 
37
- #: common.php:50
38
  msgid ""
39
  "<p>This arrangement is to avoid the confusion in the installation and "
40
  "upgrade process. Many users first install the core free version. Then "
@@ -44,16 +49,16 @@ msgid ""
44
  "end users.</p>"
45
  msgstr ""
46
 
47
- #: common.php:51
48
  msgid ""
49
  "<p>As a result, starting from 2.0, we now have two packs: 1. Core 2. PRO.</p>"
50
  msgstr ""
51
 
52
- #: common.php:52
53
  msgid "Download and Install"
54
  msgstr ""
55
 
56
- #: common.php:55
57
  msgid ""
58
  "Since 2.0, you need BOTH Core and Pro (2.0) packages installed and "
59
  "activated. Please download the Pro 2.0 pack from My Downloads page in our "
@@ -63,45 +68,45 @@ msgid ""
63
  "target=\"_blank\">Here is a guide and video tutorial</a>"
64
  msgstr ""
65
 
66
- #: common.php:77
67
  msgid ""
68
  "Switch to Discount Rules V2 which comes with a better UI and advanced "
69
  "rules. (You can switch back any time. Your settings and rules in V1 are "
70
  "kept as is)"
71
  msgstr ""
72
 
73
- #: common.php:78
74
  msgid "Switch to v2"
75
  msgstr ""
76
 
77
- #: common.php:81
78
  msgid "Would you like to switch to older Woo Discount Rules?"
79
  msgstr ""
80
 
81
- #: common.php:82
82
  msgid "Click here to Switch back"
83
  msgstr ""
84
 
85
- #: common.php:92
86
  msgid "Install 2.0 Pro package"
87
  msgstr ""
88
 
89
- #: common.php:114
90
  msgid "Switch back to Discount Rules 1.x"
91
  msgstr ""
92
 
93
- #: common.php:201
94
  msgid ""
95
  "This plugin can not be activated because it requires minimum PHP version of "
96
  msgstr ""
97
 
98
- #: common.php:204
99
  msgid ""
100
  "Woocommerce must installed and activated in-order to use Advanced woo "
101
  "discount rules!"
102
  msgstr ""
103
 
104
- #: common.php:207
105
  msgid " Advanced woo discount rules requires at least Woocommerce"
106
  msgstr ""
107
 
@@ -195,7 +200,7 @@ msgid "Read Docs"
195
  msgstr ""
196
 
197
  #: v1/helper/general-helper.php:1034 v1/view/view-cart-rules.php:697
198
- #: v1/view/view-pricing-rules.php:433 v2/App/Helpers/Woocommerce.php:1484
199
  msgid "Coupon already exists in WooCommerce. Please select another name"
200
  msgstr ""
201
 
@@ -261,7 +266,7 @@ msgstr ""
261
 
262
  #: v1/includes/advanced/free_shipping_method.php:68
263
  #: v1/view/documentation.php:63 v1/view/settings_cart_rules.php:126
264
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:195
265
  msgid "Free Shipping"
266
  msgstr ""
267
 
@@ -269,7 +274,7 @@ msgstr ""
269
  #: v1/includes/discount-base.php:1063 v1/view/cart-rules.php:133
270
  #: v1/view/pricing-rules.php:163 v1/view/settings_promotion.php:65
271
  #: v1/view/settings_promotion.php:100 v2/App/Controllers/Admin/Settings.php:417
272
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:76
273
  msgid "Enable"
274
  msgstr ""
275
 
@@ -278,8 +283,8 @@ msgid "Enable this shipping."
278
  msgstr ""
279
 
280
  #: v1/includes/advanced/free_shipping_method.php:80
281
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:103
282
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:329
283
  msgid "Title"
284
  msgstr ""
285
 
@@ -305,7 +310,7 @@ msgstr ""
305
  #: v1/view/settings_cart_rules.php:102 v1/view/settings_price_rules.php:169
306
  #: v1/view/settings_promotion.php:22 v1/view/settings_promotion.php:62
307
  #: v1/view/settings_promotion.php:97 v1/view/settings_promotion.php:132
308
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:250
309
  #: v2/App/Views/Admin/Tabs/settings.php:354
310
  msgid "Disabled"
311
  msgstr ""
@@ -541,7 +546,7 @@ msgstr ""
541
 
542
  #: v1/includes/discount-base.php:1060 v1/view/cart-rules.php:185
543
  #: v1/view/pricing-rules.php:215 v1/view/view-pricing-rules.php:971
544
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:302
545
  msgid "Duplicate"
546
  msgstr ""
547
 
@@ -555,7 +560,7 @@ msgstr ""
555
 
556
  #: v1/includes/discount-base.php:1064 v1/view/cart-rules.php:130
557
  #: v1/view/pricing-rules.php:160 v2/App/Controllers/Admin/Settings.php:415
558
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:77
559
  msgid "Disable"
560
  msgstr ""
561
 
@@ -738,8 +743,8 @@ msgstr ""
738
  #: v1/includes/discount-base.php:1103 v1/view/cart-rules.php:114
739
  #: v1/view/cart-rules.php:224 v1/view/pricing-rules.php:144
740
  #: v1/view/pricing-rules.php:254 v1/view/view-cart-rules.php:700
741
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:127
742
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:353
743
  msgid "Action"
744
  msgstr ""
745
 
@@ -1006,7 +1011,7 @@ msgid ""
1006
  "defined in WooCommerce -> Attributes. <a href=\"%s\">Read docs</a>.</span>"
1007
  msgstr ""
1008
 
1009
- #: v1/includes/discount-base.php:1237 v2/App/Controllers/ManageDiscount.php:836
1010
  #, php-format
1011
  msgid ""
1012
  "Sorry, it is not possible to apply coupon <b>\"%s\"</b> as you already have "
@@ -1220,7 +1225,7 @@ msgid "Add New Rule"
1220
  msgstr ""
1221
 
1222
  #: v1/view/cart-rules.php:79 v1/view/pricing-rules.php:109
1223
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:75
1224
  msgid "Bulk Actions"
1225
  msgstr ""
1226
 
@@ -1237,7 +1242,7 @@ msgid "Delete rules"
1237
  msgstr ""
1238
 
1239
  #: v1/view/cart-rules.php:84 v1/view/pricing-rules.php:114
1240
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:80
1241
  msgid "Apply"
1242
  msgstr ""
1243
 
@@ -1249,22 +1254,22 @@ msgstr ""
1249
 
1250
  #: v1/view/cart-rules.php:99 v1/view/cart-rules.php:209
1251
  #: v1/view/pricing-rules.php:129 v1/view/pricing-rules.php:239
1252
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:110
1253
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:336
1254
  msgid "Start Date"
1255
  msgstr ""
1256
 
1257
  #: v1/view/cart-rules.php:100 v1/view/cart-rules.php:210
1258
  #: v1/view/pricing-rules.php:130 v1/view/pricing-rules.php:240
1259
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:112
1260
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:338
1261
  msgid "Expired On"
1262
  msgstr ""
1263
 
1264
  #: v1/view/cart-rules.php:101 v1/view/cart-rules.php:211
1265
  #: v1/view/pricing-rules.php:131 v1/view/pricing-rules.php:241
1266
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:125
1267
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:351
1268
  msgid "Status"
1269
  msgstr ""
1270
 
@@ -1280,13 +1285,13 @@ msgid "Order"
1280
  msgstr ""
1281
 
1282
  #: v1/view/cart-rules.php:181 v1/view/pricing-rules.php:211
1283
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:300
1284
  msgid "Edit"
1285
  msgstr ""
1286
 
1287
  #: v1/view/cart-rules.php:192 v1/view/pricing-rules.php:222
1288
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:78
1289
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:305
1290
  msgid "Delete"
1291
  msgstr ""
1292
 
@@ -1427,7 +1432,7 @@ msgstr ""
1427
  #: v1/view/template/discount-table.php:42 v1/view/view-cart-rules.php:756
1428
  #: v1/view/view-pricing-rules.php:708 v2/App/Controllers/Admin/Settings.php:442
1429
  #: v2/App/Views/Admin/Rules/Discounts/Bulk.php:59
1430
- #: v2/App/Views/Admin/Rules/Manage.php:191
1431
  msgid "Discount"
1432
  msgstr ""
1433
 
@@ -1965,64 +1970,64 @@ msgstr ""
1965
  msgid "Sale!"
1966
  msgstr ""
1967
 
1968
- #: v1/view/template/sidebar.php:7 v2/App/Views/Admin/Tabs/DiscountRule.php:386
1969
  msgid "Looking for more features? Upgrade to PRO"
1970
  msgstr ""
1971
 
1972
- #: v1/view/template/sidebar.php:19 v2/App/Views/Admin/Tabs/DiscountRule.php:391
1973
  msgid "With PRO version, you can create:"
1974
  msgstr ""
1975
 
1976
- #: v1/view/template/sidebar.php:20 v2/App/Views/Admin/Tabs/DiscountRule.php:392
1977
  msgid "- Categories based discounts"
1978
  msgstr ""
1979
 
1980
- #: v1/view/template/sidebar.php:21 v2/App/Views/Admin/Tabs/DiscountRule.php:393
1981
  msgid "- User roles based discounts"
1982
  msgstr ""
1983
 
1984
- #: v1/view/template/sidebar.php:22 v2/App/Views/Admin/Tabs/DiscountRule.php:394
1985
  msgid "- Buy One Get One Free deals"
1986
  msgstr ""
1987
 
1988
- #: v1/view/template/sidebar.php:23 v2/App/Views/Admin/Tabs/DiscountRule.php:395
1989
  msgid "- Buy X Get Y deals"
1990
  msgstr ""
1991
 
1992
- #: v1/view/template/sidebar.php:24 v2/App/Views/Admin/Tabs/DiscountRule.php:396
1993
  #, php-format
1994
  msgid "- Buy 2, get 1 at 50% discount"
1995
  msgstr ""
1996
 
1997
- #: v1/view/template/sidebar.php:25 v2/App/Views/Admin/Tabs/DiscountRule.php:397
1998
  msgid "- Buy 3 for $10 (Package / Bundle [Set] Discount)"
1999
  msgstr ""
2000
 
2001
- #: v1/view/template/sidebar.php:26 v2/App/Views/Admin/Tabs/DiscountRule.php:398
2002
  msgid "- Different discounts with one coupon code"
2003
  msgstr ""
2004
 
2005
- #: v1/view/template/sidebar.php:27 v2/App/Views/Admin/Tabs/DiscountRule.php:399
2006
  msgid "- Purchase history based discounts"
2007
  msgstr ""
2008
 
2009
- #: v1/view/template/sidebar.php:28 v2/App/Views/Admin/Tabs/DiscountRule.php:400
2010
  msgid "- Free product / gift"
2011
  msgstr ""
2012
 
2013
- #: v1/view/template/sidebar.php:29 v2/App/Views/Admin/Tabs/DiscountRule.php:401
2014
  msgid "- Discount for variants"
2015
  msgstr ""
2016
 
2017
- #: v1/view/template/sidebar.php:30 v2/App/Views/Admin/Tabs/DiscountRule.php:402
2018
  msgid "- Conditional discounts"
2019
  msgstr ""
2020
 
2021
- #: v1/view/template/sidebar.php:31 v2/App/Views/Admin/Tabs/DiscountRule.php:403
2022
  msgid "- Fixed cost discounts"
2023
  msgstr ""
2024
 
2025
- #: v1/view/template/sidebar.php:32 v2/App/Views/Admin/Tabs/DiscountRule.php:404
2026
  msgid "- Offer fixed price on certain conditions"
2027
  msgstr ""
2028
 
@@ -2058,7 +2063,7 @@ msgid ""
2058
  msgstr ""
2059
 
2060
  #: v1/view/view-cart-rules.php:98 v1/view/view-pricing-rules.php:81
2061
- #: v2/App/Controllers/Admin/Tabs/Statistics.php:35
2062
  msgid "Rule Name"
2063
  msgstr ""
2064
 
@@ -2533,6 +2538,10 @@ msgstr ""
2533
  msgid "Fixed"
2534
  msgstr ""
2535
 
 
 
 
 
2536
  #: v2/App/Compatibility/CompositeProductsBySomewhereWarm.php:51
2537
  msgid "Add compatible for WooCommerce Composite Products"
2538
  msgstr ""
@@ -2549,11 +2558,11 @@ msgstr ""
2549
  msgid "Add compatible for WooCommerce Currency Switcher"
2550
  msgstr ""
2551
 
2552
- #: v2/App/Compatibility/ExtraProductOptionsProByThemeHigh.php:52
2553
  msgid "Add compatible for WooCommerce Extra Product Options"
2554
  msgstr ""
2555
 
2556
- #: v2/App/Compatibility/ExtraProductOptionsProByThemeHigh.php:55
2557
  msgid "Limitation: Strikeout for add-on price and subtotal in product page."
2558
  msgstr ""
2559
 
@@ -2591,7 +2600,7 @@ msgid "Select Values"
2591
  msgstr ""
2592
 
2593
  #: v2/App/Controllers/Admin/Settings.php:418
2594
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:292
2595
  msgid " - (Running)"
2596
  msgstr ""
2597
 
@@ -2683,29 +2692,34 @@ msgstr ""
2683
  #: v2/App/Controllers/Admin/Settings.php:443
2684
  msgid ""
2685
  "Discount - <a href=\"https://docs.flycart.org/en/articles/3914904-bulk-"
2686
- "discounts-tiered-pricing-discounts-discount-rules-2-0\" style=\"font-size: "
2687
- "12px;\" target=\"_blank\">Read Docs</a>"
 
 
2688
  msgstr ""
2689
 
2690
  #: v2/App/Controllers/Admin/Settings.php:444
2691
  msgid ""
2692
  "Discount - <a href=\"https://docs.flycart.org/en/articles/3809899-bundle-set-"
2693
- "discount-discount-rules-2-0\" style=\"font-size: 12px;\" target=\"_blank"
2694
- "\">Read Docs</a>"
 
2695
  msgstr ""
2696
 
2697
  #: v2/App/Controllers/Admin/Settings.php:445
2698
  msgid ""
2699
  "Discount - <a href=\"https://docs.flycart.org/en/articles/3810570-buy-x-get-"
2700
- "y-discount-rules-2-0\" style=\"font-size: 12px;\" target=\"_blank\">Read "
2701
- "Docs</a>"
 
2702
  msgstr ""
2703
 
2704
  #: v2/App/Controllers/Admin/Settings.php:446
2705
  msgid ""
2706
  "Discount - <a href=\"https://docs.flycart.org/en/articles/3810071-buy-one-"
2707
- "get-one-free-buy-x-get-x-discount-rules-2-0\" style=\"font-size: 12px;\" "
2708
- "target=\"_blank\">Read Docs</a>"
 
2709
  msgstr ""
2710
 
2711
  #: v2/App/Controllers/Admin/Settings.php:447
@@ -2952,20 +2966,20 @@ msgstr ""
2952
  msgid "Date"
2953
  msgstr ""
2954
 
2955
- #: v2/App/Controllers/Admin/Tabs/Statistics.php:25
2956
  msgid "Reports"
2957
  msgstr ""
2958
 
2959
- #: v2/App/Controllers/Admin/Tabs/Statistics.php:42
2960
  msgid "All Rules"
2961
  msgstr ""
2962
 
2963
- #: v2/App/Controllers/Admin/Tabs/Statistics.php:43
2964
- #: v2/App/Controllers/Admin/Tabs/Statistics.php:49
2965
  msgid "Rule"
2966
  msgstr ""
2967
 
2968
- #: v2/App/Controllers/Admin/Tabs/Statistics.php:48
2969
  msgid "All Rules (except cart adjustment type)"
2970
  msgstr ""
2971
 
@@ -2980,7 +2994,7 @@ msgstr ""
2980
  msgid "Product"
2981
  msgstr ""
2982
 
2983
- #: v2/App/Controllers/Base.php:194 v2/App/Views/Admin/Tabs/DiscountRule.php:189
2984
  msgid "Product Adjustment"
2985
  msgstr ""
2986
 
@@ -2989,21 +3003,21 @@ msgstr ""
2989
  msgid "Simple Discount"
2990
  msgstr ""
2991
 
2992
- #: v2/App/Controllers/Base.php:200 v2/App/Views/Admin/Tabs/DiscountRule.php:192
2993
  msgid "Cart Adjustment"
2994
  msgstr ""
2995
 
2996
  #: v2/App/Controllers/Base.php:206 v2/App/Controllers/Base.php:207
2997
  #: v2/App/Helpers/ProOptions.php:338
2998
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:198
2999
  msgid "Bulk Discount"
3000
  msgstr ""
3001
 
3002
- #: v2/App/Controllers/ManageDiscount.php:651
3003
  msgid "cart discount"
3004
  msgstr ""
3005
 
3006
- #: v2/App/Controllers/ManageDiscount.php:850
3007
  msgid "Coupon code applied successfully."
3008
  msgstr ""
3009
 
@@ -3083,6 +3097,21 @@ msgid ""
3083
  "Medium, 6 of Product A - Large, then the count will be: 6+4+2 = 12\n"
3084
  msgstr ""
3085
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3086
  #: v2/App/Helpers/Migration.php:133
3087
  #, php-format
3088
  msgid "%s Completed. Please wait.."
@@ -3253,134 +3282,134 @@ msgstr ""
3253
  msgid "discount"
3254
  msgstr ""
3255
 
3256
- #: v2/App/Helpers/Rule.php:1246 v2/App/Helpers/Rule.php:1324
3257
  #: v2/App/Views/Admin/Tabs/ImportExport.php:84
3258
  msgid "Untitled Rule"
3259
  msgstr ""
3260
 
3261
- #: v2/App/Helpers/Woocommerce.php:914
3262
  msgid "Sunday"
3263
  msgstr ""
3264
 
3265
- #: v2/App/Helpers/Woocommerce.php:915
3266
  msgid "Monday"
3267
  msgstr ""
3268
 
3269
- #: v2/App/Helpers/Woocommerce.php:916
3270
  msgid "Tuesday"
3271
  msgstr ""
3272
 
3273
- #: v2/App/Helpers/Woocommerce.php:917
3274
  msgid "Wednesday"
3275
  msgstr ""
3276
 
3277
- #: v2/App/Helpers/Woocommerce.php:918
3278
  msgid "Thursday"
3279
  msgstr ""
3280
 
3281
- #: v2/App/Helpers/Woocommerce.php:919
3282
  msgid "Friday"
3283
  msgstr ""
3284
 
3285
- #: v2/App/Helpers/Woocommerce.php:920
3286
  msgid "Saturday"
3287
  msgstr ""
3288
 
3289
- #: v2/App/Helpers/Woocommerce.php:931
3290
  msgid ""
3291
  "Woocommerce before main content(Archive / Shop / Cat Pages / single product)"
3292
  msgstr ""
3293
 
3294
- #: v2/App/Helpers/Woocommerce.php:932
3295
  msgid "Woocommerce archive description(Archive / Shop / Cat Pages)"
3296
  msgstr ""
3297
 
3298
- #: v2/App/Helpers/Woocommerce.php:933
3299
  msgid "Woocommerce before shop loop(Archive / Shop / Cat Pages)"
3300
  msgstr ""
3301
 
3302
- #: v2/App/Helpers/Woocommerce.php:934
3303
  msgid "Woocommerce after shop loop(Archive / Shop / Cat Pages)"
3304
  msgstr ""
3305
 
3306
- #: v2/App/Helpers/Woocommerce.php:935
3307
  msgid ""
3308
  "Woocommerce after main content(Archive / Shop / Cat Pages / single product)"
3309
  msgstr ""
3310
 
3311
- #: v2/App/Helpers/Woocommerce.php:936 v2/App/Views/Admin/Tabs/settings.php:194
3312
  #: v2/App/Views/Admin/Tabs/settings.php:212
3313
  msgid "Woocommerce before single product"
3314
  msgstr ""
3315
 
3316
- #: v2/App/Helpers/Woocommerce.php:937 v2/App/Views/Admin/Tabs/settings.php:196
3317
  #: v2/App/Views/Admin/Tabs/settings.php:214
3318
  msgid "Woocommerce before single product summary"
3319
  msgstr ""
3320
 
3321
- #: v2/App/Helpers/Woocommerce.php:938 v2/App/Views/Admin/Tabs/settings.php:195
3322
  #: v2/App/Views/Admin/Tabs/settings.php:213
3323
  msgid "Woocommerce after single product summary"
3324
  msgstr ""
3325
 
3326
- #: v2/App/Helpers/Woocommerce.php:939 v2/App/Views/Admin/Tabs/settings.php:193
3327
  #: v2/App/Views/Admin/Tabs/settings.php:211
3328
  msgid "Woocommerce after single product"
3329
  msgstr ""
3330
 
3331
- #: v2/App/Helpers/Woocommerce.php:940
3332
  msgid "Woocommerce before cart"
3333
  msgstr ""
3334
 
3335
- #: v2/App/Helpers/Woocommerce.php:941
3336
  msgid "Woocommerce before cart table"
3337
  msgstr ""
3338
 
3339
- #: v2/App/Helpers/Woocommerce.php:942
3340
  msgid "Woocommerce before cart contents"
3341
  msgstr ""
3342
 
3343
- #: v2/App/Helpers/Woocommerce.php:943
3344
  msgid "Woocommerce cart contents"
3345
  msgstr ""
3346
 
3347
- #: v2/App/Helpers/Woocommerce.php:944
3348
  msgid "Woocommerce after cart contents"
3349
  msgstr ""
3350
 
3351
- #: v2/App/Helpers/Woocommerce.php:945
3352
  msgid "Woocommerce after cart table"
3353
  msgstr ""
3354
 
3355
- #: v2/App/Helpers/Woocommerce.php:946
3356
  msgid "Woocommerce after cart"
3357
  msgstr ""
3358
 
3359
- #: v2/App/Helpers/Woocommerce.php:947
3360
  msgid "Woocommerce before checkout form"
3361
  msgstr ""
3362
 
3363
- #: v2/App/Helpers/Woocommerce.php:949
3364
  msgid "Woocommerce before checkout billing form"
3365
  msgstr ""
3366
 
3367
- #: v2/App/Helpers/Woocommerce.php:950
3368
  msgid "Woocommerce after checkout billing form"
3369
  msgstr ""
3370
 
3371
- #: v2/App/Helpers/Woocommerce.php:951
3372
  msgid "Woocommerce before checkout shipping form"
3373
  msgstr ""
3374
 
3375
- #: v2/App/Helpers/Woocommerce.php:952
3376
  msgid "Woocommerce after checkout shipping form"
3377
  msgstr ""
3378
 
3379
- #: v2/App/Helpers/Woocommerce.php:953
3380
  msgid "Woocommerce before order notes"
3381
  msgstr ""
3382
 
3383
- #: v2/App/Helpers/Woocommerce.php:954
3384
  msgid "Woocommerce after order notes"
3385
  msgstr ""
3386
 
@@ -3556,9 +3585,6 @@ msgstr ""
3556
  #: v2/App/Views/Admin/Rules/DiscountBatch/Main.php:71
3557
  #: v2/App/Views/Admin/Rules/DiscountBatch/Main.php:92
3558
  #: v2/App/Views/Admin/Rules/DiscountBatch/Main.php:126
3559
- #: v2/App/Views/Admin/Tabs/settings.php:413
3560
- #: v2/App/Views/Admin/Tabs/settings.php:422
3561
- #: v2/App/Views/Admin/Tabs/settings.php:485
3562
  msgid ""
3563
  "Unlock this feature by <a href='https://www.flycart.org/products/wordpress/"
3564
  "woocommerce-discount-rules' target='_blank'>Upgrading to Pro</a>"
@@ -3654,8 +3680,8 @@ msgstr ""
3654
  #: v2/App/Views/Admin/Rules/Discounts/Bulk.php:53
3655
  #: v2/App/Views/Admin/Rules/Discounts/Cart.php:24
3656
  #: v2/App/Views/Admin/Rules/Discounts/simple.php:23
3657
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:108
3658
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:334
3659
  msgid "Discount Type"
3660
  msgstr ""
3661
 
@@ -3921,7 +3947,7 @@ msgstr ""
3921
  msgid "Note : You can also exclude products/categories."
3922
  msgstr ""
3923
 
3924
- #: v2/App/Views/Admin/Rules/Manage.php:193
3925
  msgid "Select discount type and its value (percentage/price/fixed price)"
3926
  msgstr ""
3927
 
@@ -3991,90 +4017,90 @@ msgstr ""
3991
  msgid "Skip"
3992
  msgstr ""
3993
 
3994
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:67
3995
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:73
3996
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:83
3997
  msgid "Search Rules"
3998
  msgstr ""
3999
 
4000
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:87
4001
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:372
4002
  msgid "item"
4003
  msgstr ""
4004
 
4005
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:87
4006
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:372
4007
  msgid "items"
4008
  msgstr ""
4009
 
4010
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:117
4011
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:343
4012
  msgid "Language(s)"
4013
  msgstr ""
4014
 
4015
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:149
4016
  msgid "Exclusive"
4017
  msgstr ""
4018
 
4019
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:178
4020
  msgid "Created by: "
4021
  msgstr ""
4022
 
4023
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:178
4024
  #: v2/App/Views/Admin/Tabs/DiscountRule.php:180
 
4025
  msgid " On: "
4026
  msgstr ""
4027
 
4028
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:180
4029
  msgid "Modified by: "
4030
  msgstr ""
4031
 
4032
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:201
4033
  msgid "Set Discount"
4034
  msgstr ""
4035
 
4036
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:204
4037
  msgid "Buy X get X"
4038
  msgstr ""
4039
 
4040
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:207
4041
  msgid "Buy X get Y"
4042
  msgstr ""
4043
 
4044
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:250
4045
  msgid "Enabled"
4046
  msgstr ""
4047
 
4048
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:261
4049
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:275
4050
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:288
4051
  msgid " - ( Not running )"
4052
  msgstr ""
4053
 
4054
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:262
4055
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:276
4056
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:289
4057
  msgid "Rule reached maximum usage limit"
4058
  msgstr ""
4059
 
4060
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:266
4061
  msgid " - ( Will run in future)"
4062
  msgstr ""
4063
 
4064
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:269
4065
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:282
4066
  msgid "Your server current date and time:"
4067
  msgstr ""
4068
 
4069
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:279
4070
  msgid " - ( Not running - validity expired)"
4071
  msgstr ""
4072
 
4073
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:316
4074
  msgid "No rules found."
4075
  msgstr ""
4076
 
4077
- #: v2/App/Views/Admin/Tabs/DiscountRule.php:405
4078
  msgid "Go PRO"
4079
  msgstr ""
4080
 
@@ -4121,15 +4147,15 @@ msgstr ""
4121
  msgid "Custom Range"
4122
  msgstr ""
4123
 
4124
- #: v2/App/Views/Admin/Tabs/Statistics.php:48
4125
  msgid "From: yyyy/mm/dd"
4126
  msgstr ""
4127
 
4128
- #: v2/App/Views/Admin/Tabs/Statistics.php:59
4129
  msgid "To: yyyy/mm/dd"
4130
  msgstr ""
4131
 
4132
- #: v2/App/Views/Admin/Tabs/Statistics.php:79
4133
  msgid "Update Chart"
4134
  msgstr ""
4135
 
@@ -4402,6 +4428,16 @@ msgid ""
4402
  "<b>NOTE:</b> It is a static banner. You can use any content or html here."
4403
  msgstr ""
4404
 
 
 
 
 
 
 
 
 
 
 
4405
  #: v2/App/Views/Admin/Tabs/settings.php:419
4406
  msgid "Banner Content display position"
4407
  msgstr ""
12
  "X-Generator: Loco https://localise.biz/\n"
13
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;"
14
 
15
+ #: common.php:9 v2/App/Controllers/Admin/Tabs/Statistics.php:113
16
+ #: v2/App/Controllers/Admin/WDRAjax.php:51
17
+ msgid "Authentication required"
18
+ msgstr ""
19
+
20
+ #: common.php:16
21
  msgid "Invalid request"
22
  msgstr ""
23
 
24
+ #: common.php:22
25
  msgid "Discount Rules 2.0 requires minimum PHP version of "
26
  msgstr ""
27
 
28
+ #: common.php:26
29
  msgid "Discount Rules 2.0 requires at least Woocommerce"
30
  msgstr ""
31
 
32
+ #: common.php:53
33
  msgid ""
34
  "<p>Since 2.0, you need BOTH Core and Pro (2.0) packages installed and "
35
  "activated.</p>"
36
  msgstr ""
37
 
38
+ #: common.php:54
39
  msgid "<p><b>Why we made this change?</b></p>"
40
  msgstr ""
41
 
42
+ #: common.php:55
43
  msgid ""
44
  "<p>This arrangement is to avoid the confusion in the installation and "
45
  "upgrade process. Many users first install the core free version. Then "
49
  "end users.</p>"
50
  msgstr ""
51
 
52
+ #: common.php:56
53
  msgid ""
54
  "<p>As a result, starting from 2.0, we now have two packs: 1. Core 2. PRO.</p>"
55
  msgstr ""
56
 
57
+ #: common.php:57
58
  msgid "Download and Install"
59
  msgstr ""
60
 
61
+ #: common.php:60
62
  msgid ""
63
  "Since 2.0, you need BOTH Core and Pro (2.0) packages installed and "
64
  "activated. Please download the Pro 2.0 pack from My Downloads page in our "
68
  "target=\"_blank\">Here is a guide and video tutorial</a>"
69
  msgstr ""
70
 
71
+ #: common.php:83
72
  msgid ""
73
  "Switch to Discount Rules V2 which comes with a better UI and advanced "
74
  "rules. (You can switch back any time. Your settings and rules in V1 are "
75
  "kept as is)"
76
  msgstr ""
77
 
78
+ #: common.php:84
79
  msgid "Switch to v2"
80
  msgstr ""
81
 
82
+ #: common.php:87
83
  msgid "Would you like to switch to older Woo Discount Rules?"
84
  msgstr ""
85
 
86
+ #: common.php:88
87
  msgid "Click here to Switch back"
88
  msgstr ""
89
 
90
+ #: common.php:98
91
  msgid "Install 2.0 Pro package"
92
  msgstr ""
93
 
94
+ #: common.php:120
95
  msgid "Switch back to Discount Rules 1.x"
96
  msgstr ""
97
 
98
+ #: common.php:207
99
  msgid ""
100
  "This plugin can not be activated because it requires minimum PHP version of "
101
  msgstr ""
102
 
103
+ #: common.php:210
104
  msgid ""
105
  "Woocommerce must installed and activated in-order to use Advanced woo "
106
  "discount rules!"
107
  msgstr ""
108
 
109
+ #: common.php:213
110
  msgid " Advanced woo discount rules requires at least Woocommerce"
111
  msgstr ""
112
 
200
  msgstr ""
201
 
202
  #: v1/helper/general-helper.php:1034 v1/view/view-cart-rules.php:697
203
+ #: v1/view/view-pricing-rules.php:433 v2/App/Helpers/Woocommerce.php:1492
204
  msgid "Coupon already exists in WooCommerce. Please select another name"
205
  msgstr ""
206
 
266
 
267
  #: v1/includes/advanced/free_shipping_method.php:68
268
  #: v1/view/documentation.php:63 v1/view/settings_cart_rules.php:126
269
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:197
270
  msgid "Free Shipping"
271
  msgstr ""
272
 
274
  #: v1/includes/discount-base.php:1063 v1/view/cart-rules.php:133
275
  #: v1/view/pricing-rules.php:163 v1/view/settings_promotion.php:65
276
  #: v1/view/settings_promotion.php:100 v2/App/Controllers/Admin/Settings.php:417
277
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:77
278
  msgid "Enable"
279
  msgstr ""
280
 
283
  msgstr ""
284
 
285
  #: v1/includes/advanced/free_shipping_method.php:80
286
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:105
287
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:331
288
  msgid "Title"
289
  msgstr ""
290
 
310
  #: v1/view/settings_cart_rules.php:102 v1/view/settings_price_rules.php:169
311
  #: v1/view/settings_promotion.php:22 v1/view/settings_promotion.php:62
312
  #: v1/view/settings_promotion.php:97 v1/view/settings_promotion.php:132
313
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:252
314
  #: v2/App/Views/Admin/Tabs/settings.php:354
315
  msgid "Disabled"
316
  msgstr ""
546
 
547
  #: v1/includes/discount-base.php:1060 v1/view/cart-rules.php:185
548
  #: v1/view/pricing-rules.php:215 v1/view/view-pricing-rules.php:971
549
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:304
550
  msgid "Duplicate"
551
  msgstr ""
552
 
560
 
561
  #: v1/includes/discount-base.php:1064 v1/view/cart-rules.php:130
562
  #: v1/view/pricing-rules.php:160 v2/App/Controllers/Admin/Settings.php:415
563
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:78
564
  msgid "Disable"
565
  msgstr ""
566
 
743
  #: v1/includes/discount-base.php:1103 v1/view/cart-rules.php:114
744
  #: v1/view/cart-rules.php:224 v1/view/pricing-rules.php:144
745
  #: v1/view/pricing-rules.php:254 v1/view/view-cart-rules.php:700
746
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:129
747
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:355
748
  msgid "Action"
749
  msgstr ""
750
 
1011
  "defined in WooCommerce -> Attributes. <a href=\"%s\">Read docs</a>.</span>"
1012
  msgstr ""
1013
 
1014
+ #: v1/includes/discount-base.php:1237 v2/App/Controllers/ManageDiscount.php:847
1015
  #, php-format
1016
  msgid ""
1017
  "Sorry, it is not possible to apply coupon <b>\"%s\"</b> as you already have "
1225
  msgstr ""
1226
 
1227
  #: v1/view/cart-rules.php:79 v1/view/pricing-rules.php:109
1228
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:76
1229
  msgid "Bulk Actions"
1230
  msgstr ""
1231
 
1242
  msgstr ""
1243
 
1244
  #: v1/view/cart-rules.php:84 v1/view/pricing-rules.php:114
1245
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:81
1246
  msgid "Apply"
1247
  msgstr ""
1248
 
1254
 
1255
  #: v1/view/cart-rules.php:99 v1/view/cart-rules.php:209
1256
  #: v1/view/pricing-rules.php:129 v1/view/pricing-rules.php:239
1257
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:112
1258
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:338
1259
  msgid "Start Date"
1260
  msgstr ""
1261
 
1262
  #: v1/view/cart-rules.php:100 v1/view/cart-rules.php:210
1263
  #: v1/view/pricing-rules.php:130 v1/view/pricing-rules.php:240
1264
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:114
1265
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:340
1266
  msgid "Expired On"
1267
  msgstr ""
1268
 
1269
  #: v1/view/cart-rules.php:101 v1/view/cart-rules.php:211
1270
  #: v1/view/pricing-rules.php:131 v1/view/pricing-rules.php:241
1271
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:127
1272
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:353
1273
  msgid "Status"
1274
  msgstr ""
1275
 
1285
  msgstr ""
1286
 
1287
  #: v1/view/cart-rules.php:181 v1/view/pricing-rules.php:211
1288
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:302
1289
  msgid "Edit"
1290
  msgstr ""
1291
 
1292
  #: v1/view/cart-rules.php:192 v1/view/pricing-rules.php:222
1293
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:79
1294
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:307
1295
  msgid "Delete"
1296
  msgstr ""
1297
 
1432
  #: v1/view/template/discount-table.php:42 v1/view/view-cart-rules.php:756
1433
  #: v1/view/view-pricing-rules.php:708 v2/App/Controllers/Admin/Settings.php:442
1434
  #: v2/App/Views/Admin/Rules/Discounts/Bulk.php:59
1435
+ #: v2/App/Views/Admin/Rules/Manage.php:192
1436
  msgid "Discount"
1437
  msgstr ""
1438
 
1970
  msgid "Sale!"
1971
  msgstr ""
1972
 
1973
+ #: v1/view/template/sidebar.php:7 v2/App/Views/Admin/Tabs/DiscountRule.php:389
1974
  msgid "Looking for more features? Upgrade to PRO"
1975
  msgstr ""
1976
 
1977
+ #: v1/view/template/sidebar.php:19 v2/App/Views/Admin/Tabs/DiscountRule.php:394
1978
  msgid "With PRO version, you can create:"
1979
  msgstr ""
1980
 
1981
+ #: v1/view/template/sidebar.php:20 v2/App/Views/Admin/Tabs/DiscountRule.php:395
1982
  msgid "- Categories based discounts"
1983
  msgstr ""
1984
 
1985
+ #: v1/view/template/sidebar.php:21 v2/App/Views/Admin/Tabs/DiscountRule.php:396
1986
  msgid "- User roles based discounts"
1987
  msgstr ""
1988
 
1989
+ #: v1/view/template/sidebar.php:22 v2/App/Views/Admin/Tabs/DiscountRule.php:397
1990
  msgid "- Buy One Get One Free deals"
1991
  msgstr ""
1992
 
1993
+ #: v1/view/template/sidebar.php:23 v2/App/Views/Admin/Tabs/DiscountRule.php:398
1994
  msgid "- Buy X Get Y deals"
1995
  msgstr ""
1996
 
1997
+ #: v1/view/template/sidebar.php:24 v2/App/Views/Admin/Tabs/DiscountRule.php:399
1998
  #, php-format
1999
  msgid "- Buy 2, get 1 at 50% discount"
2000
  msgstr ""
2001
 
2002
+ #: v1/view/template/sidebar.php:25 v2/App/Views/Admin/Tabs/DiscountRule.php:400
2003
  msgid "- Buy 3 for $10 (Package / Bundle [Set] Discount)"
2004
  msgstr ""
2005
 
2006
+ #: v1/view/template/sidebar.php:26 v2/App/Views/Admin/Tabs/DiscountRule.php:401
2007
  msgid "- Different discounts with one coupon code"
2008
  msgstr ""
2009
 
2010
+ #: v1/view/template/sidebar.php:27 v2/App/Views/Admin/Tabs/DiscountRule.php:402
2011
  msgid "- Purchase history based discounts"
2012
  msgstr ""
2013
 
2014
+ #: v1/view/template/sidebar.php:28 v2/App/Views/Admin/Tabs/DiscountRule.php:403
2015
  msgid "- Free product / gift"
2016
  msgstr ""
2017
 
2018
+ #: v1/view/template/sidebar.php:29 v2/App/Views/Admin/Tabs/DiscountRule.php:404
2019
  msgid "- Discount for variants"
2020
  msgstr ""
2021
 
2022
+ #: v1/view/template/sidebar.php:30 v2/App/Views/Admin/Tabs/DiscountRule.php:405
2023
  msgid "- Conditional discounts"
2024
  msgstr ""
2025
 
2026
+ #: v1/view/template/sidebar.php:31 v2/App/Views/Admin/Tabs/DiscountRule.php:406
2027
  msgid "- Fixed cost discounts"
2028
  msgstr ""
2029
 
2030
+ #: v1/view/template/sidebar.php:32 v2/App/Views/Admin/Tabs/DiscountRule.php:407
2031
  msgid "- Offer fixed price on certain conditions"
2032
  msgstr ""
2033
 
2063
  msgstr ""
2064
 
2065
  #: v1/view/view-cart-rules.php:98 v1/view/view-pricing-rules.php:81
2066
+ #: v2/App/Controllers/Admin/Tabs/Statistics.php:36
2067
  msgid "Rule Name"
2068
  msgstr ""
2069
 
2538
  msgid "Fixed"
2539
  msgstr ""
2540
 
2541
+ #: v2/App/Compatibility/AeliaCurrencySwitcherByAelia.php:49
2542
+ msgid "Add compatible for Aelia Currency Switcher"
2543
+ msgstr ""
2544
+
2545
  #: v2/App/Compatibility/CompositeProductsBySomewhereWarm.php:51
2546
  msgid "Add compatible for WooCommerce Composite Products"
2547
  msgstr ""
2558
  msgid "Add compatible for WooCommerce Currency Switcher"
2559
  msgstr ""
2560
 
2561
+ #: v2/App/Compatibility/ExtraProductOptionsProByThemeHigh.php:54
2562
  msgid "Add compatible for WooCommerce Extra Product Options"
2563
  msgstr ""
2564
 
2565
+ #: v2/App/Compatibility/ExtraProductOptionsProByThemeHigh.php:57
2566
  msgid "Limitation: Strikeout for add-on price and subtotal in product page."
2567
  msgstr ""
2568
 
2600
  msgstr ""
2601
 
2602
  #: v2/App/Controllers/Admin/Settings.php:418
2603
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:294
2604
  msgid " - (Running)"
2605
  msgstr ""
2606
 
2692
  #: v2/App/Controllers/Admin/Settings.php:443
2693
  msgid ""
2694
  "Discount - <a href=\"https://docs.flycart.org/en/articles/3914904-bulk-"
2695
+ "discounts-tiered-pricing-discounts-discount-rules-2-0?utm_source=woo-"
2696
+ "discount-rules-v2&utm_campaign=doc&utm_medium=text-"
2697
+ "click&utm_content=bulk_documentation\" style=\"font-size: 12px;\" target="
2698
+ "\"_blank\">Read Docs</a>"
2699
  msgstr ""
2700
 
2701
  #: v2/App/Controllers/Admin/Settings.php:444
2702
  msgid ""
2703
  "Discount - <a href=\"https://docs.flycart.org/en/articles/3809899-bundle-set-"
2704
+ "discount-discount-rules-2-0?utm_source=woo-discount-rules-"
2705
+ "v2&utm_campaign=doc&utm_medium=text-click&utm_content=bundle_set\" style="
2706
+ "\"font-size: 12px;\" target=\"_blank\">Read Docs</a>"
2707
  msgstr ""
2708
 
2709
  #: v2/App/Controllers/Admin/Settings.php:445
2710
  msgid ""
2711
  "Discount - <a href=\"https://docs.flycart.org/en/articles/3810570-buy-x-get-"
2712
+ "y-discount-rules-2-0?utm_source=woo-discount-rules-"
2713
+ "v2&utm_campaign=doc&utm_medium=text-click&utm_content=bxgy\" style=\"font-"
2714
+ "size: 12px;\" target=\"_blank\">Read Docs</a>"
2715
  msgstr ""
2716
 
2717
  #: v2/App/Controllers/Admin/Settings.php:446
2718
  msgid ""
2719
  "Discount - <a href=\"https://docs.flycart.org/en/articles/3810071-buy-one-"
2720
+ "get-one-free-buy-x-get-x-discount-rules-2-0?utm_source=woo-discount-rules-"
2721
+ "v2&utm_campaign=doc&utm_medium=text-click&utm_content=bxgx\" style=\"font-"
2722
+ "size: 12px;\" target=\"_blank\">Read Docs</a>"
2723
  msgstr ""
2724
 
2725
  #: v2/App/Controllers/Admin/Settings.php:447
2966
  msgid "Date"
2967
  msgstr ""
2968
 
2969
+ #: v2/App/Controllers/Admin/Tabs/Statistics.php:26
2970
  msgid "Reports"
2971
  msgstr ""
2972
 
2973
+ #: v2/App/Controllers/Admin/Tabs/Statistics.php:43
2974
  msgid "All Rules"
2975
  msgstr ""
2976
 
2977
+ #: v2/App/Controllers/Admin/Tabs/Statistics.php:44
2978
+ #: v2/App/Controllers/Admin/Tabs/Statistics.php:50
2979
  msgid "Rule"
2980
  msgstr ""
2981
 
2982
+ #: v2/App/Controllers/Admin/Tabs/Statistics.php:49
2983
  msgid "All Rules (except cart adjustment type)"
2984
  msgstr ""
2985
 
2994
  msgid "Product"
2995
  msgstr ""
2996
 
2997
+ #: v2/App/Controllers/Base.php:194 v2/App/Views/Admin/Tabs/DiscountRule.php:191
2998
  msgid "Product Adjustment"
2999
  msgstr ""
3000
 
3003
  msgid "Simple Discount"
3004
  msgstr ""
3005
 
3006
+ #: v2/App/Controllers/Base.php:200 v2/App/Views/Admin/Tabs/DiscountRule.php:194
3007
  msgid "Cart Adjustment"
3008
  msgstr ""
3009
 
3010
  #: v2/App/Controllers/Base.php:206 v2/App/Controllers/Base.php:207
3011
  #: v2/App/Helpers/ProOptions.php:338
3012
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:200
3013
  msgid "Bulk Discount"
3014
  msgstr ""
3015
 
3016
+ #: v2/App/Controllers/ManageDiscount.php:662
3017
  msgid "cart discount"
3018
  msgstr ""
3019
 
3020
+ #: v2/App/Controllers/ManageDiscount.php:861
3021
  msgid "Coupon code applied successfully."
3022
  msgstr ""
3023
 
3097
  "Medium, 6 of Product A - Large, then the count will be: 6+4+2 = 12\n"
3098
  msgstr ""
3099
 
3100
+ #: v2/App/Helpers/Helper.php:237
3101
+ msgid "Invalid token"
3102
+ msgstr ""
3103
+
3104
+ #: v2/App/Helpers/Helper.php:249
3105
+ msgid "Update now"
3106
+ msgstr ""
3107
+
3108
+ #: v2/App/Helpers/Helper.php:254
3109
+ #, php-format
3110
+ msgid ""
3111
+ "You are using a lower version of our <b>Woo Discount Rules PRO 2.0</b> "
3112
+ "plugin. Please update the plugin to latest version to run smoothly. %s"
3113
+ msgstr ""
3114
+
3115
  #: v2/App/Helpers/Migration.php:133
3116
  #, php-format
3117
  msgid "%s Completed. Please wait.."
3282
  msgid "discount"
3283
  msgstr ""
3284
 
3285
+ #: v2/App/Helpers/Rule.php:1246 v2/App/Helpers/Rule.php:1329
3286
  #: v2/App/Views/Admin/Tabs/ImportExport.php:84
3287
  msgid "Untitled Rule"
3288
  msgstr ""
3289
 
3290
+ #: v2/App/Helpers/Woocommerce.php:922
3291
  msgid "Sunday"
3292
  msgstr ""
3293
 
3294
+ #: v2/App/Helpers/Woocommerce.php:923
3295
  msgid "Monday"
3296
  msgstr ""
3297
 
3298
+ #: v2/App/Helpers/Woocommerce.php:924
3299
  msgid "Tuesday"
3300
  msgstr ""
3301
 
3302
+ #: v2/App/Helpers/Woocommerce.php:925
3303
  msgid "Wednesday"
3304
  msgstr ""
3305
 
3306
+ #: v2/App/Helpers/Woocommerce.php:926
3307
  msgid "Thursday"
3308
  msgstr ""
3309
 
3310
+ #: v2/App/Helpers/Woocommerce.php:927
3311
  msgid "Friday"
3312
  msgstr ""
3313
 
3314
+ #: v2/App/Helpers/Woocommerce.php:928
3315
  msgid "Saturday"
3316
  msgstr ""
3317
 
3318
+ #: v2/App/Helpers/Woocommerce.php:939
3319
  msgid ""
3320
  "Woocommerce before main content(Archive / Shop / Cat Pages / single product)"
3321
  msgstr ""
3322
 
3323
+ #: v2/App/Helpers/Woocommerce.php:940
3324
  msgid "Woocommerce archive description(Archive / Shop / Cat Pages)"
3325
  msgstr ""
3326
 
3327
+ #: v2/App/Helpers/Woocommerce.php:941
3328
  msgid "Woocommerce before shop loop(Archive / Shop / Cat Pages)"
3329
  msgstr ""
3330
 
3331
+ #: v2/App/Helpers/Woocommerce.php:942
3332
  msgid "Woocommerce after shop loop(Archive / Shop / Cat Pages)"
3333
  msgstr ""
3334
 
3335
+ #: v2/App/Helpers/Woocommerce.php:943
3336
  msgid ""
3337
  "Woocommerce after main content(Archive / Shop / Cat Pages / single product)"
3338
  msgstr ""
3339
 
3340
+ #: v2/App/Helpers/Woocommerce.php:944 v2/App/Views/Admin/Tabs/settings.php:194
3341
  #: v2/App/Views/Admin/Tabs/settings.php:212
3342
  msgid "Woocommerce before single product"
3343
  msgstr ""
3344
 
3345
+ #: v2/App/Helpers/Woocommerce.php:945 v2/App/Views/Admin/Tabs/settings.php:196
3346
  #: v2/App/Views/Admin/Tabs/settings.php:214
3347
  msgid "Woocommerce before single product summary"
3348
  msgstr ""
3349
 
3350
+ #: v2/App/Helpers/Woocommerce.php:946 v2/App/Views/Admin/Tabs/settings.php:195
3351
  #: v2/App/Views/Admin/Tabs/settings.php:213
3352
  msgid "Woocommerce after single product summary"
3353
  msgstr ""
3354
 
3355
+ #: v2/App/Helpers/Woocommerce.php:947 v2/App/Views/Admin/Tabs/settings.php:193
3356
  #: v2/App/Views/Admin/Tabs/settings.php:211
3357
  msgid "Woocommerce after single product"
3358
  msgstr ""
3359
 
3360
+ #: v2/App/Helpers/Woocommerce.php:948
3361
  msgid "Woocommerce before cart"
3362
  msgstr ""
3363
 
3364
+ #: v2/App/Helpers/Woocommerce.php:949
3365
  msgid "Woocommerce before cart table"
3366
  msgstr ""
3367
 
3368
+ #: v2/App/Helpers/Woocommerce.php:950
3369
  msgid "Woocommerce before cart contents"
3370
  msgstr ""
3371
 
3372
+ #: v2/App/Helpers/Woocommerce.php:951
3373
  msgid "Woocommerce cart contents"
3374
  msgstr ""
3375
 
3376
+ #: v2/App/Helpers/Woocommerce.php:952
3377
  msgid "Woocommerce after cart contents"
3378
  msgstr ""
3379
 
3380
+ #: v2/App/Helpers/Woocommerce.php:953
3381
  msgid "Woocommerce after cart table"
3382
  msgstr ""
3383
 
3384
+ #: v2/App/Helpers/Woocommerce.php:954
3385
  msgid "Woocommerce after cart"
3386
  msgstr ""
3387
 
3388
+ #: v2/App/Helpers/Woocommerce.php:955
3389
  msgid "Woocommerce before checkout form"
3390
  msgstr ""
3391
 
3392
+ #: v2/App/Helpers/Woocommerce.php:957
3393
  msgid "Woocommerce before checkout billing form"
3394
  msgstr ""
3395
 
3396
+ #: v2/App/Helpers/Woocommerce.php:958
3397
  msgid "Woocommerce after checkout billing form"
3398
  msgstr ""
3399
 
3400
+ #: v2/App/Helpers/Woocommerce.php:959
3401
  msgid "Woocommerce before checkout shipping form"
3402
  msgstr ""
3403
 
3404
+ #: v2/App/Helpers/Woocommerce.php:960
3405
  msgid "Woocommerce after checkout shipping form"
3406
  msgstr ""
3407
 
3408
+ #: v2/App/Helpers/Woocommerce.php:961
3409
  msgid "Woocommerce before order notes"
3410
  msgstr ""
3411
 
3412
+ #: v2/App/Helpers/Woocommerce.php:962
3413
  msgid "Woocommerce after order notes"
3414
  msgstr ""
3415
 
3585
  #: v2/App/Views/Admin/Rules/DiscountBatch/Main.php:71
3586
  #: v2/App/Views/Admin/Rules/DiscountBatch/Main.php:92
3587
  #: v2/App/Views/Admin/Rules/DiscountBatch/Main.php:126
 
 
 
3588
  msgid ""
3589
  "Unlock this feature by <a href='https://www.flycart.org/products/wordpress/"
3590
  "woocommerce-discount-rules' target='_blank'>Upgrading to Pro</a>"
3680
  #: v2/App/Views/Admin/Rules/Discounts/Bulk.php:53
3681
  #: v2/App/Views/Admin/Rules/Discounts/Cart.php:24
3682
  #: v2/App/Views/Admin/Rules/Discounts/simple.php:23
3683
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:110
3684
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:336
3685
  msgid "Discount Type"
3686
  msgstr ""
3687
 
3947
  msgid "Note : You can also exclude products/categories."
3948
  msgstr ""
3949
 
3950
+ #: v2/App/Views/Admin/Rules/Manage.php:194
3951
  msgid "Select discount type and its value (percentage/price/fixed price)"
3952
  msgstr ""
3953
 
4017
  msgid "Skip"
4018
  msgstr ""
4019
 
4020
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:68
4021
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:74
4022
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:85
4023
  msgid "Search Rules"
4024
  msgstr ""
4025
 
4026
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:89
4027
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:374
4028
  msgid "item"
4029
  msgstr ""
4030
 
4031
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:89
4032
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:374
4033
  msgid "items"
4034
  msgstr ""
4035
 
4036
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:119
4037
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:345
4038
  msgid "Language(s)"
4039
  msgstr ""
4040
 
4041
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:151
4042
  msgid "Exclusive"
4043
  msgstr ""
4044
 
4045
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:180
4046
  msgid "Created by: "
4047
  msgstr ""
4048
 
 
4049
  #: v2/App/Views/Admin/Tabs/DiscountRule.php:180
4050
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:182
4051
  msgid " On: "
4052
  msgstr ""
4053
 
4054
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:182
4055
  msgid "Modified by: "
4056
  msgstr ""
4057
 
4058
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:203
4059
  msgid "Set Discount"
4060
  msgstr ""
4061
 
4062
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:206
4063
  msgid "Buy X get X"
4064
  msgstr ""
4065
 
4066
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:209
4067
  msgid "Buy X get Y"
4068
  msgstr ""
4069
 
4070
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:252
4071
  msgid "Enabled"
4072
  msgstr ""
4073
 
4074
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:263
4075
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:277
4076
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:290
4077
  msgid " - ( Not running )"
4078
  msgstr ""
4079
 
4080
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:264
4081
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:278
4082
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:291
4083
  msgid "Rule reached maximum usage limit"
4084
  msgstr ""
4085
 
4086
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:268
4087
  msgid " - ( Will run in future)"
4088
  msgstr ""
4089
 
4090
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:271
4091
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:284
4092
  msgid "Your server current date and time:"
4093
  msgstr ""
4094
 
4095
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:281
4096
  msgid " - ( Not running - validity expired)"
4097
  msgstr ""
4098
 
4099
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:318
4100
  msgid "No rules found."
4101
  msgstr ""
4102
 
4103
+ #: v2/App/Views/Admin/Tabs/DiscountRule.php:408
4104
  msgid "Go PRO"
4105
  msgstr ""
4106
 
4147
  msgid "Custom Range"
4148
  msgstr ""
4149
 
4150
+ #: v2/App/Views/Admin/Tabs/Statistics.php:49
4151
  msgid "From: yyyy/mm/dd"
4152
  msgstr ""
4153
 
4154
+ #: v2/App/Views/Admin/Tabs/Statistics.php:60
4155
  msgid "To: yyyy/mm/dd"
4156
  msgstr ""
4157
 
4158
+ #: v2/App/Views/Admin/Tabs/Statistics.php:91
4159
  msgid "Update Chart"
4160
  msgstr ""
4161
 
4428
  "<b>NOTE:</b> It is a static banner. You can use any content or html here."
4429
  msgstr ""
4430
 
4431
+ #: v2/App/Views/Admin/Tabs/settings.php:413
4432
+ #: v2/App/Views/Admin/Tabs/settings.php:422
4433
+ #: v2/App/Views/Admin/Tabs/settings.php:485
4434
+ msgid ""
4435
+ "Unlock this feature by <a href='https://www.flycart.org/products/wordpress/"
4436
+ "woocommerce-discount-rules?utm_source=woo-discount-rules-"
4437
+ "v2&utm_campaign=doc&utm_medium=text-click&utm_content=unlock_pro' "
4438
+ "target='_blank'>Upgrading to Pro</a>"
4439
+ msgstr ""
4440
+
4441
  #: v2/App/Views/Admin/Tabs/settings.php:419
4442
  msgid "Banner Content display position"
4443
  msgstr ""
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: flycart
3
  Donate link: https://flycart.org/
4
  Tags: woocommerce, coupons, discounts, dynamic pricing, Buy One Get One Free, pricing deals, bulk discount, discount
5
  Requires at least: 4.4.1
6
- Tested up to: 5.4
7
- Stable tag: 2.0.2
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -20,14 +20,14 @@ Discounts will be visible in product page, product details page, cart, checkout
20
 
21
  Display the pricing discount table beautifully on the product page. Start selling more and retain customers by running promotions with the best dynamic pricing and discount plugin for WooCommerce.
22
 
23
- [View Demo](http://demo.flycart.org/woo-discount-rules) | [Documentation with real examples](http://docs.flycart.org/woocommerce-discount-rules) | [Ask Questions](https://www.flycart.org/support) | [PRO version](https://www.flycart.org/products/wordpress/woocommerce-discount-rules) | [Examples](https://www.flycart.org/woocommerce-discount-rules-examples)
24
 
25
  == DISCOUNT TYPES AND FEATURES ==
26
 
27
  = Free version features =
28
 
29
  * Percentage based discounts in WooCommerce
30
- * [Store-wide global discount](http://docs.flycart.org/woocommerce-discount-rules/percentage-discount-examples/storewide-global-discount-for-all-products)
31
  * Quantity range based tiered pricing percentage discount (Example: Buy 3 to 7 quantities, get 10%, Buy 8 to 12 quantities, get 20%)
32
  * Cart based percentage discount (Example: Spend more than $1000, get 10% discount)
33
  * Order total based discount
@@ -43,20 +43,20 @@ Display the pricing discount table beautifully on the product page. Start sellin
43
  * All features of the free version, plus)
44
  * Fixed price discounts ( Get $9 discount for purchasing over 6 items)
45
  * Category specific discount conditions ( Get 25 % off on all items under Summer Collection )
46
- * Buy One Get One Free discounts in WooCommerce (BOGO Deals) [Example: Buy 2 get 1 cheapest product free](http://docs.flycart.org/woocommerce-discount-rules/buy-one-get-one-deals/buy-2-and-get-1-cheapest-free-repeat)
47
  * Dynamic pricing and discounts for WooCommerce
48
- * [Specific product based discounts (Buy Product A and get 10% discount)](http://docs.flycart.org/woocommerce-discount-rules/percentage-discount-examples/product-specific-discount-get-10-discount-adidas-shoe)
49
- * [User role based dynamic pricing and discounts for your WooCommerce store (Example: Wholesale customers get a discounted price)](http://docs.flycart.org/woocommerce-discount-rules/examples/user-role-based-discount-rules)
50
  * Dependant product based discounts (Buy Product A and get discount on Product B)
51
  * Bundle / package deal (Buy 3 items for $10. 4th item will be charge full price)
52
  * Offer one or more free products (Multiple products could be offered free using a rule)
53
- * [Coupon code activated discount rules - The discount will apply after a coupon is entered.](http://docs.flycart.org/woocommerce-discount-rules/examples/activate-discount-rule-using-a-coupon-code-in-woocommerce)
54
  * Option to set discount for each product variant.
55
  * Attribute specific discount (Buy Small size T-shirts and get 10% discount)
56
  * Option to set Discount for All Products or Global Discount
57
  * Discount for customers with specific domains (10% discount for all emails ending with @acme.com)
58
  * Customer specific discount (10% discount for selected customers)
59
- * [Shipping / Delivery location based discount (Example: If shipping destination is California, get 15% discount)](http://docs.flycart.org/woocommerce-discount-rules/cart-based-discount-examples/customer-shipping-address-based-discount)
60
  * Purchase history based discount (Customers who spent $100 in previously get 10% discount)
61
  * Discount based on the number of orders placed earlier (Example: 10% discount for customers with 5 or more orders)
62
  * If customer purchased selected products previously, he can get a discount (Example: Customers who purchased Shoes get 10% discount)
@@ -66,7 +66,7 @@ Display the pricing discount table beautifully on the product page. Start sellin
66
  * Cart discounts by fixed price discounts (Flat $50 discount for all orders today)
67
  * Buy 3 units of Product A and get flat $25 discount
68
  * Add 3 products to the cart and get the Cheapest Item free
69
- * [Buy any 10 products from Specific category and get a Product Free from Category B](http://docs.flycart.org/woocommerce-discount-rules/buy-one-get-one-deals/buy-any-10-items-from-category-a-and-get-25-discount-on-category-b)
70
  * Buy Product A and Product B from Category Electronics and get a free product from category Accessories
71
  * Buy any Product from Category Mobile and choose a free product from Category Hard Cases
72
  * Option to offer free products only from certain category
@@ -79,14 +79,14 @@ Display the pricing discount table beautifully on the product page. Start sellin
79
 
80
  = Category Discount Rules: =
81
 
82
- * Buy T-shirts from Category Apparel and save 10% – [Video](https://www.youtube.com/watch?v=OEWc7fL3qeM)
83
  * Get 30% off on Category A & Category B
84
  * Purchase any 6 items from Category A and get 25% discount on total cart value.
85
  * Purchase 3 products from Category A or B or C or from all of them and get 20% discount valid from dd/mm/yyyy to dd/mm/yyyy
86
 
87
  = Quantity range based tiered pricing discounts =
88
- * [Buy 1 to 5 quantities, get $2 discount, Buy 6 or more, get $3 discount](http://docs.flycart.org/woocommerce-discount-rules/fixed-price-discount-examples/buy-1-to-5-quantity-with-2-discount-buy-6-and-more-with-3-discount-bulk-quantity-discounts)
89
- * Buy 2 to 3 quantities, get 10% discount, 4-5 quantities, get 20%, 6-8, get 30%
90
 
91
  = Product Variant Discounts: =
92
 
@@ -96,7 +96,7 @@ Display the pricing discount table beautifully on the product page. Start sellin
96
 
97
  = Product Dependant rule: =
98
 
99
- * [Buy Product A at full price and get 20% discount in Product B](http://docs.flycart.org/woocommerce-discount-rules/buy-one-get-one-deals/buy-product-a-at-full-price-and-get-product-b-at-20-discount)
100
  * Buy 2 quantities of Product A, 2 quantities of Product and get 30% discount in Product C
101
  * Buy 3 quantities of Product A and get flat $10 off in product B
102
  * Buy a Mobile and get 20% off on headphone
@@ -115,11 +115,11 @@ Display the pricing discount table beautifully on the product page. Start sellin
115
 
116
  = Cart Discount Rules: =
117
 
118
- * [All Orders above $500 will get 15% discount](http://docs.flycart.org/woocommerce-discount-rules/cart-based-discount-examples/all-orders-above-500-will-get-15-discount)
119
  * Add two to six products in cart and get flat $30 discount.
120
  * 10% discount for all retailers (User Role specific discount)
121
- * All orders above $500 will get 15% discount – [Video](https://www.youtube.com/watch?v=RSU0zuvx_Yg)
122
- * [Buy 2 products and get 20% discount](http://docs.flycart.org/woocommerce-discount-rules/percentage-discount-examples/order-more-than-2-items-and-get-20-discount) – [Video](https://www.youtube.com/watch?v=84VL6Wwf1DI&t=15s)
123
  * Discount for products from specific categories only
124
  * Free shipping for orders above $100
125
  * Coupon code activated cart discount rules
@@ -129,7 +129,7 @@ Display the pricing discount table beautifully on the product page. Start sellin
129
 
130
  * Shoes get 20% discount, T-Shirts get 5% discount
131
  * Adidas Special Edition Shoe (A specific product) gets 15% discount for 10 days
132
- * Buy 10 mugs are more and get 5% off – [Video](https://www.youtube.com/watch?v=7ZeRIKXWFmE)
133
  * Buy 3 for $10, Buy 6 for $20
134
 
135
  = Fixed Price Per Unit =
@@ -154,7 +154,7 @@ Display the pricing discount table beautifully on the product page. Start sellin
154
 
155
  = Global Discount Storewide =
156
 
157
- * 20% discount on all items in the store till December 25 – [Video](https://www.youtube.com/watch?v=pHst5Ncse8M)
158
  * All Products get 10% discount
159
 
160
  = Attributes specific discount =
@@ -224,7 +224,7 @@ We are happy to help you and guide you with the set up.
224
 
225
  = Documentation =
226
 
227
- [http://docs.flycart.org/woocommerce-discount-rules](http://docs.flycart.org/woocommerce-discount-rules)
228
 
229
  = Got questions? =
230
 
@@ -336,6 +336,19 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
336
 
337
  == Changelog ==
338
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  = 2.0.2 - 29/07/20 =
340
  * Fix - Making conflict with YITH WooCommerce Wishlist
341
  * Fix - Script error because of selectWoo
3
  Donate link: https://flycart.org/
4
  Tags: woocommerce, coupons, discounts, dynamic pricing, Buy One Get One Free, pricing deals, bulk discount, discount
5
  Requires at least: 4.4.1
6
+ Tested up to: 5.5
7
+ Stable tag: 2.1.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
20
 
21
  Display the pricing discount table beautifully on the product page. Start selling more and retain customers by running promotions with the best dynamic pricing and discount plugin for WooCommerce.
22
 
23
+ [View Demo](http://demo.flycart.org/woo-discount-rules) | [Documentation with real examples](https://docs.flycart.org/en/collections/2195266-discount-rules-2-0) | [Ask Questions](https://www.flycart.org/support) | [PRO version](https://www.flycart.org/products/wordpress/woocommerce-discount-rules) | [Examples](https://www.flycart.org/woocommerce-discount-rules-examples)
24
 
25
  == DISCOUNT TYPES AND FEATURES ==
26
 
27
  = Free version features =
28
 
29
  * Percentage based discounts in WooCommerce
30
+ * [Store-wide global discount](https://docs.flycart.org/en/articles/3788550-product-adjustment-discount-rules-2-0)
31
  * Quantity range based tiered pricing percentage discount (Example: Buy 3 to 7 quantities, get 10%, Buy 8 to 12 quantities, get 20%)
32
  * Cart based percentage discount (Example: Spend more than $1000, get 10% discount)
33
  * Order total based discount
43
  * All features of the free version, plus)
44
  * Fixed price discounts ( Get $9 discount for purchasing over 6 items)
45
  * Category specific discount conditions ( Get 25 % off on all items under Summer Collection )
46
+ * Buy One Get One Free discounts in WooCommerce (BOGO Deals) [Example: Buy 2 get 1 cheapest product free](https://docs.flycart.org/en/articles/3810570-buy-x-get-y-discount-rules-2-0)
47
  * Dynamic pricing and discounts for WooCommerce
48
+ * [Specific product based discounts (Buy Product A and get 10% discount)](https://docs.flycart.org/en/articles/4217898-discounts-on-specific-product-simple-and-variable-products-from-version-2-0)
49
+ * [User role based dynamic pricing and discounts for your WooCommerce store (Example: Wholesale customers get a discounted price)](https://docs.flycart.org/en/articles/4203313-user-role-based-discount-rules-discount-rules-2-0)
50
  * Dependant product based discounts (Buy Product A and get discount on Product B)
51
  * Bundle / package deal (Buy 3 items for $10. 4th item will be charge full price)
52
  * Offer one or more free products (Multiple products could be offered free using a rule)
53
+ * [Coupon code activated discount rules - The discount will apply after a coupon is entered.](https://docs.flycart.org/en/articles/4268595-activate-discount-rule-using-a-coupon-code-in-woocommerce-2-0)
54
  * Option to set discount for each product variant.
55
  * Attribute specific discount (Buy Small size T-shirts and get 10% discount)
56
  * Option to set Discount for All Products or Global Discount
57
  * Discount for customers with specific domains (10% discount for all emails ending with @acme.com)
58
  * Customer specific discount (10% discount for selected customers)
59
+ * [Shipping / Delivery location based discount (Example: If shipping destination is California, get 15% discount)](https://docs.flycart.org/en/articles/4214869-customer-shipping-address-based-discount-2-0)
60
  * Purchase history based discount (Customers who spent $100 in previously get 10% discount)
61
  * Discount based on the number of orders placed earlier (Example: 10% discount for customers with 5 or more orders)
62
  * If customer purchased selected products previously, he can get a discount (Example: Customers who purchased Shoes get 10% discount)
66
  * Cart discounts by fixed price discounts (Flat $50 discount for all orders today)
67
  * Buy 3 units of Product A and get flat $25 discount
68
  * Add 3 products to the cart and get the Cheapest Item free
69
+ * [Buy any 10 products from Specific category and get a Product Free from Category B](https://docs.flycart.org/en/articles/3946511-buy-any-items-from-category-a-and-get-20-discount-on-category-b)
70
  * Buy Product A and Product B from Category Electronics and get a free product from category Accessories
71
  * Buy any Product from Category Mobile and choose a free product from Category Hard Cases
72
  * Option to offer free products only from certain category
79
 
80
  = Category Discount Rules: =
81
 
82
+ * Buy T-shirts from Category Apparel and save 10%
83
  * Get 30% off on Category A & Category B
84
  * Purchase any 6 items from Category A and get 25% discount on total cart value.
85
  * Purchase 3 products from Category A or B or C or from all of them and get 20% discount valid from dd/mm/yyyy to dd/mm/yyyy
86
 
87
  = Quantity range based tiered pricing discounts =
88
+ * Buy 1 to 5 quantities, get $2 discount, Buy 6 or more, get $3 discount
89
+ * [Buy 2 to 3 quantities, get 10% discount, 4-5 quantities, get 20%, 6-8, get 30%](https://docs.flycart.org/en/articles/3914904-bulk-discounts-tiered-pricing-discounts-discount-rules-2-0)
90
 
91
  = Product Variant Discounts: =
92
 
96
 
97
  = Product Dependant rule: =
98
 
99
+ * [Buy Product A at full price and get 20% discount in Product B](https://docs.flycart.org/en/articles/3953967-buy-x-and-get-y-product-for-free-or-at-50-discount-discount-rules-2-0)
100
  * Buy 2 quantities of Product A, 2 quantities of Product and get 30% discount in Product C
101
  * Buy 3 quantities of Product A and get flat $10 off in product B
102
  * Buy a Mobile and get 20% off on headphone
115
 
116
  = Cart Discount Rules: =
117
 
118
+ * [All Orders above $500 will get 15% discount](https://docs.flycart.org/en/articles/3894861-subtotal-based-tiered-discounts-discount-rules-2-0)
119
  * Add two to six products in cart and get flat $30 discount.
120
  * 10% discount for all retailers (User Role specific discount)
121
+ * All orders above $500 will get 15% discount
122
+ * Buy 2 products and get 20% discount
123
  * Discount for products from specific categories only
124
  * Free shipping for orders above $100
125
  * Coupon code activated cart discount rules
129
 
130
  * Shoes get 20% discount, T-Shirts get 5% discount
131
  * Adidas Special Edition Shoe (A specific product) gets 15% discount for 10 days
132
+ * Buy 10 mugs are more and get 5% off
133
  * Buy 3 for $10, Buy 6 for $20
134
 
135
  = Fixed Price Per Unit =
154
 
155
  = Global Discount Storewide =
156
 
157
+ * 20% discount on all items in the store till December 25
158
  * All Products get 10% discount
159
 
160
  = Attributes specific discount =
224
 
225
  = Documentation =
226
 
227
+ [https://docs.flycart.org/en/collections/2195266-discount-rules-2-0](https://docs.flycart.org/en/collections/2195266-discount-rules-2-0)
228
 
229
  = Got questions? =
230
 
336
 
337
  == Changelog ==
338
 
339
+ = 2.1.0 - 13/08/20 =
340
+ * Fix - Fatal error when WooCommerce is deactivated.
341
+ * Fix - Displays only 10 item in sale page for attribute based rules.
342
+ * Fix - Disable strikeout if option is disabled for variable products.
343
+ * Fix - PHP 7.x warnings.
344
+ * Fix - Timeout warnings while checking for update.
345
+ * Fix - Warning while having grouped product.
346
+ * Improvement - Report based on cart quantities.
347
+ * Improvement - Added Aelia Currency Switcher Compatible.
348
+ * Improvement - Removed create collate while create table.
349
+ * Improvement - Privilege and CSRF check for all requests.
350
+ * Improvement - Choose free shipping as default only when applicable.
351
+
352
  = 2.0.2 - 29/07/20 =
353
  * Fix - Making conflict with YITH WooCommerce Wishlist
354
  * Fix - Script error because of selectWoo
v1/vendor/flycartinc/inputhelper/src/StringHelper.php CHANGED
@@ -7,24 +7,6 @@ if (version_compare(PHP_VERSION, '5.6', '>='))
7
  {
8
  @ini_set('default_charset', 'UTF-8');
9
  }
10
- else
11
- {
12
- // Check if mbstring extension is loaded and attempt to load it if not present except for windows
13
- if (extension_loaded('mbstring'))
14
- {
15
- @ini_set('mbstring.internal_encoding', 'UTF-8');
16
- @ini_set('mbstring.http_input', 'UTF-8');
17
- @ini_set('mbstring.http_output', 'UTF-8');
18
- }
19
-
20
- // Same for iconv
21
- if (function_exists('iconv'))
22
- {
23
- iconv_set_encoding('internal_encoding', 'UTF-8');
24
- iconv_set_encoding('input_encoding', 'UTF-8');
25
- iconv_set_encoding('output_encoding', 'UTF-8');
26
- }
27
- }
28
 
29
  /**
30
  * String handling class for UTF-8 data wrapping the phputf8 library. All functions assume the validity of UTF-8 strings.
7
  {
8
  @ini_set('default_charset', 'UTF-8');
9
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  /**
12
  * String handling class for UTF-8 data wrapping the phputf8 library. All functions assume the validity of UTF-8 strings.
v1/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p7/UpdateChecker.php CHANGED
@@ -610,11 +610,14 @@ if ( !class_exists('Puc_v4p7_UpdateChecker', false) ):
610
  $metadata = call_user_func(array($metaClass, 'fromJson'), $result['body']);
611
  } else {
612
  do_action('puc_api_error', $status, $result, $url, $this->slug);
613
- $this->triggerError(
 
 
 
614
  sprintf('The URL %s does not point to a valid metadata file. ', $url)
615
  . $status->get_error_message(),
616
  E_USER_WARNING
617
- );
618
  }
619
 
620
  return array($metadata, $result);
610
  $metadata = call_user_func(array($metaClass, 'fromJson'), $result['body']);
611
  } else {
612
  do_action('puc_api_error', $status, $result, $url, $this->slug);
613
+ /**
614
+ * Commented Added by FLYCART as it throws warning while there is an timeout issue
615
+ * */
616
+ /*$this->triggerError(
617
  sprintf('The URL %s does not point to a valid metadata file. ', $url)
618
  . $status->get_error_message(),
619
  E_USER_WARNING
620
+ );*/
621
  }
622
 
623
  return array($metadata, $result);
v2/App/Compatibility/AeliaCurrencySwitcherByAelia.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Wdr\App\Compatibility;
4
+
5
+ if (!defined('ABSPATH')) exit;
6
+
7
+ class AeliaCurrencySwitcherByAelia extends Base
8
+ {
9
+ protected $key = 'compatible_cs_aelia';
10
+
11
+ /**
12
+ * Do compatibility script
13
+ * */
14
+ public function run(){
15
+ $value = $this->config->getConfigData($this->key, 0);
16
+ if($value){
17
+ add_filter('advanced_woo_discount_rules_converted_currency_value', function($price){
18
+ if(is_numeric($price) && !empty($price)) {
19
+ // Get the source currency. We assume that it's always shop's base currency
20
+ $from_currency = get_option('woocommerce_currency');
21
+ // Pass the price to the currency conversion filter provided by the Currency Switcher. This
22
+ // will ensure that the discount is converted correctly
23
+ if(function_exists('get_woocommerce_currency')){
24
+ $price = apply_filters('wc_aelia_cs_convert', $price, $from_currency, get_woocommerce_currency(), 5);
25
+ if(function_exists('bcdiv')){
26
+ $price = bcdiv($price, 1, 2);
27
+ }
28
+ }
29
+ }
30
+
31
+ return $price;
32
+ }, 10);
33
+
34
+ add_filter('advanced_woo_discount_rules_calculate_cart_subtotal_manually', '__return_true');
35
+ }
36
+ }
37
+
38
+ /**
39
+ * load fields
40
+ * */
41
+ public function loadFields(&$available){
42
+ $value = $this->config->getConfigData($this->key, 0);
43
+ if ( is_plugin_active( 'woocommerce-aelia-currencyswitcher/woocommerce-aelia-currencyswitcher.php' ) || ($value == 1)) {
44
+ $available = true;
45
+ ?>
46
+ <div class="awdr-compatible-field">
47
+ <label>
48
+ <input type="checkbox" name="wdrc[<?php echo $this->key; ?>]" id="<?php echo $this->key; ?>" value="1" <?php if ($value == 1) { ?> checked <?php } ?>>
49
+ <?php esc_html_e('Add compatible for Aelia Currency Switcher', WDR_TEXT_DOMAIN); ?>
50
+ </label>
51
+ </div>
52
+ <?php
53
+ }
54
+ }
55
+ }
v2/App/Compatibility/ExtraProductOptionsProByThemeHigh.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace Wdr\App\Compatibility;
4
 
 
 
5
  if (!defined('ABSPATH')) exit;
6
 
7
  class ExtraProductOptionsProByThemeHigh extends Base
@@ -15,11 +17,11 @@ class ExtraProductOptionsProByThemeHigh extends Base
15
  $value = $this->config->getConfigData($this->key, 0);
16
  if($value){
17
  add_filter('thwepo_product_price_html', function($price_html, $product_id){
18
- if(is_ajax()){
19
  $price = trim(strip_tags($price_html));
20
  $replace_strings = array('&#36;', '&nbsp;');
21
  if(function_exists('wc_get_product')){
22
- $product = wc_get_product($product_id);
23
  $original_price = $product->get_price();
24
  $prices = explode('&nbsp;', $price);
25
  $price = str_replace($replace_strings, '', $prices[0]);
2
 
3
  namespace Wdr\App\Compatibility;
4
 
5
+ use Wdr\App\Helpers\Woocommerce;
6
+
7
  if (!defined('ABSPATH')) exit;
8
 
9
  class ExtraProductOptionsProByThemeHigh extends Base
17
  $value = $this->config->getConfigData($this->key, 0);
18
  if($value){
19
  add_filter('thwepo_product_price_html', function($price_html, $product_id){
20
+ if(Woocommerce::is_ajax()){
21
  $price = trim(strip_tags($price_html));
22
  $replace_strings = array('&#36;', '&nbsp;');
23
  if(function_exists('wc_get_product')){
24
+ $product = Woocommerce::getProduct($product_id);
25
  $original_price = $product->get_price();
26
  $prices = explode('&nbsp;', $price);
27
  $price = str_replace($replace_strings, '', $prices[0]);
v2/App/Controllers/Admin/Tabs/Reports/RuleAmount.php CHANGED
@@ -74,12 +74,12 @@ class RuleAmount extends Base {
74
  }
75
 
76
  protected function prepare_params( $params ) {
77
- return array(
 
78
  'from' => $params['from'],
79
  'to' => $params['to'],
80
- 'limit' => 5,
81
  'include_amount' => true,
82
- //'include_gifted_amount' => true,
83
  );
84
  }
85
 
74
  }
75
 
76
  protected function prepare_params( $params ) {
77
+ $report_limit = ( isset($params['limit']) && !empty($params['limit']) ) ? $params['limit'] : 5;
78
+ return array(
79
  'from' => $params['from'],
80
  'to' => $params['to'],
81
+ 'limit' => $report_limit,
82
  'include_amount' => true,
 
83
  );
84
  }
85
 
v2/App/Controllers/Admin/Tabs/Reports/RuleAmountWithCartDiscount.php CHANGED
@@ -12,6 +12,7 @@ class RuleAmountWithCartDiscount extends RuleAmount {
12
  }
13
 
14
  protected function prepare_params( $params ) {
 
15
  $params['include_cart_discount'] = true;
16
  return $params;
17
  }
12
  }
13
 
14
  protected function prepare_params( $params ) {
15
+ $params['limit'] = ( isset($params['limit']) && !empty($params['limit']) ) ? $params['limit'] : 5;
16
  $params['include_cart_discount'] = true;
17
  return $params;
18
  }
v2/App/Controllers/Admin/Tabs/Statistics.php CHANGED
@@ -3,6 +3,7 @@
3
  namespace Wdr\App\Controllers\Admin\Tabs;
4
 
5
  use Wdr\App\Controllers\Configuration;
 
6
  use Wdr\App\Helpers\Rule;
7
  use Wdr\App\Controllers\Admin\Tabs\Reports;
8
 
@@ -60,7 +61,6 @@ class Statistics extends Base
60
  */
61
  public function render($page = NULL)
62
  {
63
-
64
  $charts = array();
65
  foreach ( $this->reports as $k => $item ) {
66
  $group = $item['group'];
@@ -81,13 +81,36 @@ class Statistics extends Base
81
  */
82
  protected function ajax_get_chart_data() {
83
  parse_str( $_POST['params'], $params );
84
- $type = $params['type'];
85
- if ( isset( $this->reports[ $type ] ) ) {
86
- $handler = $this->reports[ $type ]['handler'];
87
- $data = $handler->get_data( $params );
88
- wp_send_json_success( $data );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  } else {
90
- wp_send_json_error();
91
  }
92
  }
93
 
3
  namespace Wdr\App\Controllers\Admin\Tabs;
4
 
5
  use Wdr\App\Controllers\Configuration;
6
+ use Wdr\App\Helpers\Helper;
7
  use Wdr\App\Helpers\Rule;
8
  use Wdr\App\Controllers\Admin\Tabs\Reports;
9
 
61
  */
62
  public function render($page = NULL)
63
  {
 
64
  $charts = array();
65
  foreach ( $this->reports as $k => $item ) {
66
  $group = $item['group'];
81
  */
82
  protected function ajax_get_chart_data() {
83
  parse_str( $_POST['params'], $params );
84
+ $awdr_nonce = isset($params['awdr_nonce'])? $params['awdr_nonce']: '';
85
+ Helper::validateRequest('wdr_ajax_report', $awdr_nonce);
86
+ if(Helper::hasAdminPrivilege()){
87
+ $type = $params['type'];
88
+ if ( isset( $this->reports[ $type ] ) ) {
89
+ $handler = $this->reports[ $type ]['handler'];
90
+ $data = $handler->get_data( $params );
91
+ wp_send_json_success( $data );
92
+ } else {
93
+ if($type == "rule_amount_extra" || $type == "rule_amount"){
94
+ wp_send_json_error();
95
+ }
96
+ $rule_helper = new Rule();
97
+ $available_conditions = $this->getAvailableConditions();
98
+ if(!empty($available_conditions)){
99
+ $rule_detail = $rule_helper->getRule((int)$type, $available_conditions);
100
+ $this->rule_details = array();
101
+ if(!empty($rule_detail) && is_array($rule_detail)){
102
+ foreach ($rule_detail as $rule){
103
+ $handler = new Reports\RuleNameDiscount($rule);
104
+ $data = $handler->get_data( $params );
105
+ wp_send_json_success( $data );
106
+ }
107
+ }
108
+ }else{
109
+ wp_send_json_error();
110
+ }
111
+ }
112
  } else {
113
+ die(__('Authentication required', WDR_TEXT_DOMAIN));
114
  }
115
  }
116
 
v2/App/Controllers/Admin/WDRAjax.php CHANGED
@@ -29,6 +29,12 @@ class WDRAjax extends Base
29
  $this->search_result_limit = apply_filters('advanced_woo_discount_rules_select_search_limit', $this->search_result_limit);
30
  }
31
 
 
 
 
 
 
 
32
  /**
33
  * Ajax Controller
34
  */
@@ -36,10 +42,15 @@ class WDRAjax extends Base
36
  {
37
  $result = null;
38
  $method = $this->input->post('method', '');
39
- $method_name = 'wdr_ajax_' . $method;
40
- if (method_exists($this, $method_name)) {
41
- $result = $this->$method_name();
 
 
 
 
42
  }
 
43
  wp_send_json_success($result);
44
  }
45
 
@@ -47,11 +58,13 @@ class WDRAjax extends Base
47
  * Process v1 to v2 migration
48
  * */
49
  public function wdr_ajax_do_v1_v2_migration(){
 
50
  $status = \Wdr\App\Helpers\Migration::init();
51
  wp_send_json_success($status);
52
  }
53
 
54
  public function wdr_ajax_rebuild_onsale_list(){
 
55
  $shortcode_manager = new OnSaleShortCode();
56
  $rules = $this->input->post('rules', array());
57
  $status = $shortcode_manager->rebuildOnSaleList($rules);
@@ -72,14 +85,23 @@ class WDRAjax extends Base
72
  * */
73
  public function awdr_get_discount_of_a_product(){
74
  $product_id = $this->input->post('product_id', '');
75
- $quantity = $this->input->post('qty', '');
76
- $product = Woocommerce::getProduct($product_id);
77
- $price = Woocommerce::getProductPrice($product);
78
- $custom_price = $this->input->post('custom_price', '');
79
- $result = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', $price, $product, $quantity, $custom_price, 'all', true);
80
- if(!empty($result)){
81
- $result = Helper::formatAllPrices($result);
 
 
 
 
 
 
 
 
82
  }
 
83
  wp_send_json_success($result);
84
  }
85
 
@@ -90,6 +112,7 @@ class WDRAjax extends Base
90
  */
91
  public function wdr_ajax_products()
92
  {
 
93
  $query = $this->input->post('query', '');
94
  //to disable other search classes
95
  remove_all_filters('woocommerce_data_stores');
@@ -109,6 +132,7 @@ class WDRAjax extends Base
109
  */
110
  public function wdr_ajax_product_category()
111
  {
 
112
  $taxonomy = apply_filters('advanced_woo_discount_rules_category_taxonomies', array('product_cat'));
113
  if(!is_array($taxonomy)){
114
  $taxonomy = array('product_cat');
@@ -137,7 +161,7 @@ class WDRAjax extends Base
137
  */
138
  public function wdr_ajax_product_tags()
139
  {
140
-
141
  $query = $this->input->post('query', '');
142
  $terms = get_terms(array('taxonomy' => 'product_tag', 'name__like' => $query, 'hide_empty' => false, 'number' => $this->search_result_limit));
143
  return array_map(function ($term) {
@@ -154,6 +178,7 @@ class WDRAjax extends Base
154
  */
155
  public function wdr_ajax_product_taxonomies()
156
  {
 
157
  $query = $this->input->post('query', '');
158
  $taxonomy_name = $this->input->post('taxonomy', '');
159
  $terms = get_terms(array('taxonomy' => $taxonomy_name,
@@ -183,8 +208,10 @@ class WDRAjax extends Base
183
  */
184
  public function wdr_ajax_product_sku()
185
  {
 
186
  global $wpdb;
187
  $query = $this->input->post('query', '');
 
188
  $results = $wpdb->get_results("
189
  SELECT DISTINCT meta_value
190
  FROM $wpdb->postmeta
@@ -204,9 +231,12 @@ class WDRAjax extends Base
204
  */
205
  public function wdr_ajax_product_attributes()
206
  {
 
 
207
  global $wc_product_attributes, $wpdb;
208
  //return $wc_product_attributes;
209
  $query = $this->input->post('query', '');
 
210
  $taxonomies = array_map(function ($item) {
211
  return "'$item'";
212
  }, array_keys($wc_product_attributes));
@@ -232,6 +262,7 @@ class WDRAjax extends Base
232
  */
233
  public function wdr_ajax_users_list()
234
  {
 
235
  $query = $this->input->post('query', '');
236
  $query = "*$query*";
237
  $users = get_users(array('fields' => array('ID', 'user_nicename'), 'search' => $query, 'orderby' => 'user_nicename'));
@@ -249,6 +280,7 @@ class WDRAjax extends Base
249
  */
250
  public function wdr_ajax_cart_coupon()
251
  {
 
252
  $posts_raw = get_posts(array(
253
  'posts_per_page' => '-1',
254
  'post_type' => 'shop_coupon',
@@ -277,6 +309,7 @@ class WDRAjax extends Base
277
  */
278
  public function wdr_ajax_save_configuration()
279
  {
 
280
  $save_config = $this->input->post();
281
  $save_config['modify_price_at_shop_page'] = $this->input->post('modify_price_at_shop_page', 0);
282
  $save_config['modify_price_at_product_page'] = $this->input->post('modify_price_at_product_page', 0);
@@ -287,14 +320,15 @@ class WDRAjax extends Base
287
  $save_config['table_title_column'] = $this->input->post('table_title_column', 0);
288
  $save_config['table_discount_column'] = $this->input->post('table_discount_column', 0);
289
  $save_config['table_range_column'] = $this->input->post('table_range_column', 0);
290
- $save_config['awdr_banner_editor'] = (isset($_POST['banner_content'])) ? stripslashes($_POST['banner_content']) : '';
 
 
 
291
  $save_config['on_sale_badge_html'] = (isset($_POST['on_sale_badge_html'])) ? stripslashes($_POST['on_sale_badge_html']) : '';
292
- //echo "<pre>"; print_r($save_config); echo "</pre>";
293
  $save_alert = $this->input->post('customizer_save_alert', 0) ;
294
  if($save_alert == "1"){
295
  $save_alert = "alert_in_popup";
296
- }
297
- else{
298
  $save_alert = "alert_in_normal";
299
  }
300
  return array('result' => Configuration::saveConfig($save_config), 'save_popup' => $save_alert);
@@ -305,9 +339,13 @@ class WDRAjax extends Base
305
  */
306
  public function wdr_ajax_save_rule()
307
  {
 
308
  $rule_helper = new Rule();
309
  $post = $this->input->post();
310
  $post['title'] = (isset($_POST['title'])) ? stripslashes(sanitize_text_field($_POST['title'])) : '';
 
 
 
311
  $rule_id = $rule_helper->save($post);
312
  if(isset($rule_id['coupon_exists'])){
313
  $coupon_message = $rule_id['coupon_exists'];
@@ -335,7 +373,9 @@ class WDRAjax extends Base
335
  global $wpdb;
336
  $deleted = 'failed';
337
  $row_id = $this->input->post('rowid', '');
 
338
  if (!empty($row_id)) {
 
339
  $deleted = $wpdb->update($wpdb->prefix . self::$wdr_rules_table,
340
  array(
341
  'deleted' => 1
@@ -362,7 +402,9 @@ class WDRAjax extends Base
362
  global $wpdb;
363
  $duplicated_id = 'failed';
364
  $row_id = $this->input->post('rowid', '');
 
365
  if (!empty($row_id)) {
 
366
  $rule_title = $wpdb->get_row("SELECT title FROM " . $wpdb->prefix . self::$wdr_rules_table . " WHERE id=" . $row_id);
367
  $rule_priority = $wpdb->get_row("SELECT max(priority) as priority FROM " . $wpdb->prefix . self::$wdr_rules_table);
368
  $priority = 1;
@@ -388,8 +430,11 @@ class WDRAjax extends Base
388
  global $wpdb;
389
  $rule_status = 'failed';
390
  $row_id = $this->input->post('rowid', '');
 
391
  $status = $this->input->post('changeto', 0);
 
392
  if (!empty($row_id) && ($status == 1 || $status == 0)) {
 
393
  $rule_status = $wpdb->update($wpdb->prefix . self::$wdr_rules_table,
394
  array(
395
  'enabled' => $status
@@ -417,6 +462,7 @@ class WDRAjax extends Base
417
  global $wpdb;
418
  $action_type = $this->input->post('wdr_bulk_action', '');
419
  $saved_rules = $this->input->post('saved_rules', '');
 
420
  if ($action_type == 'enable') {
421
  if (!empty($saved_rules) && is_array($saved_rules)) {
422
  foreach ($saved_rules as $saved_rule_id) {
@@ -425,7 +471,7 @@ class WDRAjax extends Base
425
  'enabled' => 1
426
  ),
427
  array(
428
- 'id' => $saved_rule_id
429
  ),
430
  array(
431
  '%d'
@@ -451,7 +497,7 @@ class WDRAjax extends Base
451
  'enabled' => 0
452
  ),
453
  array(
454
- 'id' => $saved_rule_id
455
  ),
456
  array(
457
  '%d'
@@ -477,7 +523,7 @@ class WDRAjax extends Base
477
  'deleted' => 1
478
  ),
479
  array(
480
- 'id' => $saved_rule_id
481
  ),
482
  array(
483
  '%d'
@@ -506,6 +552,7 @@ class WDRAjax extends Base
506
  */
507
  public function wdr_ajax_update_priority_order()
508
  {
 
509
  global $wpdb;
510
  $new_priority_order = $this->input->post('position', '');
511
  $priority = 1;
@@ -516,7 +563,7 @@ class WDRAjax extends Base
516
  'priority' => $priority
517
  ),
518
  array(
519
- 'id' => $value
520
  ),
521
  array(
522
  '%d'
@@ -537,11 +584,19 @@ class WDRAjax extends Base
537
  {
538
  $manage_discount = new ManageDiscount();
539
  $product = $this->input->post('product_id', '');
 
540
  $product_qty = $this->input->post('qty', '');
541
- $product = self::$woocommerce_helper->getProduct($product);
542
- $price_html = "<div class='price'></div>";
543
- $price_html = $manage_discount->getPriceHtml($price_html, $product, $product_qty, true);
544
- $original_html = self::$woocommerce_helper->getPriceHtml($product);
 
 
 
 
 
 
 
545
  wp_send_json(array('price_html'=>$price_html, 'original_price_html' => $original_html));
546
  }
547
  }
29
  $this->search_result_limit = apply_filters('advanced_woo_discount_rules_select_search_limit', $this->search_result_limit);
30
  }
31
 
32
+ protected function frontEndMethods(){
33
+ return array(
34
+ 'get_price_html'
35
+ );
36
+ }
37
+
38
  /**
39
  * Ajax Controller
40
  */
42
  {
43
  $result = null;
44
  $method = $this->input->post('method', '');
45
+ if(Helper::hasAdminPrivilege() || in_array($method, $this->frontEndMethods())){
46
+ $method_name = 'wdr_ajax_' . $method;
47
+ if (method_exists($this, $method_name)) {
48
+ $result = $this->$method_name();
49
+ }
50
+ } else {
51
+ $result = __('Authentication required', WDR_TEXT_DOMAIN);
52
  }
53
+
54
  wp_send_json_success($result);
55
  }
56
 
58
  * Process v1 to v2 migration
59
  * */
60
  public function wdr_ajax_do_v1_v2_migration(){
61
+ Helper::validateRequest('awdr_v2_migration');
62
  $status = \Wdr\App\Helpers\Migration::init();
63
  wp_send_json_success($status);
64
  }
65
 
66
  public function wdr_ajax_rebuild_onsale_list(){
67
+ Helper::validateRequest('wdr_ajax_rule_build_index');
68
  $shortcode_manager = new OnSaleShortCode();
69
  $rules = $this->input->post('rules', array());
70
  $status = $shortcode_manager->rebuildOnSaleList($rules);
85
  * */
86
  public function awdr_get_discount_of_a_product(){
87
  $product_id = $this->input->post('product_id', '');
88
+ $product_id = intval($product_id);
89
+ $result = false;
90
+ if($product_id){
91
+ $quantity = $this->input->post('qty', '');
92
+ $quantity = intval($quantity);
93
+ $product = Woocommerce::getProduct($product_id);
94
+ if($product){
95
+ $price = Woocommerce::getProductPrice($product);
96
+ $custom_price = $this->input->post('custom_price', '');
97
+ $custom_price = floatval($custom_price);
98
+ $result = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', $price, $product, $quantity, $custom_price, 'all', true);
99
+ if(!empty($result)){
100
+ $result = Helper::formatAllPrices($result);
101
+ }
102
+ }
103
  }
104
+
105
  wp_send_json_success($result);
106
  }
107
 
112
  */
113
  public function wdr_ajax_products()
114
  {
115
+ Helper::validateRequest('wdr_ajax_select2');
116
  $query = $this->input->post('query', '');
117
  //to disable other search classes
118
  remove_all_filters('woocommerce_data_stores');
132
  */
133
  public function wdr_ajax_product_category()
134
  {
135
+ Helper::validateRequest('wdr_ajax_select2');
136
  $taxonomy = apply_filters('advanced_woo_discount_rules_category_taxonomies', array('product_cat'));
137
  if(!is_array($taxonomy)){
138
  $taxonomy = array('product_cat');
161
  */
162
  public function wdr_ajax_product_tags()
163
  {
164
+ Helper::validateRequest('wdr_ajax_select2');
165
  $query = $this->input->post('query', '');
166
  $terms = get_terms(array('taxonomy' => 'product_tag', 'name__like' => $query, 'hide_empty' => false, 'number' => $this->search_result_limit));
167
  return array_map(function ($term) {
178
  */
179
  public function wdr_ajax_product_taxonomies()
180
  {
181
+ Helper::validateRequest('wdr_ajax_select2');
182
  $query = $this->input->post('query', '');
183
  $taxonomy_name = $this->input->post('taxonomy', '');
184
  $terms = get_terms(array('taxonomy' => $taxonomy_name,
208
  */
209
  public function wdr_ajax_product_sku()
210
  {
211
+ Helper::validateRequest('wdr_ajax_select2');
212
  global $wpdb;
213
  $query = $this->input->post('query', '');
214
+ $query = Helper::filterSelect2SearchQuery($query);
215
  $results = $wpdb->get_results("
216
  SELECT DISTINCT meta_value
217
  FROM $wpdb->postmeta
231
  */
232
  public function wdr_ajax_product_attributes()
233
  {
234
+ Helper::validateRequest('wdr_ajax_select2');
235
+
236
  global $wc_product_attributes, $wpdb;
237
  //return $wc_product_attributes;
238
  $query = $this->input->post('query', '');
239
+ $query = Helper::filterSelect2SearchQuery($query);
240
  $taxonomies = array_map(function ($item) {
241
  return "'$item'";
242
  }, array_keys($wc_product_attributes));
262
  */
263
  public function wdr_ajax_users_list()
264
  {
265
+ Helper::validateRequest('wdr_ajax_select2');
266
  $query = $this->input->post('query', '');
267
  $query = "*$query*";
268
  $users = get_users(array('fields' => array('ID', 'user_nicename'), 'search' => $query, 'orderby' => 'user_nicename'));
280
  */
281
  public function wdr_ajax_cart_coupon()
282
  {
283
+ Helper::validateRequest('wdr_ajax_select2');
284
  $posts_raw = get_posts(array(
285
  'posts_per_page' => '-1',
286
  'post_type' => 'shop_coupon',
309
  */
310
  public function wdr_ajax_save_configuration()
311
  {
312
+ Helper::validateRequest('wdr_ajax_save_configuration');
313
  $save_config = $this->input->post();
314
  $save_config['modify_price_at_shop_page'] = $this->input->post('modify_price_at_shop_page', 0);
315
  $save_config['modify_price_at_product_page'] = $this->input->post('modify_price_at_product_page', 0);
320
  $save_config['table_title_column'] = $this->input->post('table_title_column', 0);
321
  $save_config['table_discount_column'] = $this->input->post('table_discount_column', 0);
322
  $save_config['table_range_column'] = $this->input->post('table_range_column', 0);
323
+ $save_config['awdr_banner_editor'] = (isset($_POST['customize_banner_content'])) ? stripslashes($_POST['customize_banner_content']) : '';
324
+ if(empty($save_config['awdr_banner_editor'])){
325
+ $save_config['awdr_banner_editor'] = (isset($_POST['banner_content'])) ? stripslashes($_POST['banner_content']) : '';
326
+ }
327
  $save_config['on_sale_badge_html'] = (isset($_POST['on_sale_badge_html'])) ? stripslashes($_POST['on_sale_badge_html']) : '';
 
328
  $save_alert = $this->input->post('customizer_save_alert', 0) ;
329
  if($save_alert == "1"){
330
  $save_alert = "alert_in_popup";
331
+ } else {
 
332
  $save_alert = "alert_in_normal";
333
  }
334
  return array('result' => Configuration::saveConfig($save_config), 'save_popup' => $save_alert);
339
  */
340
  public function wdr_ajax_save_rule()
341
  {
342
+ Helper::validateRequest('wdr_ajax_save_rule');
343
  $rule_helper = new Rule();
344
  $post = $this->input->post();
345
  $post['title'] = (isset($_POST['title'])) ? stripslashes(sanitize_text_field($_POST['title'])) : '';
346
+ $post['product_adjustments']['cart_label'] = (isset($_POST['product_adjustments']) && isset($_POST['product_adjustments']['cart_label'])) ? stripslashes(sanitize_text_field($_POST['product_adjustments']['cart_label'])) : '';
347
+ $post['bulk_adjustments']['cart_label'] = (isset($_POST['bulk_adjustments']) && isset($_POST['bulk_adjustments']['cart_label'])) ? stripslashes(sanitize_text_field($_POST['bulk_adjustments']['cart_label'])) : '';
348
+ $post['set_adjustments']['cart_label'] = (isset($_POST['set_adjustments']) && isset($_POST['set_adjustments']['cart_label'])) ? stripslashes(sanitize_text_field($_POST['set_adjustments']['cart_label'])) : '';
349
  $rule_id = $rule_helper->save($post);
350
  if(isset($rule_id['coupon_exists'])){
351
  $coupon_message = $rule_id['coupon_exists'];
373
  global $wpdb;
374
  $deleted = 'failed';
375
  $row_id = $this->input->post('rowid', '');
376
+ $row_id = intval($row_id);
377
  if (!empty($row_id)) {
378
+ Helper::validateRequest('wdr_ajax_delete_rule'.$row_id);
379
  $deleted = $wpdb->update($wpdb->prefix . self::$wdr_rules_table,
380
  array(
381
  'deleted' => 1
402
  global $wpdb;
403
  $duplicated_id = 'failed';
404
  $row_id = $this->input->post('rowid', '');
405
+ $row_id = intval($row_id);
406
  if (!empty($row_id)) {
407
+ Helper::validateRequest('wdr_ajax_duplicate_rule'.$row_id);
408
  $rule_title = $wpdb->get_row("SELECT title FROM " . $wpdb->prefix . self::$wdr_rules_table . " WHERE id=" . $row_id);
409
  $rule_priority = $wpdb->get_row("SELECT max(priority) as priority FROM " . $wpdb->prefix . self::$wdr_rules_table);
410
  $priority = 1;
430
  global $wpdb;
431
  $rule_status = 'failed';
432
  $row_id = $this->input->post('rowid', '');
433
+ $row_id = intval($row_id);
434
  $status = $this->input->post('changeto', 0);
435
+ $status = intval($status);
436
  if (!empty($row_id) && ($status == 1 || $status == 0)) {
437
+ Helper::validateRequest('wdr_ajax_manage_status'.$row_id);
438
  $rule_status = $wpdb->update($wpdb->prefix . self::$wdr_rules_table,
439
  array(
440
  'enabled' => $status
462
  global $wpdb;
463
  $action_type = $this->input->post('wdr_bulk_action', '');
464
  $saved_rules = $this->input->post('saved_rules', '');
465
+ Helper::validateRequest('awdr_ajax_rule_bulk_actions');
466
  if ($action_type == 'enable') {
467
  if (!empty($saved_rules) && is_array($saved_rules)) {
468
  foreach ($saved_rules as $saved_rule_id) {
471
  'enabled' => 1
472
  ),
473
  array(
474
+ 'id' => intval($saved_rule_id)
475
  ),
476
  array(
477
  '%d'
497
  'enabled' => 0
498
  ),
499
  array(
500
+ 'id' => intval($saved_rule_id)
501
  ),
502
  array(
503
  '%d'
523
  'deleted' => 1
524
  ),
525
  array(
526
+ 'id' => intval($saved_rule_id)
527
  ),
528
  array(
529
  '%d'
552
  */
553
  public function wdr_ajax_update_priority_order()
554
  {
555
+ Helper::validateRequest('awdr_rule_list');
556
  global $wpdb;
557
  $new_priority_order = $this->input->post('position', '');
558
  $priority = 1;
563
  'priority' => $priority
564
  ),
565
  array(
566
+ 'id' => intval($value)
567
  ),
568
  array(
569
  '%d'
584
  {
585
  $manage_discount = new ManageDiscount();
586
  $product = $this->input->post('product_id', '');
587
+ $product = intval($product);
588
  $product_qty = $this->input->post('qty', '');
589
+ $product_qty = intval($product_qty);
590
+ $price_html = $original_html = '';
591
+ if($product){
592
+ $product = self::$woocommerce_helper->getProduct($product);
593
+ if($product){
594
+ $price_html = "<div class='price'></div>";
595
+ $price_html = $manage_discount->getPriceHtml($price_html, $product, $product_qty, true);
596
+ $original_html = self::$woocommerce_helper->getPriceHtml($product);
597
+ }
598
+ }
599
+
600
  wp_send_json(array('price_html'=>$price_html, 'original_price_html' => $original_html));
601
  }
602
  }
v2/App/Controllers/DiscountCalculator.php CHANGED
@@ -68,6 +68,9 @@ class DiscountCalculator extends Base
68
  } else {
69
  $product_price = self::$woocommerce_helper->getProductPrice($product);
70
  }
 
 
 
71
 
72
  $language_helper_object = self::$language_helper;
73
  $discount_calculator = $this;
@@ -91,6 +94,9 @@ class DiscountCalculator extends Base
91
  $has_bulk_discount = $rule->hasBulkDiscount();
92
  if ($has_bulk_discount) {
93
  if ($rule->isFilterPassed($product, true)) {
 
 
 
94
  $bulk_adjustments = $rule->getBulkAdjustments();
95
  if (isset($bulk_adjustments) && !empty($bulk_adjustments) && isset($bulk_adjustments->ranges) && !empty($bulk_adjustments->ranges)) {
96
  foreach ($bulk_adjustments->ranges as $range) {
@@ -173,6 +179,9 @@ class DiscountCalculator extends Base
173
  } else {
174
  $product_price = self::$woocommerce_helper->getProductPrice($product);
175
  }
 
 
 
176
  $language_helper_object = self::$language_helper;
177
  $discount_calculator = $this;
178
  foreach (self::$rules as $rule) {
68
  } else {
69
  $product_price = self::$woocommerce_helper->getProductPrice($product);
70
  }
71
+ if(empty($product_price)){
72
+ return array();
73
+ }
74
 
75
  $language_helper_object = self::$language_helper;
76
  $discount_calculator = $this;
94
  $has_bulk_discount = $rule->hasBulkDiscount();
95
  if ($has_bulk_discount) {
96
  if ($rule->isFilterPassed($product, true)) {
97
+ $hasFilter = $rule->hasFilter();
98
+ $filters = $rule->getFilter();
99
+ $product_price = apply_filters('advanced_woo_discount_rules_bulk_table_product_price', $product_price, $product, $calculate_discount_from, $hasFilter, $filters);
100
  $bulk_adjustments = $rule->getBulkAdjustments();
101
  if (isset($bulk_adjustments) && !empty($bulk_adjustments) && isset($bulk_adjustments->ranges) && !empty($bulk_adjustments->ranges)) {
102
  foreach ($bulk_adjustments->ranges as $range) {
179
  } else {
180
  $product_price = self::$woocommerce_helper->getProductPrice($product);
181
  }
182
+ if(empty($product_price)){
183
+ return array();
184
+ }
185
  $language_helper_object = self::$language_helper;
186
  $discount_calculator = $this;
187
  foreach (self::$rules as $rule) {
v2/App/Controllers/ManageDiscount.php CHANGED
@@ -376,6 +376,17 @@ class ManageDiscount extends Base
376
  if (!$modify_price) {
377
  return $price_html;
378
  }
 
 
 
 
 
 
 
 
 
 
 
379
  $original_prices_list = $discount_prices_lists = array();
380
  $variations = Woocommerce::getProductChildren($product);
381
 
@@ -1045,68 +1056,16 @@ class ManageDiscount extends Base
1045
  */
1046
  function orderItemsSaved($order_id, $items)
1047
  {
1048
- $model = new DBTable();
1049
  $applied_rules = array();
1050
- $buy_x_get_x_free_discounts = isset(Rule::$additional_discounts['buy_x_get_x_discounts']) ? Rule::$additional_discounts['buy_x_get_x_discounts'] : '';
1051
- $buy_x_get_y_free_discounts = isset(Rule::$additional_discounts['buy_x_get_y_discounts']) ? Rule::$additional_discounts['buy_x_get_y_discounts'] : '';
1052
 
 
1053
  if(!empty($buy_x_get_x_free_discounts)){
1054
- foreach ($buy_x_get_x_free_discounts as $buy_x_get_x_free_key => $buy_x_get_x_free_discount){
1055
- $simple_discount = $bulk_discount = $set_discount = $cart_discount = 0;
1056
- $rule_id = isset($buy_x_get_x_free_discount['rule_id']) ? $buy_x_get_x_free_discount['rule_id'] : 0;
1057
- $variant_item_id = isset($buy_x_get_x_free_discount['variation_id']) ? $buy_x_get_x_free_discount['variation_id'] : '';
1058
- $item_id = isset($buy_x_get_x_free_discount['product_id']) ? $buy_x_get_x_free_discount['product_id'] : 0;
1059
- if(!empty($variant_item_id)){
1060
- $item_id = $variant_item_id;
1061
- }
1062
- $free_product = isset($buy_x_get_x_free_discount['cart_item']['data']) ? $buy_x_get_x_free_discount['cart_item']['data'] : '';
1063
- $discount = Woocommerce::getProductPrice($free_product);
1064
- $discount_quantity = isset($buy_x_get_x_free_discount['discount_quantity']) ? $buy_x_get_x_free_discount['discount_quantity'] : 0;
1065
- $discount_price = $discount * $discount_quantity;
1066
- $cart_shipping = 'no';
1067
- $cart_discount_label = '';
1068
- if($discount_price != 0){
1069
- $applied_rules[] = $rule_id;
1070
- }
1071
- $model::saveOrderItemDiscounts($order_id, $item_id, 0, 0, $discount_price, $discount_quantity, $rule_id, $simple_discount, $bulk_discount, $set_discount, $cart_discount, $cart_discount_label, $cart_shipping);
1072
- }
1073
-
1074
  }
1075
- if(!empty($buy_x_get_y_free_discounts)){
1076
- foreach ($buy_x_get_y_free_discounts as $buy_x_get_y_free_key => $buy_x_get_y_free_discount){
1077
- $simple_discount = $bulk_discount = $set_discount = $cart_discount = 0;
1078
- $rule_id = isset($buy_x_get_y_free_discount['rule_id']) ? $buy_x_get_y_free_discount['rule_id'] : 0;
1079
- $variant_item_id = isset($buy_x_get_y_free_discount['variation_id']) ? $buy_x_get_y_free_discount['variation_id'] : 0;
1080
- $item_id = isset($buy_x_get_y_free_discount['product_id']) ? $buy_x_get_y_free_discount['product_id'] : 0;
1081
- if(!empty($variant_item_id)){
1082
- $item_id = $variant_item_id;
1083
- }
1084
- if($item_id != 0){
1085
- $free_product = isset($buy_x_get_y_free_discount['cart_item']['data']) ? $buy_x_get_y_free_discount['cart_item']['data'] : '';
1086
- $discount = Woocommerce::getProductPrice($free_product);
1087
- $discount_quantity = isset($buy_x_get_y_free_discount['discount_quantity']) ? $buy_x_get_y_free_discount['discount_quantity'] : 0;
1088
- $discount_price = $discount * $discount_quantity;
1089
- }else{
1090
- $discount_price = 0;
1091
- $discount_products = isset($buy_x_get_y_free_discount['discount_products']) ? $buy_x_get_y_free_discount['discount_products'] : array();
1092
- if(!empty($discount_products)){
1093
- foreach ($discount_products as $product_id){
1094
- $free_product = Woocommerce::getProduct((int)$product_id);
1095
- $discount = Woocommerce::getProductPrice($free_product);
1096
- $discount_quantity = isset($buy_x_get_y_free_discount['discount_quantity']) ? $buy_x_get_y_free_discount['discount_quantity'] : 0;
1097
- $discount_price += $discount * $discount_quantity;
1098
- }
1099
- }
1100
- }
1101
- $cart_shipping = 'no';
1102
- $cart_discount_label = '';
1103
-
1104
- if($discount_price != 0){
1105
- $applied_rules[] = $rule_id;
1106
- }
1107
- $model::saveOrderItemDiscounts($order_id, $item_id, 0, 0, $discount_price, $discount_quantity, $rule_id, $simple_discount, $bulk_discount, $set_discount, $cart_discount, $cart_discount_label, $cart_shipping);
1108
- }
1109
 
 
 
 
1110
  }
1111
 
1112
  if (!empty(self::$calculated_cart_item_discount)) {
@@ -1115,6 +1074,7 @@ class ManageDiscount extends Base
1115
  if (empty($product_id)) {
1116
  return false;
1117
  }
 
1118
  $initial_price = floatval(isset($discount['initial_price_with_tax']) ? $discount['initial_price_with_tax'] : 0);
1119
  $discounted_price = floatval(isset($discount['discounted_price_with_tax']) ? $discount['discounted_price_with_tax'] : 0);
1120
  $cart_quantity = floatval(isset($discount['cart_quantity']) ? $discount['cart_quantity'] : 0);
@@ -1122,10 +1082,8 @@ class ManageDiscount extends Base
1122
  $cart_discount_details = isset($discount['cart_discount_details']) ? $discount['cart_discount_details'] : array();
1123
  if (!empty($total_discount_details)) {
1124
  $save_order_item_discounts_array = isset($total_discount_details[$cart_key])? $total_discount_details[$cart_key]: array();
1125
- } else {
1126
- $save_order_item_discounts_array = $cart_discount_details;
1127
  }
1128
- if (!empty($save_order_item_discounts_array)) {
1129
  foreach ($save_order_item_discounts_array as $key => $value) {
1130
  $simple_discount = $bulk_discount = $set_discount = $cart_discount = 0;
1131
  $rule_id = $key;
@@ -1133,8 +1091,17 @@ class ManageDiscount extends Base
1133
  $cart_shipping = (isset($cart_discount_details[$rule_id]['cart_shipping']) && !empty($cart_discount_details[$rule_id]['cart_shipping'])) ? $cart_discount_details[$rule_id]['cart_shipping'] : 'no';
1134
  $cart_discount_label = isset($cart_discount_details[$rule_id]['cart_discount_label']) ? $cart_discount_details[$rule_id]['cart_discount_label'] : '';
1135
  $simple_discount = isset($value['simple_discount']) ? $value['simple_discount'] : 0;
 
1136
  $bulk_discount = isset($value['bulk_discount']) ? $value['bulk_discount'] : 0;
 
1137
  $set_discount = isset($value['set_discount']['discount_value']) ? $value['set_discount']['discount_value'] : 0;
 
 
 
 
 
 
 
1138
  $bxgx_discount_price = isset($value['buy_x_get_x_discount']['discount_price_per_quantity']) ? $value['buy_x_get_x_discount']['discount_price_per_quantity'] : 0;
1139
  $bxgx_discount_qty = isset($value['buy_x_get_x_discount']['discount_quantity']) ? $value['buy_x_get_x_discount']['discount_quantity'] : 0;
1140
  $bxgx_discount = $bxgx_discount_price * $bxgx_discount_qty;
@@ -1144,14 +1111,25 @@ class ManageDiscount extends Base
1144
  $bxgy_cheapest_discount_price = isset($value['buy_x_get_y_cheapest_in_cart_discount']['discount_price_per_quantity']) ? $value['buy_x_get_y_cheapest_in_cart_discount']['discount_price_per_quantity'] : 0;
1145
  $bxgy_cheapest_discount_qty = isset($value['buy_x_get_y_cheapest_in_cart_discount']['discount_quantity']) ? $value['buy_x_get_y_cheapest_in_cart_discount']['discount_quantity'] : 0;
1146
  $bxgy_cheapest_discount = $bxgy_cheapest_discount_price * $bxgy_cheapest_discount_qty;
1147
- $discount_price = $simple_discount + $bulk_discount + $set_discount + $bxgx_discount + $bxgy_discount + $bxgy_cheapest_discount;
 
 
 
 
 
 
 
 
 
 
 
1148
  if ($discount_price < 0) {
1149
  $discount_price = 0;
1150
  }
1151
  if($discount_price != 0){
1152
  $applied_rules[] = $rule_id;
1153
  }
1154
- $model::saveOrderItemDiscounts($order_id, $product_id, $initial_price, $discounted_price, $discount_price, $cart_quantity, $rule_id, $simple_discount, $bulk_discount, $set_discount, $cart_discount, $cart_discount_label, $cart_shipping);
1155
  }
1156
  if (!empty($cart_discount_details)) {
1157
  foreach ($cart_discount_details as $key => $value) {
@@ -1164,7 +1142,7 @@ class ManageDiscount extends Base
1164
  if($cart_discount != 0){
1165
  $applied_rules[] = $rule_id;
1166
  }
1167
- $model::saveOrderItemDiscounts($order_id, 0, 0, $discounted_price, 0, 0, $rule_id, $simple_discount, $bulk_discount, $set_discount, $cart_discount, $cart_discount_label, $cart_shipping);
1168
  }
1169
  }
1170
  }
@@ -1179,7 +1157,7 @@ class ManageDiscount extends Base
1179
  $cart_discount = isset($cart_discount_details[$rule_id]['cart_discount']) ? $cart_discount_details[$rule_id]['cart_discount'] : '';
1180
  $cart_shipping = (isset($cart_discount_details[$rule_id]['cart_shipping']) && !empty($cart_discount_details[$rule_id]['cart_shipping'])) ? $cart_discount_details[$rule_id]['cart_shipping'] : 'no';
1181
  $cart_discount_label = isset($cart_discount_details[$rule_id]['cart_discount_label']) ? $cart_discount_details[$rule_id]['cart_discount_label'] : '';
1182
- $model::saveOrderItemDiscounts($order_id, 0, 0, $discount_price, 0, 0, $rule_id, $simple_discount, $bulk_discount, $set_discount, $cart_discount, $cart_discount_label, $cart_shipping);
1183
  }
1184
  }
1185
  $calc = self::$calculator;
@@ -1187,7 +1165,7 @@ class ManageDiscount extends Base
1187
  if (!empty($applied_rules)) {
1188
  foreach ($applied_rules as $rule) {
1189
  $used_limits = intval($rule->getUsedLimits()) + 1;
1190
- $model::updateRuleUsedCount($rule->getId(), $used_limits);
1191
  }
1192
  }
1193
  if (!empty(self::$calculated_cart_discount)) {
@@ -1203,7 +1181,81 @@ class ManageDiscount extends Base
1203
  }
1204
  }
1205
  }
1206
- $model::saveOrderDiscounts($order_id, $free_shipping, $discount_details);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1207
  }
1208
  }
1209
  }
376
  if (!$modify_price) {
377
  return $price_html;
378
  }
379
+
380
+ if (is_product() && empty(self::$config->getConfig('modify_price_at_product_page', 1))) {
381
+ return $price_html;
382
+ }
383
+ if (is_shop() && empty(self::$config->getConfig('modify_price_at_shop_page', 1))) {
384
+ return $price_html;
385
+ }
386
+ if (is_product_category() && empty(self::$config->getConfig('modify_price_at_category_page', 1))) {
387
+ return $price_html;
388
+ }
389
+
390
  $original_prices_list = $discount_prices_lists = array();
391
  $variations = Woocommerce::getProductChildren($product);
392
 
1056
  */
1057
  function orderItemsSaved($order_id, $items)
1058
  {
 
1059
  $applied_rules = array();
 
 
1060
 
1061
+ $buy_x_get_x_free_discounts = isset(Rule::$additional_discounts['buy_x_get_x_discounts']) ? Rule::$additional_discounts['buy_x_get_x_discounts'] : '';
1062
  if(!empty($buy_x_get_x_free_discounts)){
1063
+ $this->orderItemsSavedForBXGXFree($buy_x_get_x_free_discounts, $order_id, $items);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1064
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1065
 
1066
+ $buy_x_get_y_free_discounts = isset(Rule::$additional_discounts['buy_x_get_y_discounts']) ? Rule::$additional_discounts['buy_x_get_y_discounts'] : '';
1067
+ if(!empty($buy_x_get_y_free_discounts)){
1068
+ $this->orderItemsSavedForBXGYFree($buy_x_get_y_free_discounts, $order_id, $items);
1069
  }
1070
 
1071
  if (!empty(self::$calculated_cart_item_discount)) {
1074
  if (empty($product_id)) {
1075
  return false;
1076
  }
1077
+ $save_order_item_discounts_array = array();
1078
  $initial_price = floatval(isset($discount['initial_price_with_tax']) ? $discount['initial_price_with_tax'] : 0);
1079
  $discounted_price = floatval(isset($discount['discounted_price_with_tax']) ? $discount['discounted_price_with_tax'] : 0);
1080
  $cart_quantity = floatval(isset($discount['cart_quantity']) ? $discount['cart_quantity'] : 0);
1082
  $cart_discount_details = isset($discount['cart_discount_details']) ? $discount['cart_discount_details'] : array();
1083
  if (!empty($total_discount_details)) {
1084
  $save_order_item_discounts_array = isset($total_discount_details[$cart_key])? $total_discount_details[$cart_key]: array();
 
 
1085
  }
1086
+ if (!empty($save_order_item_discounts_array) || !empty($cart_discount_details)) {
1087
  foreach ($save_order_item_discounts_array as $key => $value) {
1088
  $simple_discount = $bulk_discount = $set_discount = $cart_discount = 0;
1089
  $rule_id = $key;
1091
  $cart_shipping = (isset($cart_discount_details[$rule_id]['cart_shipping']) && !empty($cart_discount_details[$rule_id]['cart_shipping'])) ? $cart_discount_details[$rule_id]['cart_shipping'] : 'no';
1092
  $cart_discount_label = isset($cart_discount_details[$rule_id]['cart_discount_label']) ? $cart_discount_details[$rule_id]['cart_discount_label'] : '';
1093
  $simple_discount = isset($value['simple_discount']) ? $value['simple_discount'] : 0;
1094
+ $simple_discount = $simple_discount * $cart_quantity;
1095
  $bulk_discount = isset($value['bulk_discount']) ? $value['bulk_discount'] : 0;
1096
+ $bulk_discount = $bulk_discount * $cart_quantity;
1097
  $set_discount = isset($value['set_discount']['discount_value']) ? $value['set_discount']['discount_value'] : 0;
1098
+ $set_discounted_price_quantity = isset($value['set_discount']['discounted_price_quantity']) ? $value['set_discount']['discounted_price_quantity'] : 0;
1099
+ if(!empty($set_discounted_price_quantity)){
1100
+ $set_discount = $set_discount * $set_discounted_price_quantity;
1101
+ }else{
1102
+ $set_discount = $set_discount * $cart_quantity;
1103
+ }
1104
+
1105
  $bxgx_discount_price = isset($value['buy_x_get_x_discount']['discount_price_per_quantity']) ? $value['buy_x_get_x_discount']['discount_price_per_quantity'] : 0;
1106
  $bxgx_discount_qty = isset($value['buy_x_get_x_discount']['discount_quantity']) ? $value['buy_x_get_x_discount']['discount_quantity'] : 0;
1107
  $bxgx_discount = $bxgx_discount_price * $bxgx_discount_qty;
1111
  $bxgy_cheapest_discount_price = isset($value['buy_x_get_y_cheapest_in_cart_discount']['discount_price_per_quantity']) ? $value['buy_x_get_y_cheapest_in_cart_discount']['discount_price_per_quantity'] : 0;
1112
  $bxgy_cheapest_discount_qty = isset($value['buy_x_get_y_cheapest_in_cart_discount']['discount_quantity']) ? $value['buy_x_get_y_cheapest_in_cart_discount']['discount_quantity'] : 0;
1113
  $bxgy_cheapest_discount = $bxgy_cheapest_discount_price * $bxgy_cheapest_discount_qty;
1114
+ $buy_x_get_y_cheapest_additional = isset($value['buy_x_get_y_cheapest_in_cart_discount']['additional_discounts']) ? $value['buy_x_get_y_cheapest_in_cart_discount']['additional_discounts'] : '';
1115
+ $bogo_cheapest_aditional_sum = 0;
1116
+ if(!empty($buy_x_get_y_cheapest_additional)) {
1117
+ $bogo_cheapest_aditional = array();
1118
+ foreach ($buy_x_get_y_cheapest_additional as $aditional) {
1119
+ $bogo_cheapest_discount_aditional = isset($aditional['discount_price_per_quantity']) ? $aditional['discount_price_per_quantity'] : 0;
1120
+ $bogo_cheapest_quantity_aditional = isset($aditional['discount_quantity']) ? $aditional['discount_quantity'] : 0;
1121
+ $bogo_cheapest_aditional[] = $bogo_cheapest_discount_aditional * $bogo_cheapest_quantity_aditional;
1122
+ }
1123
+ $bogo_cheapest_aditional_sum = array_sum($bogo_cheapest_aditional);
1124
+ }
1125
+ $discount_price = $simple_discount + $bulk_discount + $set_discount + $bxgx_discount + $bxgy_discount + $bxgy_cheapest_discount + $bogo_cheapest_aditional_sum;
1126
  if ($discount_price < 0) {
1127
  $discount_price = 0;
1128
  }
1129
  if($discount_price != 0){
1130
  $applied_rules[] = $rule_id;
1131
  }
1132
+ DBTable::saveOrderItemDiscounts($order_id, $product_id, $initial_price, $discounted_price, $discount_price, $cart_quantity, $rule_id, $simple_discount, $bulk_discount, $set_discount, $cart_discount, $cart_discount_label, $cart_shipping);
1133
  }
1134
  if (!empty($cart_discount_details)) {
1135
  foreach ($cart_discount_details as $key => $value) {
1142
  if($cart_discount != 0){
1143
  $applied_rules[] = $rule_id;
1144
  }
1145
+ DBTable::saveOrderItemDiscounts($order_id, 0, 0, $discounted_price, 0, 0, $rule_id, 0, 0, 0, $cart_discount, $cart_discount_label, $cart_shipping);
1146
  }
1147
  }
1148
  }
1157
  $cart_discount = isset($cart_discount_details[$rule_id]['cart_discount']) ? $cart_discount_details[$rule_id]['cart_discount'] : '';
1158
  $cart_shipping = (isset($cart_discount_details[$rule_id]['cart_shipping']) && !empty($cart_discount_details[$rule_id]['cart_shipping'])) ? $cart_discount_details[$rule_id]['cart_shipping'] : 'no';
1159
  $cart_discount_label = isset($cart_discount_details[$rule_id]['cart_discount_label']) ? $cart_discount_details[$rule_id]['cart_discount_label'] : '';
1160
+ DBTable::saveOrderItemDiscounts($order_id, 0, 0, $discount_price, 0, 0, $rule_id, $simple_discount, $bulk_discount, $set_discount, $cart_discount, $cart_discount_label, $cart_shipping);
1161
  }
1162
  }
1163
  $calc = self::$calculator;
1165
  if (!empty($applied_rules)) {
1166
  foreach ($applied_rules as $rule) {
1167
  $used_limits = intval($rule->getUsedLimits()) + 1;
1168
+ DBTable::updateRuleUsedCount($rule->getId(), $used_limits);
1169
  }
1170
  }
1171
  if (!empty(self::$calculated_cart_discount)) {
1181
  }
1182
  }
1183
  }
1184
+ DBTable::saveOrderDiscounts($order_id, $free_shipping, $discount_details);
1185
+ }
1186
+ }
1187
+ }
1188
+
1189
+ /**
1190
+ * Bxgx free product amount data
1191
+ * @param $buy_x_get_x_free_discounts
1192
+ * @param $order_id
1193
+ * @param $items
1194
+ */
1195
+ function orderItemsSavedForBXGXFree($buy_x_get_x_free_discounts, $order_id, $items){
1196
+ if(!empty($buy_x_get_x_free_discounts)){
1197
+ foreach ($buy_x_get_x_free_discounts as $buy_x_get_x_free_key => $buy_x_get_x_free_discount){
1198
+ $simple_discount = $bulk_discount = $set_discount = $cart_discount = 0;
1199
+ $rule_id = isset($buy_x_get_x_free_discount['rule_id']) ? $buy_x_get_x_free_discount['rule_id'] : 0;
1200
+ $variant_item_id = isset($buy_x_get_x_free_discount['variation_id']) ? $buy_x_get_x_free_discount['variation_id'] : '';
1201
+ $item_id = isset($buy_x_get_x_free_discount['product_id']) ? $buy_x_get_x_free_discount['product_id'] : 0;
1202
+ if(!empty($variant_item_id)){
1203
+ $item_id = $variant_item_id;
1204
+ }
1205
+ $free_product = isset($buy_x_get_x_free_discount['cart_item']['data']) ? $buy_x_get_x_free_discount['cart_item']['data'] : '';
1206
+ $discount = Woocommerce::getProductPrice($free_product);
1207
+ $discount_quantity = isset($buy_x_get_x_free_discount['discount_quantity']) ? $buy_x_get_x_free_discount['discount_quantity'] : 0;
1208
+ $discount_price = $discount * $discount_quantity;
1209
+ $cart_shipping = 'no';
1210
+ $cart_discount_label = '';
1211
+ if($discount_price != 0){
1212
+ $applied_rules[] = $rule_id;
1213
+ }
1214
+ DBTable::saveOrderItemDiscounts($order_id, $item_id, 0, 0, $discount_price, $discount_quantity, $rule_id, $simple_discount, $bulk_discount, $set_discount, $cart_discount, $cart_discount_label, $cart_shipping);
1215
+ }
1216
+ }
1217
+ }
1218
+
1219
+ /**
1220
+ * Bxgy free product amount data
1221
+ * @param $buy_x_get_y_free_discounts
1222
+ * @param $order_id
1223
+ * @param $items
1224
+ */
1225
+ function orderItemsSavedForBXGYFree($buy_x_get_y_free_discounts, $order_id, $items){
1226
+ if(!empty($buy_x_get_y_free_discounts)){
1227
+ foreach ($buy_x_get_y_free_discounts as $buy_x_get_y_free_key => $buy_x_get_y_free_discount){
1228
+ $simple_discount = $bulk_discount = $set_discount = $cart_discount = $discount_quantity = 0;
1229
+ $rule_id = isset($buy_x_get_y_free_discount['rule_id']) ? $buy_x_get_y_free_discount['rule_id'] : 0;
1230
+ $variant_item_id = isset($buy_x_get_y_free_discount['variation_id']) ? $buy_x_get_y_free_discount['variation_id'] : 0;
1231
+ $item_id = isset($buy_x_get_y_free_discount['product_id']) ? $buy_x_get_y_free_discount['product_id'] : 0;
1232
+ if(!empty($variant_item_id)){
1233
+ $item_id = $variant_item_id;
1234
+ }
1235
+ if($item_id != 0){
1236
+ $free_product = isset($buy_x_get_y_free_discount['cart_item']['data']) ? $buy_x_get_y_free_discount['cart_item']['data'] : '';
1237
+ $discount = Woocommerce::getProductPrice($free_product);
1238
+ $discount_quantity = isset($buy_x_get_y_free_discount['discount_quantity']) ? $buy_x_get_y_free_discount['discount_quantity'] : 0;
1239
+ $discount_price = $discount * $discount_quantity;
1240
+ }else{
1241
+ $discount_price = 0;
1242
+ $discount_products = isset($buy_x_get_y_free_discount['discount_products']) ? $buy_x_get_y_free_discount['discount_products'] : array();
1243
+ if(!empty($discount_products)){
1244
+ foreach ($discount_products as $product_id){
1245
+ $free_product = Woocommerce::getProduct((int)$product_id);
1246
+ $discount = Woocommerce::getProductPrice($free_product);
1247
+ $discount_quantity = isset($buy_x_get_y_free_discount['discount_quantity']) ? $buy_x_get_y_free_discount['discount_quantity'] : 0;
1248
+ $discount_price += $discount * $discount_quantity;
1249
+ }
1250
+ }
1251
+ }
1252
+ $cart_shipping = 'no';
1253
+ $cart_discount_label = '';
1254
+
1255
+ if($discount_price != 0){
1256
+ $applied_rules[] = $rule_id;
1257
+ }
1258
+ DBTable::saveOrderItemDiscounts($order_id, $item_id, 0, 0, $discount_price, $discount_quantity, $rule_id, $simple_discount, $bulk_discount, $set_discount, $cart_discount, $cart_discount_label, $cart_shipping);
1259
  }
1260
  }
1261
  }
v2/App/Controllers/OnSaleShortCode.php CHANGED
@@ -267,6 +267,7 @@ class OnSaleShortCode extends ManageDiscount
267
  if(!empty($query_args)){
268
  $query_args['post_type'] = 'product';
269
  $query_args['post_status'] = 'publish';
 
270
  $products = new \WP_Query($query_args);
271
  $post_ids = wp_list_pluck( $products->posts, 'ID' );
272
  } else {
267
  if(!empty($query_args)){
268
  $query_args['post_type'] = 'product';
269
  $query_args['post_status'] = 'publish';
270
+ $query_args['posts_per_page'] = -1;
271
  $products = new \WP_Query($query_args);
272
  $post_ids = wp_list_pluck( $products->posts, 'ID' );
273
  } else {
v2/App/Helpers/Helper.php CHANGED
@@ -209,5 +209,62 @@ class Helper
209
  ', WDR_TEXT_DOMAIN);
210
  }
211
 
 
 
 
 
 
 
 
 
 
 
 
212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  }
209
  ', WDR_TEXT_DOMAIN);
210
  }
211
 
212
+ public static function create_nonce($action = -1){
213
+ return wp_create_nonce($action);
214
+ }
215
+
216
+ protected static function verify_nonce($nonce, $action = -1 ){
217
+ if (wp_verify_nonce($nonce, $action)){
218
+ return true;
219
+ } else {
220
+ return false;
221
+ }
222
+ }
223
 
224
+ public static function validateRequest($method, $awdr_nonce = null){
225
+ if($awdr_nonce === null){
226
+ if(isset($_REQUEST['awdr_nonce']) && !empty($_REQUEST['awdr_nonce'])){
227
+ if(self::verify_nonce(wp_unslash($_REQUEST['awdr_nonce']), $method)){
228
+ return true;
229
+ }
230
+ }
231
+ } else {
232
+ if(self::verify_nonce(wp_unslash($awdr_nonce), $method)){
233
+ return true;
234
+ }
235
+ }
236
+
237
+ die(__('Invalid token', WDR_TEXT_DOMAIN));
238
+ }
239
+
240
+ public static function filterSelect2SearchQuery($query){
241
+ return esc_sql(stripslashes($query));
242
+ }
243
+
244
+ public static function displayCompatibleCheckMessages(){
245
+ if(version_compare(WDR_VERSION, '2.1.0', '>=')){
246
+ if(defined('WDR_PRO_VERSION')){
247
+ if(version_compare(WDR_PRO_VERSION, '2.1.0', '<')){
248
+ $url = admin_url()."plugins.php";
249
+ $plugin_page = '<a target="_blank" href="'.$url.'">'.__('Update now', WDR_TEXT_DOMAIN).'</a>';
250
+ ?>
251
+ <br>
252
+ <div class="notice inline notice notice-warning notice-alt awdr-rule-limit-disabled">
253
+ <p class="rule_limit_msg_future">
254
+ <?php echo sprintf(__('You are using a lower version of our <b>Woo Discount Rules PRO 2.0</b> plugin. Please update the plugin to latest version to run smoothly. %s', WDR_TEXT_DOMAIN), $plugin_page); ?>
255
+ </p>
256
+ </div>
257
+ <?php
258
+ }
259
+ }
260
+ }
261
+ }
262
+
263
+ public static function hasAdminPrivilege(){
264
+ if (current_user_can( 'manage_woocommerce' )) {
265
+ return true;
266
+ } else {
267
+ return false;
268
+ }
269
+ }
270
  }
v2/App/Helpers/Input.php CHANGED
@@ -838,10 +838,6 @@ class Input
838
  return FALSE;
839
  }
840
  }
841
- // Unfortunately, none of the following PRNGs is guaranteed to exist ...
842
- if (defined('MCRYPT_DEV_URANDOM') && ($output = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM)) !== FALSE) {
843
- return $output;
844
- }
845
  if (is_readable('/dev/urandom') && ($fp = fopen('/dev/urandom', 'rb')) !== FALSE) {
846
  // Try not to waste entropy ...
847
  is_php('5.4') && stream_set_chunk_size($fp, $length);
838
  return FALSE;
839
  }
840
  }
 
 
 
 
841
  if (is_readable('/dev/urandom') && ($fp = fopen('/dev/urandom', 'rb')) !== FALSE) {
842
  // Try not to waste entropy ...
843
  is_php('5.4') && stream_set_chunk_size($fp, $length);
v2/App/Helpers/Migration.php CHANGED
@@ -1003,7 +1003,7 @@ class Migration
1003
  $query_array = $object->query;
1004
  if(isset($query_array['awdr_last_upgrade_id'])){
1005
  if($query_array['awdr_last_upgrade_id'] > 0){
1006
- $last_id = (int)$query_array['awdr_last_upgrade_id'];
1007
  $where .= " AND ".$wpdb->posts.".ID > ".$last_id." ";
1008
  }
1009
  }
1003
  $query_array = $object->query;
1004
  if(isset($query_array['awdr_last_upgrade_id'])){
1005
  if($query_array['awdr_last_upgrade_id'] > 0){
1006
+ $last_id = intval($query_array['awdr_last_upgrade_id']);
1007
  $where .= " AND ".$wpdb->posts.".ID > ".$last_id." ";
1008
  }
1009
  }
v2/App/Helpers/Rule.php CHANGED
@@ -690,7 +690,7 @@ class Rule
690
  }
691
  $cart_items = self::$woocommerce_helper->getCart();
692
  $discount = $this->getProductAdjustments();
693
- if($discount){
694
  if(($price_display_condition == "show_when_matched" && !$is_cart) || ($price_display_condition == "show_dynamically" && !$is_cart)){
695
  if($manual_request === false){
696
  $quantity = 1;
@@ -1242,7 +1242,7 @@ class Rule
1242
  $current_date_time = date('Y-m-d H:i:s', $current_time);
1243
  }
1244
  $current_user = get_current_user_id();
1245
- $rule_id = $this->getFromArray($post, 'edit_rule', NULL);
1246
  $title = $this->getFromArray($post, 'title', esc_html__('Untitled Rule', WDR_TEXT_DOMAIN));
1247
  $enabled = $this->getFromArray($post, 'enabled', '0');
1248
  $exclusive = $this->getFromArray($post, 'exclusive', '0');
@@ -1319,12 +1319,19 @@ class Rule
1319
  if(!empty($awdr_coupon_names)){
1320
  $awdr_coupon_names = array_unique($awdr_coupon_names);
1321
  }
 
 
 
 
 
 
1322
  $current_time = current_time('mysql', true);
 
1323
  $arg = array(
1324
- 'title' => (empty($title)) ? esc_html__('Untitled Rule', WDR_TEXT_DOMAIN) : $title,
1325
- 'enabled' => $enabled,
1326
- 'exclusive' => $exclusive,
1327
- 'usage_limits' => $usage_limits,
1328
  'date_from' => $date_from,
1329
  'date_to' => $date_to,
1330
  'filters' => json_encode($rule_filters),
@@ -1338,18 +1345,18 @@ class Rule
1338
  'rule_language' => json_encode($rule_language),
1339
  'set_adjustments' => json_encode($set_adjustments),
1340
  'advanced_discount_message' => json_encode($discount_badge),
1341
- 'discount_type' => $discount_type,
1342
  'used_coupons' => json_encode($awdr_coupon_names),
1343
  );
1344
  if (!is_null($rule_id) && !empty($rule_id)) {
1345
- $arg['modified_by'] = $current_user;
1346
- $arg['modified_on'] = $current_date_time;
1347
  $column_format = array('%s', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%s');
1348
  }else{
1349
- $arg['created_by'] = $current_user;
1350
- $arg['created_on'] = $current_date_time;
1351
- $arg['modified_by'] = $current_user;
1352
- $arg['modified_on'] = $current_date_time;
1353
  $column_format = array('%s', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%s');
1354
  }
1355
  $arg = apply_filters( 'advanced_woo_discount_rules_before_save_rule_column', $arg, $rule_id, $post);
690
  }
691
  $cart_items = self::$woocommerce_helper->getCart();
692
  $discount = $this->getProductAdjustments();
693
+ if(isset($discount->type) && !empty($discount->type) && isset($discount->value) && !empty($discount->value)){
694
  if(($price_display_condition == "show_when_matched" && !$is_cart) || ($price_display_condition == "show_dynamically" && !$is_cart)){
695
  if($manual_request === false){
696
  $quantity = 1;
1242
  $current_date_time = date('Y-m-d H:i:s', $current_time);
1243
  }
1244
  $current_user = get_current_user_id();
1245
+ $rule_id = intval($this->getFromArray($post, 'edit_rule', NULL));
1246
  $title = $this->getFromArray($post, 'title', esc_html__('Untitled Rule', WDR_TEXT_DOMAIN));
1247
  $enabled = $this->getFromArray($post, 'enabled', '0');
1248
  $exclusive = $this->getFromArray($post, 'exclusive', '0');
1319
  if(!empty($awdr_coupon_names)){
1320
  $awdr_coupon_names = array_unique($awdr_coupon_names);
1321
  }
1322
+ if($date_from !== null){
1323
+ $date_from = intval($date_from);
1324
+ }
1325
+ if($date_to !== null){
1326
+ $date_to = intval($date_to);
1327
+ }
1328
  $current_time = current_time('mysql', true);
1329
+ $rule_title = (empty($title)) ? esc_html__('Untitled Rule', WDR_TEXT_DOMAIN) : $title;
1330
  $arg = array(
1331
+ 'title' => sanitize_text_field($rule_title),
1332
+ 'enabled' => intval($enabled),
1333
+ 'exclusive' => intval($exclusive),
1334
+ 'usage_limits' => intval($usage_limits),
1335
  'date_from' => $date_from,
1336
  'date_to' => $date_to,
1337
  'filters' => json_encode($rule_filters),
1345
  'rule_language' => json_encode($rule_language),
1346
  'set_adjustments' => json_encode($set_adjustments),
1347
  'advanced_discount_message' => json_encode($discount_badge),
1348
+ 'discount_type' => esc_sql($discount_type),
1349
  'used_coupons' => json_encode($awdr_coupon_names),
1350
  );
1351
  if (!is_null($rule_id) && !empty($rule_id)) {
1352
+ $arg['modified_by'] = intval($current_user);
1353
+ $arg['modified_on'] = esc_sql($current_date_time);
1354
  $column_format = array('%s', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%s');
1355
  }else{
1356
+ $arg['created_by'] = intval($current_user);
1357
+ $arg['created_on'] = esc_sql($current_date_time);
1358
+ $arg['modified_by'] = intval($current_user);
1359
+ $arg['modified_on'] = esc_sql($current_date_time);
1360
  $column_format = array('%s', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%s');
1361
  }
1362
  $arg = apply_filters( 'advanced_woo_discount_rules_before_save_rule_column', $arg, $rule_id, $post);
v2/App/Helpers/Woocommerce.php CHANGED
@@ -134,6 +134,14 @@ class Woocommerce
134
  return false;
135
  }
136
 
 
 
 
 
 
 
 
 
137
  /**
138
  * Get the product from Cart item data/product id
139
  * @param $cart_item object
134
  return false;
135
  }
136
 
137
+ static function is_ajax()
138
+ {
139
+ if (function_exists('is_ajax')) {
140
+ return is_ajax();
141
+ }
142
+ return false;
143
+ }
144
+
145
  /**
146
  * Get the product from Cart item data/product id
147
  * @param $cart_item object
v2/App/Models/DBTable.php CHANGED
@@ -3,6 +3,7 @@
3
  namespace Wdr\App\Models;
4
 
5
  use Wdr\App\Helpers\Language;
 
6
 
7
  if (!defined('ABSPATH')) exit;
8
 
@@ -45,28 +46,28 @@ class DBTable
45
  `enabled` tinyint(1) DEFAULT '1',
46
  `deleted` tinyint(1) DEFAULT '0',
47
  `exclusive` tinyint(1) DEFAULT '0',
48
- `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
49
  `priority` int(11) DEFAULT NULL,
50
- `apply_to` text COLLATE utf8mb4_unicode_ci,
51
- `filters` text COLLATE utf8mb4_unicode_ci NOT NULL,
52
- `conditions` text COLLATE utf8mb4_unicode_ci,
53
- `product_adjustments` text COLLATE utf8mb4_unicode_ci,
54
- `cart_adjustments` text COLLATE utf8mb4_unicode_ci,
55
- `buy_x_get_x_adjustments` text COLLATE utf8mb4_unicode_ci,
56
- `buy_x_get_y_adjustments` text COLLATE utf8mb4_unicode_ci,
57
- `bulk_adjustments` text COLLATE utf8mb4_unicode_ci NOT NULL,
58
- `set_adjustments` text COLLATE utf8mb4_unicode_ci NOT NULL,
59
- `other_discounts` text COLLATE utf8mb4_unicode_ci,
60
  `date_from` int(11) DEFAULT NULL,
61
  `date_to` int(11) DEFAULT NULL,
62
  `usage_limits` int(11) DEFAULT NULL,
63
- `rule_language` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
64
  `used_limits` int(11) DEFAULT NULL,
65
- `additional` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
66
- `max_discount_sum` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
67
- `advanced_discount_message` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
68
- `discount_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
69
- `used_coupons` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
70
  `created_by` int(11) DEFAULT NULL,
71
  `created_on` datetime DEFAULT NULL,
72
  `modified_by` int(11) DEFAULT NULL,
@@ -99,7 +100,7 @@ class DBTable
99
  `set_discount` float NOT NULL,
100
  `cart_discount` float NOT NULL,
101
  `has_free_shipping` enum('yes','no') NOT NULL DEFAULT 'no',
102
- `cart_discount_label` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
103
  `other_price` float NOT NULL DEFAULT '0',
104
  `created_at` datetime DEFAULT NULL,
105
  `updated_at` datetime DEFAULT NULL,
@@ -119,7 +120,7 @@ class DBTable
119
 
120
  protected static function isFrontEndRequest(){
121
  $is_front_end_request = false;
122
- if(is_ajax()){
123
  $is_front_end_request = true;
124
  if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'wdr_ajax'){
125
  $wdr_ajax_methods = array('get_price_html');
@@ -169,6 +170,7 @@ class DBTable
169
  $current_language = Language::getCurrentLanguage();
170
  $language_query = '';
171
  if (!empty($current_language)) {
 
172
  $language_query = ' AND (rule_language IS NULL OR rule_language = "[]" OR rule_language LIKE \'%"' . $current_language . '"%\')';
173
  }
174
  $query = "SELECT * FROM {$rules_table_name} WHERE enabled = %d AND deleted = %d AND (date_from <= %d OR date_from IS NULL) AND (date_to >= %d OR date_to IS NULL) AND (usage_limits > used_limits OR used_limits IS NULL OR usage_limits = 0) {$language_query} ORDER BY priority ASC";
@@ -187,12 +189,14 @@ class DBTable
187
  $rule_id = implode(",", $rule_id);
188
  return self::$rules['admin_based_on_rule_id'] = $wpdb->get_results("SELECT * FROM {$rules_table_name} WHERE id IN ({$rule_id})");
189
  } else {
 
190
  return self::$rules['admin_based_on_rule_id'] = $wpdb->get_row("SELECT * FROM {$rules_table_name} WHERE id={$rule_id}");
191
  }
192
  } elseif (is_null($rule_id) && !is_null($rule_name) && is_null($export)) {
193
  if(isset(self::$rules['admin_based_on_rule_name']) && $cache === true){
194
  return self::$rules['admin_based_on_rule_name'];
195
  }
 
196
  return self::$rules['admin_based_on_rule_name'] = $wpdb->get_results("SELECT * FROM {$rules_table_name} WHERE deleted = 0 AND title LIKE '%{$rule_name}%'");
197
  } else {
198
  if(isset(self::$rules['admin_all']) && $cache === true){
@@ -218,6 +222,7 @@ class DBTable
218
  global $wpdb;
219
  $rules_table_name = $wpdb->prefix.self::RULES_TABLE_NAME;
220
  if (!is_null($rule_id) && !empty($rule_id)) {
 
221
  $wpdb->update($rules_table_name, $values, array('id' => $rule_id), $format, array('%d'));
222
  } else {
223
  $wpdb->insert($rules_table_name, $values, $format);
@@ -236,6 +241,8 @@ class DBTable
236
  static function saveOrderDiscounts($order_id, $free_shipping, $discounts)
237
  {
238
  global $wpdb;
 
 
239
  $order_discount_table_name = $wpdb->prefix . self::ORDER_DISCOUNT_TABLE_NAME;
240
  $select_query = "SELECT id FROM {$order_discount_table_name} WHERE order_id=" . $order_id;
241
  $order_discounts = $wpdb->get_row($select_query, OBJECT);
@@ -260,7 +267,7 @@ class DBTable
260
  static function updateRuleUsedCount($rule_id, $used_count)
261
  {
262
  global $wpdb;
263
- $wpdb->update($wpdb->prefix . self::RULES_TABLE_NAME, array('used_limits' => $used_count), array('id' => $rule_id), array('%d'), array('%d'));
264
  }
265
 
266
  /**
@@ -277,6 +284,19 @@ class DBTable
277
  {
278
  global $wpdb;
279
  $order_item_discount_table_name = $wpdb->prefix . self::ORDER_ITEM_DISCOUNT_TABLE_NAME;
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  $select_query = "SELECT id FROM {$order_item_discount_table_name} WHERE order_id= {$order_id} AND item_id={$item_id} AND rule_id={$rule_id}";
281
  $order_discounts = $wpdb->get_row($select_query, OBJECT);
282
  $current_time = current_time('mysql', true);
@@ -371,6 +391,7 @@ class DBTable
371
  * @return array|bool|object|null
372
  */
373
  public static function get_rule_rows_summary( $params, $rule_id ) {
 
374
  global $wpdb;
375
  $params = array_merge( array(
376
  'from' => '',
@@ -471,28 +492,28 @@ class DBTable
471
  `enabled` tinyint(1) DEFAULT '1',
472
  `deleted` tinyint(1) DEFAULT '0',
473
  `exclusive` tinyint(1) DEFAULT '0',
474
- `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
475
  `priority` int(11) DEFAULT NULL,
476
- `apply_to` text COLLATE utf8mb4_unicode_ci,
477
- `filters` text COLLATE utf8mb4_unicode_ci NOT NULL,
478
- `conditions` text COLLATE utf8mb4_unicode_ci,
479
- `product_adjustments` text COLLATE utf8mb4_unicode_ci,
480
- `cart_adjustments` text COLLATE utf8mb4_unicode_ci,
481
- `buy_x_get_x_adjustments` text COLLATE utf8mb4_unicode_ci,
482
- `buy_x_get_y_adjustments` text COLLATE utf8mb4_unicode_ci,
483
- `bulk_adjustments` text COLLATE utf8mb4_unicode_ci NOT NULL,
484
- `set_adjustments` text COLLATE utf8mb4_unicode_ci NOT NULL,
485
- `other_discounts` text COLLATE utf8mb4_unicode_ci,
486
  `date_from` int(11) DEFAULT NULL,
487
  `date_to` int(11) DEFAULT NULL,
488
  `usage_limits` int(11) DEFAULT NULL,
489
- `rule_language` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
490
  `used_limits` int(11) DEFAULT NULL,
491
- `additional` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
492
- `max_discount_sum` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
493
- `advanced_discount_message` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
494
- `discount_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
495
- `used_coupons` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
496
  `created_by` int(11) DEFAULT NULL,
497
  `created_on` datetime DEFAULT NULL,
498
  `modified_by` int(11) DEFAULT NULL,
3
  namespace Wdr\App\Models;
4
 
5
  use Wdr\App\Helpers\Language;
6
+ use Wdr\App\Helpers\Woocommerce;
7
 
8
  if (!defined('ABSPATH')) exit;
9
 
46
  `enabled` tinyint(1) DEFAULT '1',
47
  `deleted` tinyint(1) DEFAULT '0',
48
  `exclusive` tinyint(1) DEFAULT '0',
49
+ `title` varchar(255) DEFAULT NULL,
50
  `priority` int(11) DEFAULT NULL,
51
+ `apply_to` text,
52
+ `filters` text NOT NULL,
53
+ `conditions` text,
54
+ `product_adjustments` text,
55
+ `cart_adjustments` text,
56
+ `buy_x_get_x_adjustments` text,
57
+ `buy_x_get_y_adjustments` text,
58
+ `bulk_adjustments` text NOT NULL,
59
+ `set_adjustments` text NOT NULL,
60
+ `other_discounts` text,
61
  `date_from` int(11) DEFAULT NULL,
62
  `date_to` int(11) DEFAULT NULL,
63
  `usage_limits` int(11) DEFAULT NULL,
64
+ `rule_language` text DEFAULT NULL,
65
  `used_limits` int(11) DEFAULT NULL,
66
+ `additional` text DEFAULT NULL,
67
+ `max_discount_sum` varchar(255) DEFAULT NULL,
68
+ `advanced_discount_message` text DEFAULT NULL,
69
+ `discount_type` varchar(255) DEFAULT NULL,
70
+ `used_coupons` text DEFAULT NULL,
71
  `created_by` int(11) DEFAULT NULL,
72
  `created_on` datetime DEFAULT NULL,
73
  `modified_by` int(11) DEFAULT NULL,
100
  `set_discount` float NOT NULL,
101
  `cart_discount` float NOT NULL,
102
  `has_free_shipping` enum('yes','no') NOT NULL DEFAULT 'no',
103
+ `cart_discount_label` varchar(255) DEFAULT NULL,
104
  `other_price` float NOT NULL DEFAULT '0',
105
  `created_at` datetime DEFAULT NULL,
106
  `updated_at` datetime DEFAULT NULL,
120
 
121
  protected static function isFrontEndRequest(){
122
  $is_front_end_request = false;
123
+ if(Woocommerce::is_ajax()){
124
  $is_front_end_request = true;
125
  if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'wdr_ajax'){
126
  $wdr_ajax_methods = array('get_price_html');
170
  $current_language = Language::getCurrentLanguage();
171
  $language_query = '';
172
  if (!empty($current_language)) {
173
+ $current_language = esc_sql($current_language);
174
  $language_query = ' AND (rule_language IS NULL OR rule_language = "[]" OR rule_language LIKE \'%"' . $current_language . '"%\')';
175
  }
176
  $query = "SELECT * FROM {$rules_table_name} WHERE enabled = %d AND deleted = %d AND (date_from <= %d OR date_from IS NULL) AND (date_to >= %d OR date_to IS NULL) AND (usage_limits > used_limits OR used_limits IS NULL OR usage_limits = 0) {$language_query} ORDER BY priority ASC";
189
  $rule_id = implode(",", $rule_id);
190
  return self::$rules['admin_based_on_rule_id'] = $wpdb->get_results("SELECT * FROM {$rules_table_name} WHERE id IN ({$rule_id})");
191
  } else {
192
+ $rule_id = intval($rule_id);
193
  return self::$rules['admin_based_on_rule_id'] = $wpdb->get_row("SELECT * FROM {$rules_table_name} WHERE id={$rule_id}");
194
  }
195
  } elseif (is_null($rule_id) && !is_null($rule_name) && is_null($export)) {
196
  if(isset(self::$rules['admin_based_on_rule_name']) && $cache === true){
197
  return self::$rules['admin_based_on_rule_name'];
198
  }
199
+ $rule_name = esc_sql($rule_name);
200
  return self::$rules['admin_based_on_rule_name'] = $wpdb->get_results("SELECT * FROM {$rules_table_name} WHERE deleted = 0 AND title LIKE '%{$rule_name}%'");
201
  } else {
202
  if(isset(self::$rules['admin_all']) && $cache === true){
222
  global $wpdb;
223
  $rules_table_name = $wpdb->prefix.self::RULES_TABLE_NAME;
224
  if (!is_null($rule_id) && !empty($rule_id)) {
225
+ $rule_id = intval($rule_id);
226
  $wpdb->update($rules_table_name, $values, array('id' => $rule_id), $format, array('%d'));
227
  } else {
228
  $wpdb->insert($rules_table_name, $values, $format);
241
  static function saveOrderDiscounts($order_id, $free_shipping, $discounts)
242
  {
243
  global $wpdb;
244
+ $order_id = intval($order_id);
245
+ $free_shipping = esc_sql($free_shipping);
246
  $order_discount_table_name = $wpdb->prefix . self::ORDER_DISCOUNT_TABLE_NAME;
247
  $select_query = "SELECT id FROM {$order_discount_table_name} WHERE order_id=" . $order_id;
248
  $order_discounts = $wpdb->get_row($select_query, OBJECT);
267
  static function updateRuleUsedCount($rule_id, $used_count)
268
  {
269
  global $wpdb;
270
+ $wpdb->update($wpdb->prefix . self::RULES_TABLE_NAME, array('used_limits' => intval($used_count)), array('id' => intval($rule_id)), array('%d'), array('%d'));
271
  }
272
 
273
  /**
284
  {
285
  global $wpdb;
286
  $order_item_discount_table_name = $wpdb->prefix . self::ORDER_ITEM_DISCOUNT_TABLE_NAME;
287
+ $order_id = intval($order_id);
288
+ $rule_id = intval($rule_id);
289
+ $item_id = intval($item_id);
290
+ $item_price = floatval($item_price);
291
+ $discounted_price = floatval($discounted_price);
292
+ $discount = floatval($discount);
293
+ $quantity = intval($quantity);
294
+ $simple_discount = floatval($simple_discount);
295
+ $bulk_discount = floatval($bulk_discount);
296
+ $set_discount = floatval($set_discount);
297
+ $cart_discount = floatval($cart_discount);
298
+ $cart_discount_label = esc_sql($cart_discount_label);
299
+ $cart_shipping_method = esc_sql($cart_shipping_method);
300
  $select_query = "SELECT id FROM {$order_item_discount_table_name} WHERE order_id= {$order_id} AND item_id={$item_id} AND rule_id={$rule_id}";
301
  $order_discounts = $wpdb->get_row($select_query, OBJECT);
302
  $current_time = current_time('mysql', true);
391
  * @return array|bool|object|null
392
  */
393
  public static function get_rule_rows_summary( $params, $rule_id ) {
394
+ $rule_id = intval($rule_id);
395
  global $wpdb;
396
  $params = array_merge( array(
397
  'from' => '',
492
  `enabled` tinyint(1) DEFAULT '1',
493
  `deleted` tinyint(1) DEFAULT '0',
494
  `exclusive` tinyint(1) DEFAULT '0',
495
+ `title` varchar(255) DEFAULT NULL,
496
  `priority` int(11) DEFAULT NULL,
497
+ `apply_to` text,
498
+ `filters` text NOT NULL,
499
+ `conditions` text,
500
+ `product_adjustments` text,
501
+ `cart_adjustments` text,
502
+ `buy_x_get_x_adjustments` text,
503
+ `buy_x_get_y_adjustments` text,
504
+ `bulk_adjustments` text NOT NULL,
505
+ `set_adjustments` text NOT NULL,
506
+ `other_discounts` text,
507
  `date_from` int(11) DEFAULT NULL,
508
  `date_to` int(11) DEFAULT NULL,
509
  `usage_limits` int(11) DEFAULT NULL,
510
+ `rule_language` text DEFAULT NULL,
511
  `used_limits` int(11) DEFAULT NULL,
512
+ `additional` text DEFAULT NULL,
513
+ `max_discount_sum` varchar(255) DEFAULT NULL,
514
+ `advanced_discount_message` text DEFAULT NULL,
515
+ `discount_type` varchar(255) DEFAULT NULL,
516
+ `used_coupons` text DEFAULT NULL,
517
  `created_by` int(11) DEFAULT NULL,
518
  `created_on` datetime DEFAULT NULL,
519
  `modified_by` int(11) DEFAULT NULL,
v2/App/Views/Admin/Menu.php CHANGED
@@ -30,7 +30,7 @@
30
  ?>
31
  <span class="awdr_rebuild_on_sale_rule_page_con<?php echo $additional_class_for_rebuild; ?>">
32
  <button type="button" class="btn btn-danger"
33
- id="awdr_rebuild_on_sale_list_on_rule_page"><?php esc_html_e('Rebuild index', WDR_TEXT_DOMAIN); ?></button>
34
  </span>
35
  <?php
36
  }
@@ -40,6 +40,9 @@
40
  </h2>
41
 
42
  <div class="wdr_settings">
 
 
 
43
  <div class="wdr_settings_container">
44
  <?php
45
  $handler->render($page);
30
  ?>
31
  <span class="awdr_rebuild_on_sale_rule_page_con<?php echo $additional_class_for_rebuild; ?>">
32
  <button type="button" class="btn btn-danger"
33
+ id="awdr_rebuild_on_sale_list_on_rule_page" data-awdr_nonce="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_rule_build_index'); ?>"><?php esc_html_e('Rebuild index', WDR_TEXT_DOMAIN); ?></button>
34
  </span>
35
  <?php
36
  }
40
  </h2>
41
 
42
  <div class="wdr_settings">
43
+ <?php
44
+ \Wdr\App\Helpers\Helper::displayCompatibleCheckMessages();
45
+ ?>
46
  <div class="wdr_settings_container">
47
  <?php
48
  $handler->render($page);
v2/App/Views/Admin/Rules/Manage.php CHANGED
@@ -153,6 +153,7 @@
153
  <div id="wdr-save-rule" name="rule_generator">
154
  <input type="hidden" name="action" value="wdr_ajax">
155
  <input type="hidden" name="method" value="save_rule">
 
156
  <input type="hidden" name="wdr_save_close" value="">
157
  <div id="rule_template">
158
  <?php include 'Filters/Main.php'; ?>
@@ -233,6 +234,7 @@
233
  <!-- ------------------------Rule Discount Batch Section End------------------ -->
234
 
235
  </div>
 
236
  </form>
237
  </div>
238
  </div>
153
  <div id="wdr-save-rule" name="rule_generator">
154
  <input type="hidden" name="action" value="wdr_ajax">
155
  <input type="hidden" name="method" value="save_rule">
156
+ <input type="hidden" name="awdr_nonce" value="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_save_rule'); ?>">
157
  <input type="hidden" name="wdr_save_close" value="">
158
  <div id="rule_template">
159
  <?php include 'Filters/Main.php'; ?>
234
  <!-- ------------------------Rule Discount Batch Section End------------------ -->
235
 
236
  </div>
237
+ <input type="hidden" name="wdr_ajax_select2" value="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_select2'); ?>">
238
  </form>
239
  </div>
240
  </div>
v2/App/Views/Admin/Tabs/DiscountRule.php CHANGED
@@ -39,7 +39,7 @@ $is_pro = \Wdr\App\Helpers\Helper::hasPro();
39
  </div>
40
  <div class="wdr_settings">
41
  <div class="wdr_migration_container">
42
- <button class="btn btn-primary" type="button" id="awdr_do_v1_v2_migration"><?php esc_html_e('Migrate', WDR_TEXT_DOMAIN); ?></button>
43
  <span class="close-modal"><button class="btn btn-warning wdr-close-modal-box" type="button"><?php esc_html_e('Skip', WDR_TEXT_DOMAIN); ?></button></span>
44
  <div class="wdr_migration_process">
45
  </div>
@@ -63,6 +63,7 @@ $is_pro = \Wdr\App\Helpers\Helper::hasPro();
63
  <input type="hidden" name="adminUrl"
64
  value="<?php echo admin_url('admin.php?page=woo_discount_rules'); ?>">
65
  <input type="hidden" name="name" value="" class="wdr-rule-search-key">
 
66
  <input type="submit" class="button" class="wdr-trigger-search-key"
67
  value="<?php _e('Search Rules', WDR_TEXT_DOMAIN); ?>">
68
  </form>
@@ -79,6 +80,7 @@ $is_pro = \Wdr\App\Helpers\Helper::hasPro();
79
  </select>
80
  <input type="submit" id="doaction" class="button action" value="<?php _e('Apply', WDR_TEXT_DOMAIN);?>">
81
  <input type="search" name="awdr-hidden-name" class="awdr-hidden-name" value="<?php echo $input->get('name'); ?>">
 
82
  <input type="button" class="button awdr-hidden-search"
83
  value="<?php _e('Search Rules', WDR_TEXT_DOMAIN); ?>">
84
  </div>
@@ -246,7 +248,7 @@ $is_pro = \Wdr\App\Helpers\Helper::hasPro();
246
  <!-- <td></td>-->
247
  <td class="date column-tag" data-colname="wdr-rule-status">
248
  <label class="switch switch-left-right">
249
- <input class="switch-input wdr_manage_status" name="toogle_action" type="checkbox" data-manage-status="<?php echo $rule_row->getId(); ?>" <?php echo ($rule_row->isEnabled()) ? 'checked' : '';?>/>
250
  <span class="switch-label" data-on="<?php _e('Enabled', WDR_TEXT_DOMAIN); ?>" data-off="<?php _e('Disabled', WDR_TEXT_DOMAIN); ?>"></span>
251
  <span class="switch-handle"></span>
252
  </label>
@@ -299,9 +301,9 @@ $is_pro = \Wdr\App\Helpers\Helper::hasPro();
299
  href="<?php echo admin_url("admin.php?" . http_build_query(array('page' => WDR_SLUG, 'tab' => 'rules', 'task' => 'view', 'id' => $rule_row->getId()))); ?>">
300
  <?php _e('Edit', WDR_TEXT_DOMAIN); ?></a>
301
  <a class="btn btn-primary wdr_duplicate_rule"
302
- data-duplicate-rule="<?php echo $rule_row->getId(); ?>"><?php _e('Duplicate', WDR_TEXT_DOMAIN); ?></a>
303
  <a class="btn btn-danger wdr_delete_rule"
304
- data-delete-rule="<?php echo $rule_row->getId(); ?>">
305
  <?php _e('Delete', WDR_TEXT_DOMAIN); ?></a>
306
  </td>
307
  </tr>
@@ -373,6 +375,7 @@ $is_pro = \Wdr\App\Helpers\Helper::hasPro();
373
  </div>
374
  <br class="clear">
375
  </div>
 
376
  <input type="hidden" name="action" value="wdr_ajax">
377
  <input type="hidden" name="method" value="bulk_action">
378
  <input type="hidden" name="adminUrl" value="<?php echo admin_url('admin.php?page=woo_discount_rules') ?>">
39
  </div>
40
  <div class="wdr_settings">
41
  <div class="wdr_migration_container">
42
+ <button class="btn btn-primary" type="button" data-awdr_nonce="<?php echo \Wdr\App\Helpers\Helper::create_nonce('awdr_v2_migration'); ?>" id="awdr_do_v1_v2_migration"><?php esc_html_e('Migrate', WDR_TEXT_DOMAIN); ?></button>
43
  <span class="close-modal"><button class="btn btn-warning wdr-close-modal-box" type="button"><?php esc_html_e('Skip', WDR_TEXT_DOMAIN); ?></button></span>
44
  <div class="wdr_migration_process">
45
  </div>
63
  <input type="hidden" name="adminUrl"
64
  value="<?php echo admin_url('admin.php?page=woo_discount_rules'); ?>">
65
  <input type="hidden" name="name" value="" class="wdr-rule-search-key">
66
+ <input type="hidden" name="awdr_nonce" value="<?php echo \Wdr\App\Helpers\Helper::create_nonce('awdr_ajax_search_rule'); ?>">
67
  <input type="submit" class="button" class="wdr-trigger-search-key"
68
  value="<?php _e('Search Rules', WDR_TEXT_DOMAIN); ?>">
69
  </form>
80
  </select>
81
  <input type="submit" id="doaction" class="button action" value="<?php _e('Apply', WDR_TEXT_DOMAIN);?>">
82
  <input type="search" name="awdr-hidden-name" class="awdr-hidden-name" value="<?php echo $input->get('name'); ?>">
83
+ <input type="hidden" name="awdr_nonce" value="<?php echo \Wdr\App\Helpers\Helper::create_nonce('awdr_ajax_rule_bulk_actions'); ?>">
84
  <input type="button" class="button awdr-hidden-search"
85
  value="<?php _e('Search Rules', WDR_TEXT_DOMAIN); ?>">
86
  </div>
248
  <!-- <td></td>-->
249
  <td class="date column-tag" data-colname="wdr-rule-status">
250
  <label class="switch switch-left-right">
251
+ <input class="switch-input wdr_manage_status" name="toogle_action" type="checkbox" data-awdr_="<?php echo $rule_row->getId(); ?>" data-awdr_nonce="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_manage_status'.$rule_row->getId()); ?>" data-manage-status="<?php echo $rule_row->getId(); ?>" <?php echo ($rule_row->isEnabled()) ? 'checked' : '';?>/>
252
  <span class="switch-label" data-on="<?php _e('Enabled', WDR_TEXT_DOMAIN); ?>" data-off="<?php _e('Disabled', WDR_TEXT_DOMAIN); ?>"></span>
253
  <span class="switch-handle"></span>
254
  </label>
301
  href="<?php echo admin_url("admin.php?" . http_build_query(array('page' => WDR_SLUG, 'tab' => 'rules', 'task' => 'view', 'id' => $rule_row->getId()))); ?>">
302
  <?php _e('Edit', WDR_TEXT_DOMAIN); ?></a>
303
  <a class="btn btn-primary wdr_duplicate_rule"
304
+ data-duplicate-rule="<?php echo $rule_row->getId(); ?>" data-awdr_nonce="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_duplicate_rule'.$rule_row->getId()); ?>"><?php _e('Duplicate', WDR_TEXT_DOMAIN); ?></a>
305
  <a class="btn btn-danger wdr_delete_rule"
306
+ data-delete-rule="<?php echo $rule_row->getId(); ?>" data-awdr_nonce="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_delete_rule'.$rule_row->getId()); ?>">
307
  <?php _e('Delete', WDR_TEXT_DOMAIN); ?></a>
308
  </td>
309
  </tr>
375
  </div>
376
  <br class="clear">
377
  </div>
378
+ <input type="hidden" name="awdr_rule_list_nonce" value="<?php echo \Wdr\App\Helpers\Helper::create_nonce('awdr_rule_list'); ?>">
379
  <input type="hidden" name="action" value="wdr_ajax">
380
  <input type="hidden" name="method" value="bulk_action">
381
  <input type="hidden" name="adminUrl" value="<?php echo admin_url('admin.php?page=woo_discount_rules') ?>">
v2/App/Views/Admin/Tabs/Statistics.php CHANGED
@@ -40,6 +40,7 @@ if (!defined('ABSPATH')) {
40
  <option value="this_month"><?php _e('This Month', WDR_TEXT_DOMAIN); ?></option>
41
  <option value="custom"><?php _e('Custom Range', WDR_TEXT_DOMAIN); ?></option>
42
  </select>
 
43
  </div>
44
  <div class="wdr-dateandtime-value">
45
  <input type="text"
@@ -50,7 +51,7 @@ if (!defined('ABSPATH')) {
50
  id="rule_datetime_from" value="<?php if (isset($date[0]) && !empty($date[0])) {
51
  echo $date[0];
52
  } ?>" style="height: 34px;">
53
- <!--<span class="wdr_desc_text"><?php /*_e('Vaild from', WDR_TEXT_DOMAIN); */ ?></span>-->
54
  </div>
55
  <div class="wdr-dateandtime-value">
56
  <input type="text"
@@ -61,10 +62,10 @@ if (!defined('ABSPATH')) {
61
  id="rule_datetime_to" value="<?php if (isset($date[1]) && !empty($date[1])) {
62
  echo $date[1];
63
  } ?>" style="height: 34px;">
64
- <!--<span class="wdr_desc_text"><?php /*_e('Vaild to', WDR_TEXT_DOMAIN); */ ?></span>-->
65
  </div>
66
  <div class="awdr-report-type" >
67
- <select name="type" class="chart-type" style="height: 33px">
68
  <?php foreach ( $charts as $group => $charts_by_group ): ?>
69
  <optgroup label="<?php echo $group ?>">
70
  <?php foreach ( $charts_by_group as $key => $name ): ?>
@@ -73,12 +74,28 @@ if (!defined('ABSPATH')) {
73
  </optgroup>
74
  <?php endforeach; ?>
75
  </select>
 
76
  </div>
77
-
78
- <div class="">
79
- <button type="submit" class="btn btn-success"><?php _e('Update Chart', WDR_TEXT_DOMAIN); ?></button>
 
 
 
 
 
 
 
 
 
 
80
  </div>
81
  </div>
 
 
 
 
 
82
  </form>
83
  <br/>
84
  <div id="chart-container"></div>
40
  <option value="this_month"><?php _e('This Month', WDR_TEXT_DOMAIN); ?></option>
41
  <option value="custom"><?php _e('Custom Range', WDR_TEXT_DOMAIN); ?></option>
42
  </select>
43
+ <!-- <span class="wdr_desc_text"><?php /*_e('Report Period', WDR_TEXT_DOMAIN); */?></span>-->
44
  </div>
45
  <div class="wdr-dateandtime-value">
46
  <input type="text"
51
  id="rule_datetime_from" value="<?php if (isset($date[0]) && !empty($date[0])) {
52
  echo $date[0];
53
  } ?>" style="height: 34px;">
54
+ <!--<span class="wdr_desc_text"><?php /*_e('From', WDR_TEXT_DOMAIN); */?></span>-->
55
  </div>
56
  <div class="wdr-dateandtime-value">
57
  <input type="text"
62
  id="rule_datetime_to" value="<?php if (isset($date[1]) && !empty($date[1])) {
63
  echo $date[1];
64
  } ?>" style="height: 34px;">
65
+ <!--<span class="wdr_desc_text"><?php /*_e('To', WDR_TEXT_DOMAIN); */?></span>-->
66
  </div>
67
  <div class="awdr-report-type" >
68
+ <select name="type" class="chart-type awdr-show-report-limit" style="height: 33px">
69
  <?php foreach ( $charts as $group => $charts_by_group ): ?>
70
  <optgroup label="<?php echo $group ?>">
71
  <?php foreach ( $charts_by_group as $key => $name ): ?>
74
  </optgroup>
75
  <?php endforeach; ?>
76
  </select>
77
+ <!--<span class="wdr_desc_text"><?php /*_e('Select Rule', WDR_TEXT_DOMAIN); */?></span>-->
78
  </div>
79
+ <!--<div class="show_hide_awdr_report_limit">
80
+ <input type="number"
81
+ name="limit"
82
+ class="number_only_field"
83
+ min="1"
84
+ placeholder="<?php /*_e('5', WDR_TEXT_DOMAIN); */?>"
85
+ autocomplete="off"
86
+ value="" style="height: 34px;">
87
+ <span class="wdr_desc_text"><?php /*_e('Report Limit (Eg: Top 5)', WDR_TEXT_DOMAIN); */?></span>
88
+ </div>-->
89
+ <div> <!--class="awdr-toggle-report-update"--> <!--style="display: none;>"-->
90
+ <input type="hidden" name="awdr_nonce" value="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_report'); ?>">
91
+ <button type="submit" class="update-chart btn btn-success"><?php _e('Update Chart', WDR_TEXT_DOMAIN); ?></button>
92
  </div>
93
  </div>
94
+ <!-- <div class="wdr-rule-statistics awdr-report-update">
95
+ <div class="">
96
+ <button type="submit" class="btn btn-success"><?php /*_e('Update Chart', WDR_TEXT_DOMAIN); */?></button>
97
+ </div>
98
+ </div>-->
99
  </form>
100
  <br/>
101
  <div id="chart-container"></div>
v2/App/Views/Admin/Tabs/settings.php CHANGED
@@ -480,7 +480,7 @@
480
  <div class="awdr_rebuild_on_sale_list_notice">
481
  </div>
482
  </div>
483
- <button type="button" class="btn btn-warning" id="awdr_rebuild_on_sale_list"><?php _e('Save and Build Index', WDR_TEXT_DOMAIN ); ?></button>
484
  <?php } else {
485
  _e("Unlock this feature by <a href='https://www.flycart.org/products/wordpress/woocommerce-discount-rules?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=unlock_pro' target='_blank'>Upgrading to Pro</a>", WDR_TEXT_DOMAIN);
486
  }?>
@@ -884,7 +884,9 @@
884
  <input type="hidden" name="customize_bulk_table_range" class="customize_bulk_table_range" value="<?php echo $configuration->getConfig('customize_bulk_table_range', 1); ?>">
885
 
886
  <input type="hidden" name="method" value="save_configuration">
 
887
  <input type="hidden" name="action" value="wdr_ajax">
 
888
  <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary save-configuration-submit"
889
  value="Save Changes"></p>
890
  </div>
480
  <div class="awdr_rebuild_on_sale_list_notice">
481
  </div>
482
  </div>
483
+ <button type="button" class="btn btn-warning" id="awdr_rebuild_on_sale_list" data-awdr_nonce="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_rule_build_index'); ?>"><?php _e('Save and Build Index', WDR_TEXT_DOMAIN ); ?></button>
484
  <?php } else {
485
  _e("Unlock this feature by <a href='https://www.flycart.org/products/wordpress/woocommerce-discount-rules?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=unlock_pro' target='_blank'>Upgrading to Pro</a>", WDR_TEXT_DOMAIN);
486
  }?>
884
  <input type="hidden" name="customize_bulk_table_range" class="customize_bulk_table_range" value="<?php echo $configuration->getConfig('customize_bulk_table_range', 1); ?>">
885
 
886
  <input type="hidden" name="method" value="save_configuration">
887
+ <input type="hidden" class="customize_banner_content" name="customize_banner_content" value="">
888
  <input type="hidden" name="action" value="wdr_ajax">
889
+ <input type="hidden" name="awdr_nonce" value="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_save_configuration'); ?>">
890
  <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary save-configuration-submit"
891
  value="Save Changes"></p>
892
  </div>
v2/Assets/Js/admin-statistics.js CHANGED
@@ -105,8 +105,10 @@ function renderChart(data) {
105
  }
106
 
107
  function showChart(params) {
108
- jQuery('.update-chart').prop('disabled', true);
109
- jQuery('.chart-placeholder').addClass('loading');
 
 
110
 
111
  jQuery.post(
112
  ajaxurl,
@@ -116,8 +118,9 @@ function showChart(params) {
116
  params: params,
117
  },
118
  function (response) {
119
- jQuery('.update-chart').prop('disabled', false);
120
- jQuery('.chart-placeholder').removeClass('loading');
 
121
  if (response.success) {
122
  if (response.data.columns.length > 1) {
123
  response_content = response;
105
  }
106
 
107
  function showChart(params) {
108
+ /* jQuery('.update-chart').prop('disabled', true);*/
109
+ /*jQuery('.chart-placeholder').addClass('loading');*/
110
+ let loader = jQuery('.woo_discount_loader');
111
+ loader.show();
112
 
113
  jQuery.post(
114
  ajaxurl,
118
  params: params,
119
  },
120
  function (response) {
121
+ loader.hide();
122
+ /*jQuery('.update-chart').prop('disabled', false);*/
123
+ /* jQuery('.chart-placeholder').removeClass('loading');*/
124
  if (response.success) {
125
  if (response.data.columns.length > 1) {
126
  response_content = response;
v2/Assets/Js/admin_script.js CHANGED
@@ -275,9 +275,9 @@ jQuery(document).ready(function ($) {
275
  $('.' + show_discount_content).show();
276
  });
277
 
278
- function awdr_process_v1_to_v2_migration(){
279
  $.ajax({
280
- data: {method: 'do_v1_v2_migration', action: 'wdr_ajax'},
281
  type: 'post',
282
  url: ajaxurl,
283
  error: function (request, error) {
@@ -289,7 +289,7 @@ jQuery(document).ready(function ($) {
289
  notify(wdr_data.localization_data.processing_migration_success_message, 'success', alert_counter);
290
  location.reload();
291
  } else {
292
- awdr_process_v1_to_v2_migration();
293
  }
294
  $(".wdr_migration_process_status").html(data.data.display_text);
295
  } else {
@@ -326,7 +326,7 @@ jQuery(document).ready(function ($) {
326
 
327
  function awdr_process_on_sale_list(rules, current_obj){
328
  $.ajax({
329
- data: {method: 'rebuild_onsale_list', action: 'wdr_ajax', rules: rules},
330
  type: 'post',
331
  url: ajaxurl,
332
  error: function (request, error) {
@@ -345,7 +345,7 @@ jQuery(document).ready(function ($) {
345
  */
346
  $(document).on('click', '#awdr_do_v1_v2_migration', function () {
347
  $(".wdr_migration_process").append(wdr_data.localization_data.processing_migration_text);
348
- awdr_process_v1_to_v2_migration();
349
  });
350
 
351
  /**
@@ -395,7 +395,7 @@ jQuery(document).ready(function ($) {
395
  $(document).on('click', '.wdr_duplicate_rule', function () {
396
  let loader = $('.woo_discount_loader');
397
  $.ajax({
398
- data: {rowid: $(this).data('duplicate-rule'), method: 'duplicate_rule', action: 'wdr_ajax'},
399
  type: 'post',
400
  url: ajaxurl,
401
  beforeSend: function() {
@@ -426,7 +426,7 @@ jQuery(document).ready(function ($) {
426
  if (confirm(wdr_data.localization_data.delete_confirm)) {
427
  let loader = $('.woo_discount_loader');
428
  $.ajax({
429
- data: {rowid: $(this).data('delete-rule'), method: 'delete_rule', action: 'wdr_ajax'},
430
  type: 'post',
431
  url: ajaxurl,
432
  beforeSend: function() {
@@ -467,6 +467,7 @@ jQuery(document).ready(function ($) {
467
  $.ajax({
468
  data: {
469
  rowid: $(this).data('manage-status'),
 
470
  method: 'manage_status',
471
  action: 'wdr_ajax',
472
  changeto: change_status
@@ -525,6 +526,7 @@ jQuery(document).ready(function ($) {
525
  query: params.term,
526
  action: 'wdr_ajax',
527
  method: $el.data('list') || 'products',
 
528
  taxonomy: $el.data('taxonomy') || '',
529
  selected: $el.val()
530
  };
@@ -559,6 +561,7 @@ jQuery(document).ready(function ($) {
559
  query: params.term,
560
  action: 'wdr_ajax',
561
  method: $(this).data('list') || 'products',
 
562
  taxonomy: $(this).data('taxonomy') || '',
563
  selected: $(this).val()
564
  };
@@ -1623,6 +1626,7 @@ jQuery(document).ready(function ($) {
1623
  $("#awdr_banner_editor-html").click();
1624
  $("#awdr_banner_editor-tmce").click();
1625
  let awdr_banner_editer = $('#awdr_banner_editor').val();
 
1626
  let values = $(this).serialize();
1627
  let loader = $('.woo_discount_loader');
1628
  values += "&banner_content=" + awdr_banner_editer;
@@ -1981,7 +1985,8 @@ jQuery(document).ready(function ($) {
1981
  data: {
1982
  position: data,
1983
  method: 'update_priority_order',
1984
- action: 'wdr_ajax'
 
1985
  },
1986
  type: 'post',
1987
  url: ajaxurl,
275
  $('.' + show_discount_content).show();
276
  });
277
 
278
+ function awdr_process_v1_to_v2_migration(awdr_nonce){
279
  $.ajax({
280
+ data: {method: 'do_v1_v2_migration', action: 'wdr_ajax', awdr_nonce: awdr_nonce},
281
  type: 'post',
282
  url: ajaxurl,
283
  error: function (request, error) {
289
  notify(wdr_data.localization_data.processing_migration_success_message, 'success', alert_counter);
290
  location.reload();
291
  } else {
292
+ awdr_process_v1_to_v2_migration(awdr_nonce);
293
  }
294
  $(".wdr_migration_process_status").html(data.data.display_text);
295
  } else {
326
 
327
  function awdr_process_on_sale_list(rules, current_obj){
328
  $.ajax({
329
+ data: {method: 'rebuild_onsale_list', action: 'wdr_ajax', rules: rules, awdr_nonce: current_obj.attr('data-awdr_nonce')},
330
  type: 'post',
331
  url: ajaxurl,
332
  error: function (request, error) {
345
  */
346
  $(document).on('click', '#awdr_do_v1_v2_migration', function () {
347
  $(".wdr_migration_process").append(wdr_data.localization_data.processing_migration_text);
348
+ awdr_process_v1_to_v2_migration($(this).attr('data-awdr_nonce'));
349
  });
350
 
351
  /**
395
  $(document).on('click', '.wdr_duplicate_rule', function () {
396
  let loader = $('.woo_discount_loader');
397
  $.ajax({
398
+ data: {rowid: $(this).data('duplicate-rule'), awdr_nonce: $(this).data('awdr_nonce'), method: 'duplicate_rule', action: 'wdr_ajax'},
399
  type: 'post',
400
  url: ajaxurl,
401
  beforeSend: function() {
426
  if (confirm(wdr_data.localization_data.delete_confirm)) {
427
  let loader = $('.woo_discount_loader');
428
  $.ajax({
429
+ data: {rowid: $(this).data('delete-rule'), awdr_nonce: $(this).data('awdr_nonce'), method: 'delete_rule', action: 'wdr_ajax'},
430
  type: 'post',
431
  url: ajaxurl,
432
  beforeSend: function() {
467
  $.ajax({
468
  data: {
469
  rowid: $(this).data('manage-status'),
470
+ awdr_nonce: $(this).data('awdr_nonce'),
471
  method: 'manage_status',
472
  action: 'wdr_ajax',
473
  changeto: change_status
526
  query: params.term,
527
  action: 'wdr_ajax',
528
  method: $el.data('list') || 'products',
529
+ awdr_nonce: $('input[name=wdr_ajax_select2]').val() || '',
530
  taxonomy: $el.data('taxonomy') || '',
531
  selected: $el.val()
532
  };
561
  query: params.term,
562
  action: 'wdr_ajax',
563
  method: $(this).data('list') || 'products',
564
+ awdr_nonce: $('input[name=wdr_ajax_select2]').val() || '',
565
  taxonomy: $(this).data('taxonomy') || '',
566
  selected: $(this).val()
567
  };
1626
  $("#awdr_banner_editor-html").click();
1627
  $("#awdr_banner_editor-tmce").click();
1628
  let awdr_banner_editer = $('#awdr_banner_editor').val();
1629
+ $('.customize_banner_content').val(awdr_banner_editer);
1630
  let values = $(this).serialize();
1631
  let loader = $('.woo_discount_loader');
1632
  values += "&banner_content=" + awdr_banner_editer;
1985
  data: {
1986
  position: data,
1987
  method: 'update_priority_order',
1988
+ action: 'wdr_ajax',
1989
+ awdr_nonce: $("input[name=awdr_rule_list_nonce]").val()
1990
  },
1991
  type: 'post',
1992
  url: ajaxurl,
v2/Assets/Js/site_main.js CHANGED
@@ -93,6 +93,38 @@
93
  });
94
  }
95
  init_events();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  });
97
  })(jQuery);
98
 
93
  });
94
  }
95
  init_events();
96
+
97
+ /*jQuery('table.variations tr td.value select').on('change', function () {
98
+ setTimeout(function(){
99
+ let variation_id = jQuery('[name="variation_id"]').val();
100
+ if(variation_id != '' && variation_id != '0'){
101
+ console.log(variation_id);
102
+ var data = {
103
+ action: 'wdr_ajax',
104
+ method: 'get_variable_product_bulk_table',
105
+ product_id: variation_id,
106
+ };
107
+ jQuery.ajax({
108
+ url: awdr_params.ajaxurl,
109
+ data: data,
110
+ type: 'POST',
111
+ success: function (response) {
112
+ if (response.price_html) {
113
+ $price_place.html(response.price_html)
114
+ } else {
115
+ if(response.original_price_html != undefined){
116
+ $price_place.html(response.original_price_html)
117
+ }
118
+ }
119
+ },
120
+ error: function (response) {
121
+ $price_place.html("")
122
+ }
123
+ });
124
+ }
125
+ }, 100);
126
+ });*/
127
+
128
  });
129
  })(jQuery);
130
 
woo-discount-rules.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Simple to complex discount rules for your WooCommerce store. Core package.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
- * Version: 2.0.2
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/
@@ -21,7 +21,7 @@ if (!defined('ABSPATH')) {
21
  * Current version of our app
22
  */
23
  if (!defined('WDR_VERSION')) {
24
- define('WDR_VERSION', '2.0.2');
25
  }
26
 
27
  global $awdr_load_version, $awdr_switched_to_version;
@@ -148,15 +148,17 @@ if ($awdr_load_version == "v2") {
148
  if ($awdr_switched_to_version == "v2") {
149
  awdr_create_required_tables();
150
  }
151
- add_action('admin_init', function(){
152
  awdr_create_required_tables();
153
  });
154
 
155
  // This is required to load the pro events before core initialize
156
- add_action( 'plugins_loaded', function(){
157
- do_action('advanced_woo_discount_rules_before_loaded');
158
- new \Wdr\App\Router();
159
- do_action('advanced_woo_discount_rules_loaded');
 
 
160
  }, 1);
161
 
162
  } else {
5
  * Description: Simple to complex discount rules for your WooCommerce store. Core package.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 2.1.0
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/
21
  * Current version of our app
22
  */
23
  if (!defined('WDR_VERSION')) {
24
+ define('WDR_VERSION', '2.1.0');
25
  }
26
 
27
  global $awdr_load_version, $awdr_switched_to_version;
148
  if ($awdr_switched_to_version == "v2") {
149
  awdr_create_required_tables();
150
  }
151
+ add_action('admin_init', function () {
152
  awdr_create_required_tables();
153
  });
154
 
155
  // This is required to load the pro events before core initialize
156
+ add_action('plugins_loaded', function () {
157
+ if ( class_exists( 'WooCommerce' ) ) {
158
+ do_action('advanced_woo_discount_rules_before_loaded');
159
+ new \Wdr\App\Router();
160
+ do_action('advanced_woo_discount_rules_loaded');
161
+ }
162
  }, 1);
163
 
164
  } else {