Version Description
- 21/09/18 =
- Fix - Product select box not loading correctly style issue
- Feature - Cumulative option for specific products
Download this release
Release Info
Developer | flycart |
Plugin | Discount Rules for WooCommerce |
Version | 1.6.15 |
Comparing to | |
See all releases |
Code changes from version 1.6.14 to 1.6.15
- assets/js/app.js +1 -0
- includes/pricing-rules.php +30 -0
- loader.php +1 -1
- readme.txt +5 -1
- woo-discount-rules.php +1 -1
assets/js/app.js
CHANGED
@@ -303,6 +303,7 @@ function trigger_woocommerce_tooltip(){
|
|
303 |
$('#category_list').css('display', 'none');
|
304 |
$('#product_attributes_list').css('display', 'none');
|
305 |
$('#product_exclude_list').hide();
|
|
|
306 |
} else if (option == 'specific_category') {
|
307 |
$('#product_list').css('display', 'none');
|
308 |
$('#product_attributes_list').css('display', 'none');
|
303 |
$('#category_list').css('display', 'none');
|
304 |
$('#product_attributes_list').css('display', 'none');
|
305 |
$('#product_exclude_list').hide();
|
306 |
+
$('#cumulative_for_products_cont').show();
|
307 |
} else if (option == 'specific_category') {
|
308 |
$('#product_list').css('display', 'none');
|
309 |
$('#product_attributes_list').css('display', 'none');
|
includes/pricing-rules.php
CHANGED
@@ -765,6 +765,11 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
765 |
if (isset($rule->product_to_apply)) {
|
766 |
$rule_sets[$index]['type']['specific_products'] = $this->checkWithProducts($rule, $woocommerce);
|
767 |
}
|
|
|
|
|
|
|
|
|
|
|
768 |
} else if ($rule->apply_to == 'specific_category') {
|
769 |
if (isset($rule->apply_child_categories) && $rule->apply_child_categories) {
|
770 |
$rule_sets[$index]['type']['apply_child_categories'] = 1;
|
@@ -1116,6 +1121,9 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
1116 |
|
1117 |
case 'specific_products':
|
1118 |
if ($this->isItemInProductList($rule['type']['specific_products'], $item)) {
|
|
|
|
|
|
|
1119 |
$discount_amount = $this->getAdjustmentAmount($item, $quantity, $this->array_first($rule['discount']), $product_page, $bogo);
|
1120 |
$applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
|
1121 |
}
|
@@ -1446,6 +1454,28 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
1446 |
return $quantity;
|
1447 |
}
|
1448 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1449 |
/**
|
1450 |
* Get quantity of products from all products
|
1451 |
* */
|
765 |
if (isset($rule->product_to_apply)) {
|
766 |
$rule_sets[$index]['type']['specific_products'] = $this->checkWithProducts($rule, $woocommerce);
|
767 |
}
|
768 |
+
if (isset($rule->is_cumulative_for_products) && $rule->is_cumulative_for_products) {
|
769 |
+
$rule_sets[$index]['is_cumulative_for_products'] = 1;
|
770 |
+
} else {
|
771 |
+
$rule_sets[$index]['is_cumulative_for_products'] = 0;
|
772 |
+
}
|
773 |
} else if ($rule->apply_to == 'specific_category') {
|
774 |
if (isset($rule->apply_child_categories) && $rule->apply_child_categories) {
|
775 |
$rule_sets[$index]['type']['apply_child_categories'] = 1;
|
1121 |
|
1122 |
case 'specific_products':
|
1123 |
if ($this->isItemInProductList($rule['type']['specific_products'], $item)) {
|
1124 |
+
if(isset($rule['is_cumulative_for_products']) && $rule['is_cumulative_for_products']){
|
1125 |
+
$quantity = $this->getProductQuantityForCumulativeSpecificProducts($item, $product_page, $rule, $rule['type']['specific_products']);
|
1126 |
+
}
|
1127 |
$discount_amount = $this->getAdjustmentAmount($item, $quantity, $this->array_first($rule['discount']), $product_page, $bogo);
|
1128 |
$applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
|
1129 |
}
|
1454 |
return $quantity;
|
1455 |
}
|
1456 |
|
1457 |
+
/**
|
1458 |
+
* Get quantity of products from all products
|
1459 |
+
* */
|
1460 |
+
public function getProductQuantityForCumulativeSpecificProducts($item, $product_page, $rules, $specific_products){
|
1461 |
+
global $woocommerce;
|
1462 |
+
$quantity = 0;
|
1463 |
+
if($product_page) $quantity++;
|
1464 |
+
if(count($woocommerce->cart->cart_contents)){
|
1465 |
+
foreach ($woocommerce->cart->cart_contents as $cartItem) {
|
1466 |
+
$product_id = $cartItem['product_id'];
|
1467 |
+
if(isset($cartItem['variation_id']) && $cartItem['variation_id']){
|
1468 |
+
$product_id = $cartItem['variation_id'];
|
1469 |
+
}
|
1470 |
+
if(in_array($product_id, $specific_products)){
|
1471 |
+
$quantity = $quantity + $cartItem['quantity'];
|
1472 |
+
}
|
1473 |
+
|
1474 |
+
}
|
1475 |
+
}
|
1476 |
+
return $quantity;
|
1477 |
+
}
|
1478 |
+
|
1479 |
/**
|
1480 |
* Get quantity of products from all products
|
1481 |
* */
|
loader.php
CHANGED
@@ -116,7 +116,7 @@ if(!class_exists('FlycartWooDiscountRules')){
|
|
116 |
add_action('wp_ajax_RemoveRule', array($this->discountBase, 'removeRule'));
|
117 |
add_action('wp_ajax_doBulkAction', array($this->discountBase, 'doBulkAction'));
|
118 |
add_action('wp_ajax_createDuplicateRule', array($this->discountBase, 'createDuplicateRule'));
|
119 |
-
add_action('admin_enqueue_scripts', array($this->discountBase, 'woo_discount_adminPageScript') );
|
120 |
}
|
121 |
|
122 |
/**
|
116 |
add_action('wp_ajax_RemoveRule', array($this->discountBase, 'removeRule'));
|
117 |
add_action('wp_ajax_doBulkAction', array($this->discountBase, 'doBulkAction'));
|
118 |
add_action('wp_ajax_createDuplicateRule', array($this->discountBase, 'createDuplicateRule'));
|
119 |
+
add_action('admin_enqueue_scripts', array($this->discountBase, 'woo_discount_adminPageScript'), 100 );
|
120 |
}
|
121 |
|
122 |
/**
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flycart.org/
|
|
4 |
Tags: woocommerce, discounts, dynamic pricing, Buy One Get One Free, pricing deals, price rules, bulk discounts, advanced discounts, pricing deals
|
5 |
Requires at least: 4.4.1
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 1.6.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -308,6 +308,10 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
|
|
308 |
|
309 |
== Changelog ==
|
310 |
|
|
|
|
|
|
|
|
|
311 |
= 1.6.14 - 18/09/18 =
|
312 |
* Fix - PHP 5.3 compatible fatal error while activate
|
313 |
* Fix - Conflict with js because of loading wc-enhanced-select in footer
|
4 |
Tags: woocommerce, discounts, dynamic pricing, Buy One Get One Free, pricing deals, price rules, bulk discounts, advanced discounts, pricing deals
|
5 |
Requires at least: 4.4.1
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 1.6.15
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
308 |
|
309 |
== Changelog ==
|
310 |
|
311 |
+
= 1.6.15 - 21/09/18 =
|
312 |
+
* Fix - Product select box not loading correctly style issue
|
313 |
+
* Feature - Cumulative option for specific products
|
314 |
+
|
315 |
= 1.6.14 - 18/09/18 =
|
316 |
* Fix - PHP 5.3 compatible fatal error while activate
|
317 |
* Fix - Conflict with js because of loading wc-enhanced-select in footer
|
woo-discount-rules.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Simple Discount Rules for WooCommerce.
|
6 |
* Author: Flycart Technologies LLP
|
7 |
* Author URI: https://www.flycart.org
|
8 |
-
* Version: 1.6.
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Domain Path: /i18n/languages/
|
5 |
* Description: Simple Discount Rules for WooCommerce.
|
6 |
* Author: Flycart Technologies LLP
|
7 |
* Author URI: https://www.flycart.org
|
8 |
+
* Version: 1.6.15
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Domain Path: /i18n/languages/
|