Version Description
- 11/12/17 =
- Feature - Based on user role for Price rules(Pro)
- Fix - Product based: display the rule table for get product too
Download this release
Release Info
Developer | flycart |
Plugin | Discount Rules for WooCommerce |
Version | 1.4.32 |
Comparing to | |
See all releases |
Code changes from version 1.4.31 to 1.4.32
- assets/css/style.css +4 -0
- helper/general-helper.php +3 -2
- includes/pricing-rules-3.php +27 -7
- includes/pricing-rules.php +28 -7
- readme.txt +7 -2
- vendor/yahnis-elsts/plugin-update-checker/vendor/ParsedownLegacy.php +2 -1
- view/view-cart-rules.php +2 -0
- view/view-pricing-rules.php +47 -4
- woo-discount-rules.php +1 -1
assets/css/style.css
CHANGED
@@ -37,4 +37,8 @@
|
|
37 |
.product_based_condition_cont input,
|
38 |
.product_based_condition_cont label{
|
39 |
margin: 10px 0;
|
|
|
|
|
|
|
|
|
40 |
}
|
37 |
.product_based_condition_cont input,
|
38 |
.product_based_condition_cont label{
|
39 |
margin: 10px 0;
|
40 |
+
}
|
41 |
+
.woo-support-in_pro{
|
42 |
+
font-style: italic;
|
43 |
+
color: #999;
|
44 |
}
|
helper/general-helper.php
CHANGED
@@ -111,8 +111,9 @@ if ( ! class_exists( 'woo_dicount_rules_generalHelper' ) ) {
|
|
111 |
));
|
112 |
|
113 |
foreach ($posts_raw as $post_id) {
|
114 |
-
|
115 |
-
|
|
|
116 |
}
|
117 |
return $products;
|
118 |
}
|
111 |
));
|
112 |
|
113 |
foreach ($posts_raw as $post_id) {
|
114 |
+
//$product = wc_get_product($post_id);
|
115 |
+
//$products[$post_id] = $product->get_formatted_name();
|
116 |
+
$products[$post_id] = $products[$post_id] = '#' . $post_id . ' ' . get_the_title($post_id);//$product->get_formatted_name();
|
117 |
}
|
118 |
return $products;
|
119 |
}
|
includes/pricing-rules-3.php
CHANGED
@@ -180,9 +180,12 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
180 |
$apply_to = 'users_to_apply';
|
181 |
}
|
182 |
$form[] = $apply_to;
|
183 |
-
|
184 |
if (isset($request[$apply_to])) $request[$apply_to] = json_encode($request[$apply_to]);
|
185 |
|
|
|
|
|
|
|
|
|
186 |
$based_on_purchase_history = 0;
|
187 |
if (isset($request['based_on_purchase_history'])) $based_on_purchase_history = $request['based_on_purchase_history'];
|
188 |
$request['based_on_purchase_history'] = $based_on_purchase_history;
|
@@ -520,6 +523,7 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
520 |
$rule_sets[$index]['allow']['purchase_history'] = 'yes';
|
521 |
// Default setup for all customers.
|
522 |
$rule_sets[$index]['allow']['users'] = 'all';
|
|
|
523 |
|
524 |
// For quantity based discount
|
525 |
if($rule_sets[$index]['method'] == 'qty_based'){
|
@@ -572,17 +576,18 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
572 |
if(isset($rule->based_on_purchase_history) && $rule->based_on_purchase_history){
|
573 |
$rule_sets[$index]['allow']['purchase_history'] = $this->checkWithUsersPurchaseHistory($rule, $woocommerce);
|
574 |
}
|
|
|
|
|
|
|
|
|
|
|
575 |
}
|
576 |
|
577 |
// If Current Customer is not Allowed to use this discount, then it's going to be removed.
|
578 |
-
if ($rule_sets[$index]['allow']['users'] == 'no') {
|
579 |
unset($rule_sets[$index]);
|
580 |
}
|
581 |
|
582 |
-
// If Current Customer is not Allowed based on purchase history to use this discount, then it's going to be removed.
|
583 |
-
if ($rule_sets[$index]['allow']['purchase_history'] == 'no') {
|
584 |
-
unset($rule_sets[$index]);
|
585 |
-
}
|
586 |
} else if($rule_sets[$index]['method'] == 'product_based'){
|
587 |
$rule_sets[$index]['product_based_condition'] = json_decode((isset($rule->product_based_condition) ? $rule->product_based_condition : '{}'), true);
|
588 |
$rule_sets[$index]['product_based_discount'] = json_decode((isset($rule->product_based_discount) ? $rule->product_based_discount : '{}'), true);
|
@@ -591,6 +596,16 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
591 |
$this->rule_sets = $rule_sets;
|
592 |
}
|
593 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
594 |
/**
|
595 |
* Check with users purchase history
|
596 |
* */
|
@@ -1259,6 +1274,10 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
1259 |
$status = true;
|
1260 |
}
|
1261 |
|
|
|
|
|
|
|
|
|
1262 |
|
1263 |
if ($status) {
|
1264 |
$discount_range[] = (isset($rule->discount_range) ? json_decode($rule->discount_range) : array());
|
@@ -1266,7 +1285,8 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
1266 |
} else if(isset($rule->rule_method) && $rule->rule_method == 'product_based'){
|
1267 |
$product_based_conditions = json_decode((isset($rule->product_based_condition) ? $rule->product_based_condition : '{}'), true);
|
1268 |
$product_to_buy = isset($product_based_conditions['product_to_buy']) ? $product_based_conditions['product_to_buy'] : array();
|
1269 |
-
|
|
|
1270 |
$product_based_discounts = json_decode((isset($rule->product_based_discount) ? $rule->product_based_discount : '{}'), true);
|
1271 |
$product_based_discount_type = isset($product_based_discounts['discount_type']) ? $product_based_discounts['discount_type'] : 'percentage_discount';
|
1272 |
$product_based_discount_value = isset($product_based_discounts['discount_value']) ? $product_based_discounts['discount_value'] : '';
|
180 |
$apply_to = 'users_to_apply';
|
181 |
}
|
182 |
$form[] = $apply_to;
|
|
|
183 |
if (isset($request[$apply_to])) $request[$apply_to] = json_encode($request[$apply_to]);
|
184 |
|
185 |
+
$form[] = 'user_roles_to_apply';
|
186 |
+
if (!isset($request['user_roles_to_apply'])) $request['user_roles_to_apply'] = array();
|
187 |
+
$request['user_roles_to_apply'] = json_encode($request['user_roles_to_apply']);
|
188 |
+
|
189 |
$based_on_purchase_history = 0;
|
190 |
if (isset($request['based_on_purchase_history'])) $based_on_purchase_history = $request['based_on_purchase_history'];
|
191 |
$request['based_on_purchase_history'] = $based_on_purchase_history;
|
523 |
$rule_sets[$index]['allow']['purchase_history'] = 'yes';
|
524 |
// Default setup for all customers.
|
525 |
$rule_sets[$index]['allow']['users'] = 'all';
|
526 |
+
$rule_sets[$index]['allow']['user_role'] = true;
|
527 |
|
528 |
// For quantity based discount
|
529 |
if($rule_sets[$index]['method'] == 'qty_based'){
|
576 |
if(isset($rule->based_on_purchase_history) && $rule->based_on_purchase_history){
|
577 |
$rule_sets[$index]['allow']['purchase_history'] = $this->checkWithUsersPurchaseHistory($rule, $woocommerce);
|
578 |
}
|
579 |
+
|
580 |
+
// check for user roles
|
581 |
+
if(isset($rule->user_roles_to_apply)){
|
582 |
+
$rule_sets[$index]['allow']['user_role'] = $this->checkWithUserRoles($rule);
|
583 |
+
}
|
584 |
}
|
585 |
|
586 |
// If Current Customer is not Allowed to use this discount, then it's going to be removed.
|
587 |
+
if ($rule_sets[$index]['allow']['users'] == 'no' || !$rule_sets[$index]['allow']['user_role'] || $rule_sets[$index]['allow']['purchase_history'] == 'no') {
|
588 |
unset($rule_sets[$index]);
|
589 |
}
|
590 |
|
|
|
|
|
|
|
|
|
591 |
} else if($rule_sets[$index]['method'] == 'product_based'){
|
592 |
$rule_sets[$index]['product_based_condition'] = json_decode((isset($rule->product_based_condition) ? $rule->product_based_condition : '{}'), true);
|
593 |
$rule_sets[$index]['product_based_discount'] = json_decode((isset($rule->product_based_discount) ? $rule->product_based_discount : '{}'), true);
|
596 |
$this->rule_sets = $rule_sets;
|
597 |
}
|
598 |
|
599 |
+
public function checkWithUserRoles($rule){
|
600 |
+
$user_roles_to_apply = json_decode($rule->user_roles_to_apply, true);
|
601 |
+
if(!empty($user_roles_to_apply)){
|
602 |
+
if (get_current_user_id() == 0 || count(array_intersect(woo_dicount_rules_generalHelper::getCurrentUserRoles(), $user_roles_to_apply)) == 0) {
|
603 |
+
return false;
|
604 |
+
}
|
605 |
+
}
|
606 |
+
return true;
|
607 |
+
}
|
608 |
+
|
609 |
/**
|
610 |
* Check with users purchase history
|
611 |
* */
|
1274 |
$status = true;
|
1275 |
}
|
1276 |
|
1277 |
+
// check for user roles
|
1278 |
+
if(isset($rule->user_roles_to_apply)){
|
1279 |
+
$status = $this->checkWithUserRoles($rule);
|
1280 |
+
}
|
1281 |
|
1282 |
if ($status) {
|
1283 |
$discount_range[] = (isset($rule->discount_range) ? json_decode($rule->discount_range) : array());
|
1285 |
} else if(isset($rule->rule_method) && $rule->rule_method == 'product_based'){
|
1286 |
$product_based_conditions = json_decode((isset($rule->product_based_condition) ? $rule->product_based_condition : '{}'), true);
|
1287 |
$product_to_buy = isset($product_based_conditions['product_to_buy']) ? $product_based_conditions['product_to_buy'] : array();
|
1288 |
+
$product_to_apply = isset($product_based_conditions['product_to_apply']) ? $product_based_conditions['product_to_apply'] : array();
|
1289 |
+
if (in_array($id, $product_to_buy) || in_array($id, $product_to_apply)) {
|
1290 |
$product_based_discounts = json_decode((isset($rule->product_based_discount) ? $rule->product_based_discount : '{}'), true);
|
1291 |
$product_based_discount_type = isset($product_based_discounts['discount_type']) ? $product_based_discounts['discount_type'] : 'percentage_discount';
|
1292 |
$product_based_discount_value = isset($product_based_discounts['discount_value']) ? $product_based_discounts['discount_value'] : '';
|
includes/pricing-rules.php
CHANGED
@@ -167,9 +167,12 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
167 |
$apply_to = 'product_to_apply';
|
168 |
}
|
169 |
$form[] = $apply_to;
|
170 |
-
|
171 |
if (isset($request[$apply_to])) $request[$apply_to] = json_encode($request[$apply_to]);
|
172 |
|
|
|
|
|
|
|
|
|
173 |
$based_on_purchase_history = 0;
|
174 |
if (isset($request['based_on_purchase_history'])) $based_on_purchase_history = $request['based_on_purchase_history'];
|
175 |
$request['based_on_purchase_history'] = $based_on_purchase_history;
|
@@ -520,6 +523,7 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
520 |
$rule_sets[$index]['allow']['purchase_history'] = 'yes';
|
521 |
// Default setup for all customers.
|
522 |
$rule_sets[$index]['allow']['users'] = 'all';
|
|
|
523 |
|
524 |
// For quantity based discount
|
525 |
if($rule_sets[$index]['method'] == 'qty_based'){
|
@@ -574,17 +578,18 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
574 |
if(isset($rule->based_on_purchase_history) && $rule->based_on_purchase_history){
|
575 |
$rule_sets[$index]['allow']['purchase_history'] = $this->checkWithUsersPurchaseHistory($rule, $woocommerce);
|
576 |
}
|
|
|
|
|
|
|
|
|
|
|
577 |
}
|
578 |
|
579 |
// If Current Customer is not Allowed to use this discount, then it's going to be removed.
|
580 |
-
if ($rule_sets[$index]['allow']['users'] == 'no') {
|
581 |
unset($rule_sets[$index]);
|
582 |
}
|
583 |
|
584 |
-
// If Current Customer is not Allowed based on purchase history to use this discount, then it's going to be removed.
|
585 |
-
if ($rule_sets[$index]['allow']['purchase_history'] == 'no') {
|
586 |
-
unset($rule_sets[$index]);
|
587 |
-
}
|
588 |
} else if($rule_sets[$index]['method'] == 'product_based'){
|
589 |
$rule_sets[$index]['product_based_condition'] = json_decode((isset($rule->product_based_condition) ? $rule->product_based_condition : '{}'), true);
|
590 |
$rule_sets[$index]['product_based_discount'] = json_decode((isset($rule->product_based_discount) ? $rule->product_based_discount : '{}'), true);
|
@@ -593,6 +598,16 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
593 |
$this->rule_sets = $rule_sets;
|
594 |
}
|
595 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
596 |
/**
|
597 |
* Check with users purchase history
|
598 |
* */
|
@@ -1271,13 +1286,19 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
1271 |
$status = true;
|
1272 |
}
|
1273 |
|
|
|
|
|
|
|
|
|
|
|
1274 |
if ($status) {
|
1275 |
$discount_range[] = (isset($rule->discount_range) ? json_decode($rule->discount_range) : array());
|
1276 |
}
|
1277 |
} else if(isset($rule->rule_method) && $rule->rule_method == 'product_based'){
|
1278 |
$product_based_conditions = json_decode((isset($rule->product_based_condition) ? $rule->product_based_condition : '{}'), true);
|
1279 |
$product_to_buy = isset($product_based_conditions['product_to_buy']) ? $product_based_conditions['product_to_buy'] : array();
|
1280 |
-
|
|
|
1281 |
$product_based_discounts = json_decode((isset($rule->product_based_discount) ? $rule->product_based_discount : '{}'), true);
|
1282 |
$product_based_discount_type = isset($product_based_discounts['discount_type']) ? $product_based_discounts['discount_type'] : 'percentage_discount';
|
1283 |
$product_based_discount_value = isset($product_based_discounts['discount_value']) ? $product_based_discounts['discount_value'] : '';
|
167 |
$apply_to = 'product_to_apply';
|
168 |
}
|
169 |
$form[] = $apply_to;
|
|
|
170 |
if (isset($request[$apply_to])) $request[$apply_to] = json_encode($request[$apply_to]);
|
171 |
|
172 |
+
$form[] = 'user_roles_to_apply';
|
173 |
+
if (!isset($request['user_roles_to_apply'])) $request['user_roles_to_apply'] = array();
|
174 |
+
$request['user_roles_to_apply'] = json_encode($request['user_roles_to_apply']);
|
175 |
+
|
176 |
$based_on_purchase_history = 0;
|
177 |
if (isset($request['based_on_purchase_history'])) $based_on_purchase_history = $request['based_on_purchase_history'];
|
178 |
$request['based_on_purchase_history'] = $based_on_purchase_history;
|
523 |
$rule_sets[$index]['allow']['purchase_history'] = 'yes';
|
524 |
// Default setup for all customers.
|
525 |
$rule_sets[$index]['allow']['users'] = 'all';
|
526 |
+
$rule_sets[$index]['allow']['user_role'] = true;
|
527 |
|
528 |
// For quantity based discount
|
529 |
if($rule_sets[$index]['method'] == 'qty_based'){
|
578 |
if(isset($rule->based_on_purchase_history) && $rule->based_on_purchase_history){
|
579 |
$rule_sets[$index]['allow']['purchase_history'] = $this->checkWithUsersPurchaseHistory($rule, $woocommerce);
|
580 |
}
|
581 |
+
|
582 |
+
// check for user roles
|
583 |
+
if(isset($rule->user_roles_to_apply)){
|
584 |
+
$rule_sets[$index]['allow']['user_role'] = $this->checkWithUserRoles($rule);
|
585 |
+
}
|
586 |
}
|
587 |
|
588 |
// If Current Customer is not Allowed to use this discount, then it's going to be removed.
|
589 |
+
if ($rule_sets[$index]['allow']['users'] == 'no' || !$rule_sets[$index]['allow']['user_role'] || $rule_sets[$index]['allow']['purchase_history'] == 'no') {
|
590 |
unset($rule_sets[$index]);
|
591 |
}
|
592 |
|
|
|
|
|
|
|
|
|
593 |
} else if($rule_sets[$index]['method'] == 'product_based'){
|
594 |
$rule_sets[$index]['product_based_condition'] = json_decode((isset($rule->product_based_condition) ? $rule->product_based_condition : '{}'), true);
|
595 |
$rule_sets[$index]['product_based_discount'] = json_decode((isset($rule->product_based_discount) ? $rule->product_based_discount : '{}'), true);
|
598 |
$this->rule_sets = $rule_sets;
|
599 |
}
|
600 |
|
601 |
+
public function checkWithUserRoles($rule){
|
602 |
+
$user_roles_to_apply = json_decode($rule->user_roles_to_apply, true);
|
603 |
+
if(!empty($user_roles_to_apply)){
|
604 |
+
if (get_current_user_id() == 0 || count(array_intersect(woo_dicount_rules_generalHelper::getCurrentUserRoles(), $user_roles_to_apply)) == 0) {
|
605 |
+
return false;
|
606 |
+
}
|
607 |
+
}
|
608 |
+
return true;
|
609 |
+
}
|
610 |
+
|
611 |
/**
|
612 |
* Check with users purchase history
|
613 |
* */
|
1286 |
$status = true;
|
1287 |
}
|
1288 |
|
1289 |
+
// check for user roles
|
1290 |
+
if(isset($rule->user_roles_to_apply)){
|
1291 |
+
$status = $this->checkWithUserRoles($rule);
|
1292 |
+
}
|
1293 |
+
|
1294 |
if ($status) {
|
1295 |
$discount_range[] = (isset($rule->discount_range) ? json_decode($rule->discount_range) : array());
|
1296 |
}
|
1297 |
} else if(isset($rule->rule_method) && $rule->rule_method == 'product_based'){
|
1298 |
$product_based_conditions = json_decode((isset($rule->product_based_condition) ? $rule->product_based_condition : '{}'), true);
|
1299 |
$product_to_buy = isset($product_based_conditions['product_to_buy']) ? $product_based_conditions['product_to_buy'] : array();
|
1300 |
+
$product_to_apply = isset($product_based_conditions['product_to_apply']) ? $product_based_conditions['product_to_apply'] : array();
|
1301 |
+
if (in_array($id, $product_to_buy) || in_array($id, $product_to_apply)) {
|
1302 |
$product_based_discounts = json_decode((isset($rule->product_based_discount) ? $rule->product_based_discount : '{}'), true);
|
1303 |
$product_based_discount_type = isset($product_based_discounts['discount_type']) ? $product_based_discounts['discount_type'] : 'percentage_discount';
|
1304 |
$product_based_discount_value = isset($product_based_discounts['discount_value']) ? $product_based_discounts['discount_value'] : '';
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flycart.org/
|
|
4 |
Tags: woocommerce, ecommerce, discounts, coupons, promotion, campaigns, sales, price rules, advanced coupons, advanced discounts
|
5 |
Requires at least: 4.4.1
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 1.4.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -13,7 +13,7 @@ Create simple to complex discount rules, promotions for your WooCommerce online
|
|
13 |
|
14 |
WooCommerce discount rules helps you to create any type of bulk discounts, dynamic pricing and advanced discount rules in your WooCommerce store. Offer Product quantity based discounts, cart based discounts at a percentage or fixed amount or Buy One and Get one free (BOGO) deals. Increase your sales multifold by offering dynamic pricing and discounts based on Categories, user roles, Cart items and much more.
|
15 |
|
16 |
-
Now you can set Bulk Discounts for each Product Variation
|
17 |
|
18 |
Discounts will be visible in product Page, product details page, cart and in email invoices.
|
19 |
|
@@ -83,6 +83,7 @@ Display the pricing discount table beautifully on the product page. Start sellin
|
|
83 |
|
84 |
= User Role based Discount =
|
85 |
|
|
|
86 |
* Members of Wholesale customers group gets 40% discount, while Retail customers get 5% discount
|
87 |
|
88 |
= Global Discount Storewide =
|
@@ -237,6 +238,10 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
|
|
237 |
|
238 |
== Changelog ==
|
239 |
|
|
|
|
|
|
|
|
|
240 |
= 1.4.31 - 07/12/17 =
|
241 |
* Fix - Content update for better clarification
|
242 |
* Fix - Product based: buy each product applied even 1 product matches
|
4 |
Tags: woocommerce, ecommerce, discounts, coupons, promotion, campaigns, sales, price rules, advanced coupons, advanced discounts
|
5 |
Requires at least: 4.4.1
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 1.4.32
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
13 |
|
14 |
WooCommerce discount rules helps you to create any type of bulk discounts, dynamic pricing and advanced discount rules in your WooCommerce store. Offer Product quantity based discounts, cart based discounts at a percentage or fixed amount or Buy One and Get one free (BOGO) deals. Increase your sales multifold by offering dynamic pricing and discounts based on Categories, user roles, Cart items and much more.
|
15 |
|
16 |
+
Now you can set Bulk Discounts for each Product Variation, Bulk Discounts for different user roles.
|
17 |
|
18 |
Discounts will be visible in product Page, product details page, cart and in email invoices.
|
19 |
|
83 |
|
84 |
= User Role based Discount =
|
85 |
|
86 |
+
* Bulk discount based on user role for specific product or product categories.
|
87 |
* Members of Wholesale customers group gets 40% discount, while Retail customers get 5% discount
|
88 |
|
89 |
= Global Discount Storewide =
|
238 |
|
239 |
== Changelog ==
|
240 |
|
241 |
+
= 1.4.32 - 11/12/17 =
|
242 |
+
* Feature - Based on user role for Price rules(Pro)
|
243 |
+
* Fix - Product based: display the rule table for get product too
|
244 |
+
|
245 |
= 1.4.31 - 07/12/17 =
|
246 |
* Fix - Content update for better clarification
|
247 |
* Fix - Product based: buy each product applied even 1 product matches
|
vendor/yahnis-elsts/plugin-update-checker/vendor/ParsedownLegacy.php
CHANGED
@@ -1409,7 +1409,8 @@ class Parsedown
|
|
1409 |
|
1410 |
if (isset($Element['handler']))
|
1411 |
{
|
1412 |
-
$
|
|
|
1413 |
}
|
1414 |
else
|
1415 |
{
|
1409 |
|
1410 |
if (isset($Element['handler']))
|
1411 |
{
|
1412 |
+
$handler = $Element['handler'];
|
1413 |
+
$markup .= $this->$handler($Element['text']);
|
1414 |
}
|
1415 |
else
|
1416 |
{
|
view/view-cart-rules.php
CHANGED
@@ -422,6 +422,8 @@ if (empty($discount_rules)) {
|
|
422 |
$order_status_list = array();
|
423 |
$class = 'style="display:none"';
|
424 |
$woocommerce_order_status = wc_get_order_statuses();
|
|
|
|
|
425 |
if ($type == 'customer_based_on_purchase_history') {
|
426 |
$purchase_history_status_list = isset($discount_rules[$type]['purchase_history_order_status'])? $discount_rules[$type]['purchase_history_order_status'] : array();
|
427 |
$purchased_history_amount = isset($discount_rules[$type]['purchased_history_amount'])? $discount_rules[$type]['purchased_history_amount'] : 0;
|
422 |
$order_status_list = array();
|
423 |
$class = 'style="display:none"';
|
424 |
$woocommerce_order_status = wc_get_order_statuses();
|
425 |
+
$purchased_history_amount = '';
|
426 |
+
$purchase_history_status_list = array();
|
427 |
if ($type == 'customer_based_on_purchase_history') {
|
428 |
$purchase_history_status_list = isset($discount_rules[$type]['purchase_history_order_status'])? $discount_rules[$type]['purchase_history_order_status'] : array();
|
429 |
$purchased_history_amount = isset($discount_rules[$type]['purchased_history_amount'])? $discount_rules[$type]['purchased_history_amount'] : 0;
|
view/view-pricing-rules.php
CHANGED
@@ -200,7 +200,6 @@ $rule_id = (isset($data->ID)) ? $data->ID : 0;
|
|
200 |
</div>
|
201 |
</div>
|
202 |
</div>
|
203 |
-
|
204 |
<div class="form-group">
|
205 |
<div class="row">
|
206 |
<div class="col-md-3"><label> Customers </label></div>
|
@@ -233,14 +232,58 @@ $rule_id = (isset($data->ID)) ? $data->ID : 0;
|
|
233 |
</div>
|
234 |
</div>
|
235 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
<div class="form-group">
|
237 |
<div class="row">
|
238 |
<div class="col-md-3"><label><?php esc_html_e('Purchase History', 'woo-discount-rules'); ?></label></div>
|
239 |
<?php $based_on_purchase_history = (isset($data->based_on_purchase_history) ? $data->based_on_purchase_history : 0); ?>
|
240 |
<div class="col-md-6">
|
241 |
-
|
242 |
-
|
243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
<div class="form-group" id="based_on_purchase_history_fields">
|
245 |
<?php $purchased_history_amount = (isset($data->purchased_history_amount) ? $data->purchased_history_amount : 0); ?>
|
246 |
<label><?php esc_html_e('Total purchased amount at least', 'woo-discount-rules'); ?></label>
|
200 |
</div>
|
201 |
</div>
|
202 |
</div>
|
|
|
203 |
<div class="form-group">
|
204 |
<div class="row">
|
205 |
<div class="col-md-3"><label> Customers </label></div>
|
232 |
</div>
|
233 |
</div>
|
234 |
</div>
|
235 |
+
<div class="form-group">
|
236 |
+
<div class="row">
|
237 |
+
<div class="col-md-3"><label> <?php esc_html_e('User roles', 'woo-discount-rules') ?> </label></div>
|
238 |
+
<div class="col-md-6">
|
239 |
+
<?php
|
240 |
+
if($pro){
|
241 |
+
$roles_list = json_decode((isset($data->user_roles_to_apply) ? $data->user_roles_to_apply : '{}'), true); ?>
|
242 |
+
<select class="roles_list selectpicker"
|
243 |
+
id="product_roles_list" multiple
|
244 |
+
name="user_roles_to_apply[]">
|
245 |
+
<?php foreach ($userRoles as $index => $user) { ?>
|
246 |
+
<option
|
247 |
+
value="<?php echo $index; ?>"<?php if (in_array($index, $roles_list)) { ?> selected=selected <?php } ?>><?php echo $user; ?></option>
|
248 |
+
<?php } ?>
|
249 |
+
</select>
|
250 |
+
<?php
|
251 |
+
} else {
|
252 |
+
?>
|
253 |
+
<div class="woo-support-in_pro">
|
254 |
+
<?php
|
255 |
+
esc_html_e('Supported in PRO version', 'woo-discount-rules');
|
256 |
+
?>
|
257 |
+
</div>
|
258 |
+
<?php
|
259 |
+
}
|
260 |
+
?>
|
261 |
+
</div>
|
262 |
+
</div>
|
263 |
+
</div>
|
264 |
<div class="form-group">
|
265 |
<div class="row">
|
266 |
<div class="col-md-3"><label><?php esc_html_e('Purchase History', 'woo-discount-rules'); ?></label></div>
|
267 |
<?php $based_on_purchase_history = (isset($data->based_on_purchase_history) ? $data->based_on_purchase_history : 0); ?>
|
268 |
<div class="col-md-6">
|
269 |
+
<?php
|
270 |
+
if($pro){
|
271 |
+
?>
|
272 |
+
<input type="checkbox" class="" id="based_on_purchase_history" name="based_on_purchase_history"
|
273 |
+
value="1" <?php if($based_on_purchase_history){ echo 'checked'; } ?>>
|
274 |
+
<label class="checkbox_label" for="based_on_purchase_history"><?php esc_html_e('Yes, based on Purchase history.', 'woo-discount-rules'); ?></label>
|
275 |
+
<?php
|
276 |
+
} else {
|
277 |
+
?>
|
278 |
+
<div class="woo-support-in_pro">
|
279 |
+
<?php
|
280 |
+
esc_html_e('Supported in PRO version', 'woo-discount-rules');
|
281 |
+
?>
|
282 |
+
</div>
|
283 |
+
<?php
|
284 |
+
}
|
285 |
+
?>
|
286 |
+
|
287 |
<div class="form-group" id="based_on_purchase_history_fields">
|
288 |
<?php $purchased_history_amount = (isset($data->purchased_history_amount) ? $data->purchased_history_amount : 0); ?>
|
289 |
<label><?php esc_html_e('Total purchased amount at least', 'woo-discount-rules'); ?></label>
|
woo-discount-rules.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Simple Discount Rules for WooCommerce.
|
6 |
* Author: Flycart Technologies LLP
|
7 |
* Author URI: https://www.flycart.org
|
8 |
-
* Version: 1.4.
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Requires at least: 4.6.1
|
5 |
* Description: Simple Discount Rules for WooCommerce.
|
6 |
* Author: Flycart Technologies LLP
|
7 |
* Author URI: https://www.flycart.org
|
8 |
+
* Version: 1.4.32
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Requires at least: 4.6.1
|