Version Description
- 09/03/18 =
- Feature - Cumulative option for apply to all products in Pricing rules
Download this release
Release Info
Developer | flycart |
Plugin | Discount Rules for WooCommerce |
Version | 1.5.3 |
Comparing to | |
See all releases |
Code changes from version 1.5.2 to 1.5.3
- assets/js/app.js +2 -1
- helper/general-helper.php +10 -0
- includes/pricing-rules.php +56 -4
- readme.txt +4 -1
- view/view-pricing-rules.php +31 -22
- woo-discount-rules.php +1 -1
assets/js/app.js
CHANGED
@@ -265,7 +265,7 @@ function validateFields(){
|
|
265 |
// Manage the Type of Apply.
|
266 |
$('#apply_to').on('change', function () {
|
267 |
var option = $(this).val();
|
268 |
-
|
269 |
if (option == 'specific_products') {
|
270 |
$('#product_list').css('display', 'block');
|
271 |
$('#category_list').css('display', 'none');
|
@@ -278,6 +278,7 @@ function validateFields(){
|
|
278 |
$('#product_list').css('display', 'none');
|
279 |
$('#category_list').css('display', 'none');
|
280 |
$('#product_exclude_list').show();
|
|
|
281 |
}
|
282 |
});
|
283 |
$('#apply_to').trigger('change');
|
265 |
// Manage the Type of Apply.
|
266 |
$('#apply_to').on('change', function () {
|
267 |
var option = $(this).val();
|
268 |
+
$('#cumulative_for_products_cont').hide();
|
269 |
if (option == 'specific_products') {
|
270 |
$('#product_list').css('display', 'block');
|
271 |
$('#category_list').css('display', 'none');
|
278 |
$('#product_list').css('display', 'none');
|
279 |
$('#category_list').css('display', 'none');
|
280 |
$('#product_exclude_list').show();
|
281 |
+
$('#cumulative_for_products_cont').show();
|
282 |
}
|
283 |
});
|
284 |
$('#apply_to').trigger('change');
|
helper/general-helper.php
CHANGED
@@ -372,6 +372,16 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
|
|
372 |
}
|
373 |
if(defined('DOING_AJAX') && DOING_AJAX){
|
374 |
$status = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
}
|
376 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){
|
377 |
$status = false;
|
372 |
}
|
373 |
if(defined('DOING_AJAX') && DOING_AJAX){
|
374 |
$status = true;
|
375 |
+
$postData = \FlycartInput\FInput::getInstance();
|
376 |
+
$action = $postData->get('action', '');
|
377 |
+
$form = $postData->get('from', '');
|
378 |
+
if($action == 'saveCartRule' || $action == 'savePriceRule'){
|
379 |
+
$status = false;
|
380 |
+
} else if(($action == 'UpdateStatus' || $action == 'RemoveRule') && ($form == 'cart-rules' || $form == 'pricing-rules')){
|
381 |
+
$status = false;
|
382 |
+
} else if($action == 'saveConfig' && $form == 'settings'){
|
383 |
+
$status = false;
|
384 |
+
}
|
385 |
}
|
386 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){
|
387 |
$status = false;
|
includes/pricing-rules.php
CHANGED
@@ -170,6 +170,14 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
170 |
} elseif ($apply_to == 'specific_products') {
|
171 |
$apply_to = 'product_to_apply';
|
172 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
$form[] = $apply_to;
|
174 |
|
175 |
if (isset($request[$apply_to])) $request[$apply_to] = json_encode($request[$apply_to]);
|
@@ -589,9 +597,13 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
589 |
}
|
590 |
$rule_sets[$index]['product_to_exclude'] = $this->getExcludeProductsFromRule($rule);
|
591 |
} else {
|
592 |
-
|
593 |
$rule_sets[$index]['type'] = 'all';
|
594 |
$rule_sets[$index]['product_to_exclude'] = $this->getExcludeProductsFromRule($rule);
|
|
|
|
|
|
|
|
|
|
|
595 |
}
|
596 |
|
597 |
$rule_sets[$index]['discount'] = 0;
|
@@ -773,7 +785,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
773 |
if ($this->isItemInCategoryList($rule['type']['specific_category'], $item) && $notInProductList) {
|
774 |
$alreadyExists = 0;
|
775 |
if(isset($rule['type']['is_cumulative']) && $rule['type']['is_cumulative']){
|
776 |
-
$totalQuantityInThisCategory = $this->getProductQuantityInThisCategory($rule['type']['specific_category']);
|
777 |
$quantity = $totalQuantityInThisCategory;
|
778 |
//Check for product_discount to apply the rule only once
|
779 |
if(isset($rule['discount'])){
|
@@ -804,6 +816,10 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
804 |
case 'all_products':
|
805 |
default:
|
806 |
if (!$this->isItemInProductList($rule['product_to_exclude'], $item)) {
|
|
|
|
|
|
|
|
|
807 |
$discount_amount = $this->getAdjustmentAmount($quantity, $this->array_first($rule['discount']), $product_page);
|
808 |
$applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
|
809 |
}
|
@@ -927,11 +943,21 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
927 |
/**
|
928 |
* Get quantity of products in specific category
|
929 |
* */
|
930 |
-
public function getProductQuantityInThisCategory($category){
|
931 |
global $woocommerce;
|
932 |
-
$quantity = 0;
|
|
|
933 |
if(count($woocommerce->cart->cart_contents)){
|
934 |
foreach ($woocommerce->cart->cart_contents as $cartItem) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
935 |
$terms = get_the_terms( $cartItem['product_id'], 'product_cat' );
|
936 |
if($terms){
|
937 |
$has = 0;
|
@@ -949,6 +975,32 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
949 |
return $quantity;
|
950 |
}
|
951 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
952 |
/**
|
953 |
* Return the First index.
|
954 |
*
|
170 |
} elseif ($apply_to == 'specific_products') {
|
171 |
$apply_to = 'product_to_apply';
|
172 |
}
|
173 |
+
|
174 |
+
if(isset($request['is_cumulative_for_products']) && $request['is_cumulative_for_products'] == 1){
|
175 |
+
$request['is_cumulative_for_products'] = 1;
|
176 |
+
} else {
|
177 |
+
$request['is_cumulative_for_products'] = 0;
|
178 |
+
}
|
179 |
+
$form[] = 'is_cumulative_for_products';
|
180 |
+
|
181 |
$form[] = $apply_to;
|
182 |
|
183 |
if (isset($request[$apply_to])) $request[$apply_to] = json_encode($request[$apply_to]);
|
597 |
}
|
598 |
$rule_sets[$index]['product_to_exclude'] = $this->getExcludeProductsFromRule($rule);
|
599 |
} else {
|
|
|
600 |
$rule_sets[$index]['type'] = 'all';
|
601 |
$rule_sets[$index]['product_to_exclude'] = $this->getExcludeProductsFromRule($rule);
|
602 |
+
if (isset($rule->is_cumulative_for_products) && $rule->is_cumulative_for_products) {
|
603 |
+
$rule_sets[$index]['is_cumulative_for_products'] = 1;
|
604 |
+
} else {
|
605 |
+
$rule_sets[$index]['is_cumulative_for_products'] = 0;
|
606 |
+
}
|
607 |
}
|
608 |
|
609 |
$rule_sets[$index]['discount'] = 0;
|
785 |
if ($this->isItemInCategoryList($rule['type']['specific_category'], $item) && $notInProductList) {
|
786 |
$alreadyExists = 0;
|
787 |
if(isset($rule['type']['is_cumulative']) && $rule['type']['is_cumulative']){
|
788 |
+
$totalQuantityInThisCategory = $this->getProductQuantityInThisCategory($rule['type']['specific_category'], $rule['product_to_exclude']);
|
789 |
$quantity = $totalQuantityInThisCategory;
|
790 |
//Check for product_discount to apply the rule only once
|
791 |
if(isset($rule['discount'])){
|
816 |
case 'all_products':
|
817 |
default:
|
818 |
if (!$this->isItemInProductList($rule['product_to_exclude'], $item)) {
|
819 |
+
if(isset($rule['is_cumulative_for_products']) && $rule['is_cumulative_for_products']){
|
820 |
+
$totalQuantityFromAllProducts = $this->getProductQuantityForCumulativeProducts($item, $product_page, $rule);
|
821 |
+
$quantity = $totalQuantityFromAllProducts;
|
822 |
+
}
|
823 |
$discount_amount = $this->getAdjustmentAmount($quantity, $this->array_first($rule['discount']), $product_page);
|
824 |
$applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
|
825 |
}
|
943 |
/**
|
944 |
* Get quantity of products in specific category
|
945 |
* */
|
946 |
+
public function getProductQuantityInThisCategory($category, $product_to_exclude){
|
947 |
global $woocommerce;
|
948 |
+
$hasExcludeProduct = $quantity = 0;
|
949 |
+
if(!empty($product_to_exclude) && is_array($product_to_exclude) && count($product_to_exclude)) $hasExcludeProduct = 1;
|
950 |
if(count($woocommerce->cart->cart_contents)){
|
951 |
foreach ($woocommerce->cart->cart_contents as $cartItem) {
|
952 |
+
if($hasExcludeProduct){
|
953 |
+
$product_id = $cartItem['product_id'];
|
954 |
+
if(isset($cartItem['variation_id']) && $cartItem['variation_id']){
|
955 |
+
$product_id = $cartItem['variation_id'];
|
956 |
+
}
|
957 |
+
if(in_array($product_id, $product_to_exclude)){
|
958 |
+
continue;
|
959 |
+
}
|
960 |
+
}
|
961 |
$terms = get_the_terms( $cartItem['product_id'], 'product_cat' );
|
962 |
if($terms){
|
963 |
$has = 0;
|
975 |
return $quantity;
|
976 |
}
|
977 |
|
978 |
+
/**
|
979 |
+
* Get quantity of products from all products
|
980 |
+
* */
|
981 |
+
public function getProductQuantityForCumulativeProducts($item, $product_page, $rules){
|
982 |
+
$product_to_exclude = $rules['product_to_exclude'];
|
983 |
+
global $woocommerce;
|
984 |
+
$hasExcludeProduct = $quantity = 0;
|
985 |
+
if($product_page) $quantity++;
|
986 |
+
if(!empty($product_to_exclude) && is_array($product_to_exclude) && count($product_to_exclude)) $hasExcludeProduct = 1;
|
987 |
+
if(count($woocommerce->cart->cart_contents)){
|
988 |
+
foreach ($woocommerce->cart->cart_contents as $cartItem) {
|
989 |
+
if($hasExcludeProduct){
|
990 |
+
$product_id = $cartItem['product_id'];
|
991 |
+
if(isset($cartItem['variation_id']) && $cartItem['variation_id']){
|
992 |
+
$product_id = $cartItem['variation_id'];
|
993 |
+
}
|
994 |
+
if(in_array($product_id, $product_to_exclude)){
|
995 |
+
continue;
|
996 |
+
}
|
997 |
+
}
|
998 |
+
$quantity = $quantity + $cartItem['quantity'];
|
999 |
+
}
|
1000 |
+
}
|
1001 |
+
return $quantity;
|
1002 |
+
}
|
1003 |
+
|
1004 |
/**
|
1005 |
* Return the First index.
|
1006 |
*
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flycart.org/
|
|
4 |
Tags: woocommerce, discounts, dynamic pricing, Buy One Get One Free, pricing deals, price rules, bulk discounts, advanced discounts
|
5 |
Requires at least: 4.4.1
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 1.5.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -241,6 +241,9 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
|
|
241 |
|
242 |
== Changelog ==
|
243 |
|
|
|
|
|
|
|
244 |
= 1.5.2 - 05/03/18 =
|
245 |
* Improvement - Dependant product UI improvement
|
246 |
* Fix - Cheapest from category rule for variants not working(Pro)
|
4 |
Tags: woocommerce, discounts, dynamic pricing, Buy One Get One Free, pricing deals, price rules, bulk discounts, advanced discounts
|
5 |
Requires at least: 4.4.1
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 1.5.3
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
241 |
|
242 |
== Changelog ==
|
243 |
|
244 |
+
= 1.5.3 - 09/03/18 =
|
245 |
+
* Feature - Cumulative option for apply to all products in Pricing rules
|
246 |
+
|
247 |
= 1.5.2 - 05/03/18 =
|
248 |
* Improvement - Dependant product UI improvement
|
249 |
* Fix - Cheapest from category rule for variants not working(Pro)
|
view/view-pricing-rules.php
CHANGED
@@ -41,8 +41,8 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
|
|
41 |
<div class="form-group">
|
42 |
<div class="row">
|
43 |
<div class="col-md-3"><label> Order : <i
|
44 |
-
|
45 |
-
|
46 |
</div>
|
47 |
<div class="col-md-6"><input type="number" class="rule_order"
|
48 |
id="rule_order"
|
@@ -57,8 +57,8 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
|
|
57 |
<div class="form-group">
|
58 |
<div class="row">
|
59 |
<div class="col-md-3"><label> Rule Name <i
|
60 |
-
|
61 |
-
|
62 |
<div class="col-md-6"><input type="text" class="form-control rule_descr"
|
63 |
id="rule_name"
|
64 |
name="rule_name"
|
@@ -69,8 +69,8 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
|
|
69 |
<div class="form-group">
|
70 |
<div class="row">
|
71 |
<div class="col-md-3"><label> Rule Description <i
|
72 |
-
|
73 |
-
|
74 |
<div class="col-md-6"><input type="text" class="form-control rule_descr"
|
75 |
name="rule_descr"
|
76 |
value="<?php echo(isset($data->rule_descr) ? $data->rule_descr : ''); ?>"
|
@@ -80,13 +80,13 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
|
|
80 |
<div class="form-group">
|
81 |
<div class="row">
|
82 |
<div class="col-md-3"><label> Method <i
|
83 |
-
|
84 |
-
|
85 |
<?php $opt = (isset($data->rule_method) ? $data->rule_method : ''); ?>
|
86 |
<div class="col-md-6"><select class="form-control"
|
87 |
name="rule_method" id="price_rule_method">
|
88 |
<option
|
89 |
-
|
90 |
Quantity based by product/category and BOGO deals
|
91 |
</option>
|
92 |
<option
|
@@ -105,8 +105,8 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
|
|
105 |
<div class="form-group">
|
106 |
<div class="row">
|
107 |
<div class="col-md-3"><label> Validity <i
|
108 |
-
|
109 |
-
|
110 |
<div class="col-md-6">
|
111 |
<div class="form-inline"><input type="text"
|
112 |
name="date_from"
|
@@ -136,7 +136,7 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
|
|
136 |
<div class="col-md-6"><select class="selectpicker"
|
137 |
name="apply_to" id="apply_to">
|
138 |
<option
|
139 |
-
|
140 |
All Products
|
141 |
</option>
|
142 |
<option
|
@@ -149,7 +149,7 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
|
|
149 |
<?php } ?>
|
150 |
</option>
|
151 |
<option
|
152 |
-
|
153 |
Specific Products
|
154 |
</option>
|
155 |
</select>
|
@@ -158,13 +158,17 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
|
|
158 |
echo FlycartWoocommerceProduct::getProductAjaxSelectBox($products_list, 'product_to_apply');
|
159 |
?>
|
160 |
</div>
|
|
|
|
|
|
|
|
|
161 |
<div class="form-group" id="category_list">
|
162 |
<?php $category_list = json_decode((isset($data->category_to_apply) ? $data->category_to_apply : '{}'), true); ?>
|
163 |
<select class="category_list selectpicker" multiple
|
164 |
name="category_to_apply[]">
|
165 |
<?php foreach ($category as $index => $value) { ?>
|
166 |
<option
|
167 |
-
|
168 |
<?php } ?>
|
169 |
</select>
|
170 |
<?php $is_cumulative = (isset($data->is_cumulative))? $data->is_cumulative : 0 ?>
|
@@ -183,10 +187,15 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
|
|
183 |
<div class="col-md-3"><label><?php esc_html_e('Exclude products', 'woo-discount-rules'); ?></label></div>
|
184 |
<div class="col-md-6">
|
185 |
<?php
|
186 |
-
if(
|
187 |
-
$
|
188 |
-
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
190 |
echo FlycartWoocommerceProduct::getProductAjaxSelectBox($product_exclude_list, 'product_to_exclude');
|
191 |
?>
|
192 |
</div>
|
@@ -254,7 +263,7 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
|
|
254 |
<div class="col-md-6">
|
255 |
<?php
|
256 |
if($pro){
|
257 |
-
|
258 |
<input type="checkbox" class="" id="based_on_purchase_history" name="based_on_purchase_history"
|
259 |
value="1" <?php if($based_on_purchase_history){ echo 'checked'; } ?>>
|
260 |
<label class="checkbox_label" for="based_on_purchase_history"><?php esc_html_e('Yes, based on Purchase history.', 'woo-discount-rules'); ?></label>
|
@@ -345,7 +354,7 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
|
|
345 |
<h4 class="text text-muted"> Discount</h4>
|
346 |
<div class="qty_based_discount_cont price_discounts_con">
|
347 |
<a href=javascript:void(0) class="button button-primary" id="addNewDiscountRange"><i
|
348 |
-
|
349 |
<hr>
|
350 |
<div id="discount_rule_list">
|
351 |
<?php
|
@@ -383,7 +392,7 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
|
|
383 |
name="discount_range[<?php echo $fieldIndex; ?>][discount_type]">
|
384 |
<?php $opt = (isset($discount->discount_type) ? $discount->discount_type : ''); ?>
|
385 |
<option
|
386 |
-
|
387 |
Percentage Discount
|
388 |
</option>
|
389 |
|
@@ -485,7 +494,7 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
|
|
485 |
|
486 |
</div>
|
487 |
</div>
|
488 |
-
|
489 |
</div>
|
490 |
</div>
|
491 |
<div class="product_based_discount_cont price_discounts_con">
|
41 |
<div class="form-group">
|
42 |
<div class="row">
|
43 |
<div class="col-md-3"><label> Order : <i
|
44 |
+
class="text-muted glyphicon glyphicon-exclamation-sign"
|
45 |
+
title="The Simple Ranking concept to said, which one is going to execute first and so on."></i></label>
|
46 |
</div>
|
47 |
<div class="col-md-6"><input type="number" class="rule_order"
|
48 |
id="rule_order"
|
57 |
<div class="form-group">
|
58 |
<div class="row">
|
59 |
<div class="col-md-3"><label> Rule Name <i
|
60 |
+
class="text-muted glyphicon glyphicon-exclamation-sign"
|
61 |
+
title="Rule Desctriptions."></i></label></div>
|
62 |
<div class="col-md-6"><input type="text" class="form-control rule_descr"
|
63 |
id="rule_name"
|
64 |
name="rule_name"
|
69 |
<div class="form-group">
|
70 |
<div class="row">
|
71 |
<div class="col-md-3"><label> Rule Description <i
|
72 |
+
class="text-muted glyphicon glyphicon-exclamation-sign"
|
73 |
+
title="Rule Desctriptions."></i></label></div>
|
74 |
<div class="col-md-6"><input type="text" class="form-control rule_descr"
|
75 |
name="rule_descr"
|
76 |
value="<?php echo(isset($data->rule_descr) ? $data->rule_descr : ''); ?>"
|
80 |
<div class="form-group">
|
81 |
<div class="row">
|
82 |
<div class="col-md-3"><label> Method <i
|
83 |
+
class="text-muted glyphicon glyphicon-exclamation-sign"
|
84 |
+
title="Method to Apply."></i></label></div>
|
85 |
<?php $opt = (isset($data->rule_method) ? $data->rule_method : ''); ?>
|
86 |
<div class="col-md-6"><select class="form-control"
|
87 |
name="rule_method" id="price_rule_method">
|
88 |
<option
|
89 |
+
value="qty_based" <?php if ($opt == 'qty_based') { ?> selected=selected <?php } ?>>
|
90 |
Quantity based by product/category and BOGO deals
|
91 |
</option>
|
92 |
<option
|
105 |
<div class="form-group">
|
106 |
<div class="row">
|
107 |
<div class="col-md-3"><label> Validity <i
|
108 |
+
class="text-muted glyphicon glyphicon-exclamation-sign"
|
109 |
+
title="Period of Rule Active."></i></label></div>
|
110 |
<div class="col-md-6">
|
111 |
<div class="form-inline"><input type="text"
|
112 |
name="date_from"
|
136 |
<div class="col-md-6"><select class="selectpicker"
|
137 |
name="apply_to" id="apply_to">
|
138 |
<option
|
139 |
+
value="all_products" <?php if ($opt == 'all_products') { ?> selected=selected <?php } ?>>
|
140 |
All Products
|
141 |
</option>
|
142 |
<option
|
149 |
<?php } ?>
|
150 |
</option>
|
151 |
<option
|
152 |
+
value="specific_products" <?php if ($opt == 'specific_products') { ?> selected=selected <?php } ?>>
|
153 |
Specific Products
|
154 |
</option>
|
155 |
</select>
|
158 |
echo FlycartWoocommerceProduct::getProductAjaxSelectBox($products_list, 'product_to_apply');
|
159 |
?>
|
160 |
</div>
|
161 |
+
<?php $is_cumulative_for_products = (isset($data->is_cumulative_for_products))? $data->is_cumulative_for_products : 0 ?>
|
162 |
+
<div class="form-group" id="cumulative_for_products_cont">
|
163 |
+
<input type="checkbox" name="is_cumulative_for_products" id="is_cumulative_for_products" value="1" <?php if($is_cumulative_for_products) { echo "checked"; } ?>> <label class="checkbox_label" for="is_cumulative_for_products">Is Cumulative</label>
|
164 |
+
</div>
|
165 |
<div class="form-group" id="category_list">
|
166 |
<?php $category_list = json_decode((isset($data->category_to_apply) ? $data->category_to_apply : '{}'), true); ?>
|
167 |
<select class="category_list selectpicker" multiple
|
168 |
name="category_to_apply[]">
|
169 |
<?php foreach ($category as $index => $value) { ?>
|
170 |
<option
|
171 |
+
value="<?php echo $index; ?>"<?php if (in_array($index, $category_list)) { ?> selected=selected <?php } ?>><?php echo $value; ?></option>
|
172 |
<?php } ?>
|
173 |
</select>
|
174 |
<?php $is_cumulative = (isset($data->is_cumulative))? $data->is_cumulative : 0 ?>
|
187 |
<div class="col-md-3"><label><?php esc_html_e('Exclude products', 'woo-discount-rules'); ?></label></div>
|
188 |
<div class="col-md-6">
|
189 |
<?php
|
190 |
+
if(isset($data->product_to_exclude)){
|
191 |
+
if(is_array($data->product_to_exclude))
|
192 |
+
$product_exclude_list = $data->product_to_exclude;
|
193 |
+
else
|
194 |
+
$product_exclude_list = json_decode((isset($data->product_to_exclude) ? $data->product_to_exclude : '{}'), true);
|
195 |
+
} else {
|
196 |
+
$product_exclude_list = array();
|
197 |
+
}
|
198 |
+
|
199 |
echo FlycartWoocommerceProduct::getProductAjaxSelectBox($product_exclude_list, 'product_to_exclude');
|
200 |
?>
|
201 |
</div>
|
263 |
<div class="col-md-6">
|
264 |
<?php
|
265 |
if($pro){
|
266 |
+
?>
|
267 |
<input type="checkbox" class="" id="based_on_purchase_history" name="based_on_purchase_history"
|
268 |
value="1" <?php if($based_on_purchase_history){ echo 'checked'; } ?>>
|
269 |
<label class="checkbox_label" for="based_on_purchase_history"><?php esc_html_e('Yes, based on Purchase history.', 'woo-discount-rules'); ?></label>
|
354 |
<h4 class="text text-muted"> Discount</h4>
|
355 |
<div class="qty_based_discount_cont price_discounts_con">
|
356 |
<a href=javascript:void(0) class="button button-primary" id="addNewDiscountRange"><i
|
357 |
+
class="glyphicon glyphicon-plus"></i> Add New Range</a>
|
358 |
<hr>
|
359 |
<div id="discount_rule_list">
|
360 |
<?php
|
392 |
name="discount_range[<?php echo $fieldIndex; ?>][discount_type]">
|
393 |
<?php $opt = (isset($discount->discount_type) ? $discount->discount_type : ''); ?>
|
394 |
<option
|
395 |
+
value="percentage_discount" <?php if ($opt == 'percentage_discount') { ?> selected=selected <?php } ?> >
|
396 |
Percentage Discount
|
397 |
</option>
|
398 |
|
494 |
|
495 |
</div>
|
496 |
</div>
|
497 |
+
<?php $fieldIndex++; } ?>
|
498 |
</div>
|
499 |
</div>
|
500 |
<div class="product_based_discount_cont price_discounts_con">
|
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.5.
|
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.5.3
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Requires at least: 4.6.1
|