Version Description
- 23/10/18 =
- Fix - Adding additional quantity when BOGO rule applied
- Fix - Other rules doesn't works when BOGO rule applied
- Fix - Style issue when enable hide o value
Download this release
Release Info
Developer | flycart |
Plugin | Discount Rules for WooCommerce |
Version | 1.6.18 |
Comparing to | |
See all releases |
Code changes from version 1.6.17 to 1.6.18
- helper/general-helper.php +12 -1
- includes/pricing-rules.php +7 -5
- readme.txt +6 -1
- woo-discount-rules.php +1 -1
helper/general-helper.php
CHANGED
@@ -6,6 +6,7 @@ include_once(WOO_DISCOUNT_DIR . '/helper/woo-function.php');
|
|
6 |
* Class FlycartWooDiscountRulesGeneralHelper
|
7 |
*/
|
8 |
if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
|
|
|
9 |
class FlycartWooDiscountRulesGeneralHelper
|
10 |
{
|
11 |
|
@@ -627,14 +628,24 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
|
|
627 |
}
|
628 |
if($has_coupon){
|
629 |
if(!empty($styles)){
|
|
|
|
|
630 |
$is_ajax = is_ajax();
|
631 |
$wc_ajax = isset($_REQUEST['wc-ajax'])? $_REQUEST['wc-ajax']: false;
|
632 |
-
if(!$is_ajax
|
|
|
|
|
|
|
633 |
echo "<style>".$styles."</style>";
|
634 |
}
|
635 |
}
|
636 |
}
|
637 |
}
|
638 |
}
|
|
|
|
|
|
|
|
|
|
|
639 |
}
|
640 |
}
|
6 |
* Class FlycartWooDiscountRulesGeneralHelper
|
7 |
*/
|
8 |
if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
|
9 |
+
global $styles_woo_discount;
|
10 |
class FlycartWooDiscountRulesGeneralHelper
|
11 |
{
|
12 |
|
628 |
}
|
629 |
if($has_coupon){
|
630 |
if(!empty($styles)){
|
631 |
+
global $styles_woo_discount;
|
632 |
+
$styles_woo_discount = $styles;
|
633 |
$is_ajax = is_ajax();
|
634 |
$wc_ajax = isset($_REQUEST['wc-ajax'])? $_REQUEST['wc-ajax']: false;
|
635 |
+
if(!$is_ajax){
|
636 |
+
//echo "<style>".$styles."</style>";
|
637 |
+
add_action('wp_head', 'FlycartWooDiscountRulesGeneralHelper::woo_discount_rules_custom_styles', 100);
|
638 |
+
} else if(in_array($wc_ajax, array('apply_coupon'))){
|
639 |
echo "<style>".$styles."</style>";
|
640 |
}
|
641 |
}
|
642 |
}
|
643 |
}
|
644 |
}
|
645 |
+
|
646 |
+
public static function woo_discount_rules_custom_styles(){
|
647 |
+
global $styles_woo_discount;
|
648 |
+
echo "<style>".$styles_woo_discount."</style>";
|
649 |
+
}
|
650 |
}
|
651 |
}
|
includes/pricing-rules.php
CHANGED
@@ -1125,7 +1125,8 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
1125 |
case 'specific_products':
|
1126 |
if ($this->isItemInProductList($rule['type']['specific_products'], $item)) {
|
1127 |
if(isset($rule['is_cumulative_for_products']) && $rule['is_cumulative_for_products']){
|
1128 |
-
$quantity = $this->getProductQuantityForCumulativeSpecificProducts($item,
|
|
|
1129 |
}
|
1130 |
$discount_amount = $this->getAdjustmentAmount($item, $quantity, $this->array_first($rule['discount']), $product_page, $bogo);
|
1131 |
$applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
|
@@ -1139,7 +1140,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
1139 |
$alreadyExists = 0;
|
1140 |
if(isset($rule['type']['is_cumulative']) && $rule['type']['is_cumulative']){
|
1141 |
$totalQuantityInThisCategory = $this->getProductQuantityInThisCategory($rule['type']['specific_category'], $rule['product_to_exclude'], $rule['exclude_sale_items']);
|
1142 |
-
if($product_page){
|
1143 |
$quantity = $quantity+$totalQuantityInThisCategory;
|
1144 |
} else {
|
1145 |
$quantity = $totalQuantityInThisCategory;
|
@@ -1176,7 +1177,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
1176 |
$alreadyExists = 0;
|
1177 |
if(isset($rule['type']['is_cumulative']) && $rule['type']['is_cumulative']){
|
1178 |
$totalQuantityInThisAttribute = $this->getProductQuantityInThisAttribute($rule['type']['specific_attribute'], $rule['product_to_exclude'], $rule['exclude_sale_items'], $id);
|
1179 |
-
if($product_page){
|
1180 |
$quantity = $quantity+$totalQuantityInThisAttribute;
|
1181 |
} else {
|
1182 |
$quantity = $totalQuantityInThisAttribute;
|
@@ -1212,7 +1213,8 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
1212 |
$is_not_in_exclude_sale_items = !$this->isItemInSaleItems($rule['exclude_sale_items'], $item['data']);
|
1213 |
if (!$this->isItemInProductList($rule['product_to_exclude'], $item) && $is_not_in_exclude_sale_items) {
|
1214 |
if(isset($rule['is_cumulative_for_products']) && $rule['is_cumulative_for_products']){
|
1215 |
-
$quantity = $this->getProductQuantityForCumulativeProducts($item,
|
|
|
1216 |
}
|
1217 |
$discount_amount = $this->getAdjustmentAmount($item, $quantity, $this->array_first($rule['discount']), $product_page, $bogo, $rule['product_to_exclude']);
|
1218 |
$applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
|
@@ -1224,7 +1226,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
1224 |
if(!empty($applied_rules[$i]['amount']['product_ids'])){
|
1225 |
$applyToProducts = $applied_rules[$i]['amount']['product_ids'];
|
1226 |
$applyPercent = $applied_rules[$i]['amount'];
|
1227 |
-
$applied_rules
|
1228 |
foreach ($applyToProducts as $key => $productId) {
|
1229 |
$cart = FlycartWoocommerceCart::get_cart();
|
1230 |
foreach ($cart as $cart_item_key => $values) {
|
1125 |
case 'specific_products':
|
1126 |
if ($this->isItemInProductList($rule['type']['specific_products'], $item)) {
|
1127 |
if(isset($rule['is_cumulative_for_products']) && $rule['is_cumulative_for_products']){
|
1128 |
+
if($bogo) $quantity = $this->getProductQuantityForCumulativeSpecificProducts($item, 0, $rule, $rule['type']['specific_products']);
|
1129 |
+
else $quantity = $this->getProductQuantityForCumulativeSpecificProducts($item, $product_page, $rule, $rule['type']['specific_products']);
|
1130 |
}
|
1131 |
$discount_amount = $this->getAdjustmentAmount($item, $quantity, $this->array_first($rule['discount']), $product_page, $bogo);
|
1132 |
$applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
|
1140 |
$alreadyExists = 0;
|
1141 |
if(isset($rule['type']['is_cumulative']) && $rule['type']['is_cumulative']){
|
1142 |
$totalQuantityInThisCategory = $this->getProductQuantityInThisCategory($rule['type']['specific_category'], $rule['product_to_exclude'], $rule['exclude_sale_items']);
|
1143 |
+
if($product_page && !$bogo){
|
1144 |
$quantity = $quantity+$totalQuantityInThisCategory;
|
1145 |
} else {
|
1146 |
$quantity = $totalQuantityInThisCategory;
|
1177 |
$alreadyExists = 0;
|
1178 |
if(isset($rule['type']['is_cumulative']) && $rule['type']['is_cumulative']){
|
1179 |
$totalQuantityInThisAttribute = $this->getProductQuantityInThisAttribute($rule['type']['specific_attribute'], $rule['product_to_exclude'], $rule['exclude_sale_items'], $id);
|
1180 |
+
if($product_page && !$bogo){
|
1181 |
$quantity = $quantity+$totalQuantityInThisAttribute;
|
1182 |
} else {
|
1183 |
$quantity = $totalQuantityInThisAttribute;
|
1213 |
$is_not_in_exclude_sale_items = !$this->isItemInSaleItems($rule['exclude_sale_items'], $item['data']);
|
1214 |
if (!$this->isItemInProductList($rule['product_to_exclude'], $item) && $is_not_in_exclude_sale_items) {
|
1215 |
if(isset($rule['is_cumulative_for_products']) && $rule['is_cumulative_for_products']){
|
1216 |
+
if($bogo) $quantity = $this->getProductQuantityForCumulativeProducts($item, 0, $rule);
|
1217 |
+
else $quantity = $this->getProductQuantityForCumulativeProducts($item, $product_page, $rule);
|
1218 |
}
|
1219 |
$discount_amount = $this->getAdjustmentAmount($item, $quantity, $this->array_first($rule['discount']), $product_page, $bogo, $rule['product_to_exclude']);
|
1220 |
$applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
|
1226 |
if(!empty($applied_rules[$i]['amount']['product_ids'])){
|
1227 |
$applyToProducts = $applied_rules[$i]['amount']['product_ids'];
|
1228 |
$applyPercent = $applied_rules[$i]['amount'];
|
1229 |
+
unset($applied_rules[$i]);
|
1230 |
foreach ($applyToProducts as $key => $productId) {
|
1231 |
$cart = FlycartWoocommerceCart::get_cart();
|
1232 |
foreach ($cart as $cart_item_key => $values) {
|
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,11 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
|
|
308 |
|
309 |
== Changelog ==
|
310 |
|
|
|
|
|
|
|
|
|
|
|
311 |
= 1.6.17 - 10/10/18 =
|
312 |
* Feature - Option to display message in cart while apply price rules
|
313 |
* Improvement - Event apply_filters('woo_discount_rules_load_minimum_product_variant_price', false, $product) to handle variant strikeout price
|
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.18
|
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.18 - 23/10/18 =
|
312 |
+
* Fix - Adding additional quantity when BOGO rule applied
|
313 |
+
* Fix - Other rules doesn't works when BOGO rule applied
|
314 |
+
* Fix - Style issue when enable hide o value
|
315 |
+
|
316 |
= 1.6.17 - 10/10/18 =
|
317 |
* Feature - Option to display message in cart while apply price rules
|
318 |
* Improvement - Event apply_filters('woo_discount_rules_load_minimum_product_variant_price', false, $product) to handle variant strikeout price
|
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.18
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Domain Path: /i18n/languages/
|