Version Description
- 13/05/19 =
- Improvement - BOGO auto add made compatible with WooCommerce v3.6.2
- Improvement - Avoid error while selecting additional taxonomy and if it is not valid.
- Improvement - Event apply_filters('woo_discount_rules_price_strikeout_discount_price_html', $item_price, $product, $original_item_price, $new_item_price);
Download this release
Release Info
Developer | flycart |
Plugin | Discount Rules for WooCommerce |
Version | 1.7.14 |
Comparing to | |
See all releases |
Code changes from version 1.7.13 to 1.7.14
- helper/general-helper.php +44 -26
- includes/pricing-rules.php +13 -4
- loader.php +4 -2
- readme.txt +8 -3
- woo-discount-rules.php +1 -1
helper/general-helper.php
CHANGED
@@ -226,46 +226,50 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
|
|
226 |
$result = array();
|
227 |
$taxonomies = apply_filters('woo_discount_rules_accepted_taxonomy_for_category', array('product_cat'));
|
228 |
$post_categories_raw = get_terms($taxonomies, array('hide_empty' => 0));
|
229 |
-
|
|
|
230 |
|
231 |
-
|
232 |
-
|
|
|
233 |
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
|
242 |
-
|
243 |
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
|
248 |
-
|
249 |
|
250 |
-
|
251 |
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
|
262 |
-
|
|
|
|
|
263 |
}
|
264 |
}
|
|
|
|
|
265 |
}
|
266 |
}
|
267 |
-
|
268 |
-
$result[$post_cat->term_id] = $category_name;
|
269 |
}
|
270 |
|
271 |
return $result;
|
@@ -878,5 +882,19 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
|
|
878 |
}
|
879 |
return false;
|
880 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
881 |
}
|
882 |
}
|
226 |
$result = array();
|
227 |
$taxonomies = apply_filters('woo_discount_rules_accepted_taxonomy_for_category', array('product_cat'));
|
228 |
$post_categories_raw = get_terms($taxonomies, array('hide_empty' => 0));
|
229 |
+
if(is_array($post_categories_raw)){
|
230 |
+
$post_categories_raw_count = count($post_categories_raw);
|
231 |
|
232 |
+
foreach ($post_categories_raw as $post_cat_key => $post_cat) {
|
233 |
+
if(isset($post_cat->name)){
|
234 |
+
$category_name = $post_cat->name;
|
235 |
|
236 |
+
if ($post_cat->parent) {
|
237 |
+
$parent_id = $post_cat->parent;
|
238 |
+
$has_parent = true;
|
239 |
|
240 |
+
// Make sure we don't have an infinite loop here (happens with some kind of "ghost" categories)
|
241 |
+
$found = false;
|
242 |
+
$i = 0;
|
243 |
|
244 |
+
while ($has_parent && ($i < $post_categories_raw_count || $found)) {
|
245 |
|
246 |
+
// Reset each time
|
247 |
+
$found = false;
|
248 |
+
$i = 0;
|
249 |
|
250 |
+
foreach ($post_categories_raw as $parent_post_cat_key => $parent_post_cat) {
|
251 |
|
252 |
+
$i++;
|
253 |
|
254 |
+
if ($parent_post_cat->term_id == $parent_id) {
|
255 |
+
$category_name = $parent_post_cat->name . ' → ' . $category_name;
|
256 |
+
$found = true;
|
257 |
|
258 |
+
if ($parent_post_cat->parent) {
|
259 |
+
$parent_id = $parent_post_cat->parent;
|
260 |
+
} else {
|
261 |
+
$has_parent = false;
|
262 |
+
}
|
263 |
|
264 |
+
break;
|
265 |
+
}
|
266 |
+
}
|
267 |
}
|
268 |
}
|
269 |
+
|
270 |
+
$result[$post_cat->term_id] = $category_name;
|
271 |
}
|
272 |
}
|
|
|
|
|
273 |
}
|
274 |
|
275 |
return $result;
|
882 |
}
|
883 |
return false;
|
884 |
}
|
885 |
+
|
886 |
+
/**
|
887 |
+
* Is same string
|
888 |
+
* */
|
889 |
+
public static function is_same_string($first, $second){
|
890 |
+
$first = str_replace("–", '-', $first);
|
891 |
+
$first = strip_tags($first);
|
892 |
+
$second = str_replace("–", '-', $second);
|
893 |
+
$second = strip_tags($second);
|
894 |
+
if($first == $second){
|
895 |
+
return true;
|
896 |
+
}
|
897 |
+
return false;
|
898 |
+
}
|
899 |
}
|
900 |
}
|
includes/pricing-rules.php
CHANGED
@@ -690,6 +690,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
690 |
public function handleBOGODiscountAfterApplyCoupon($coupon_code){
|
691 |
$carts = FlycartWoocommerceCart::get_cart();
|
692 |
if(is_array($carts) && count($carts)){
|
|
|
693 |
foreach ($carts as $cart_item_key => $cart_item){
|
694 |
if(empty($cart_item['data'])){
|
695 |
continue;
|
@@ -3483,8 +3484,12 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
3483 |
$item_price = preg_replace('/<del>.*<\/del>/', '', $item_price);
|
3484 |
}
|
3485 |
$item_price = apply_filters('woo_discount_rules_price_strikeout_before_discount_price', $item_price, $product);
|
3486 |
-
|
3487 |
-
|
|
|
|
|
|
|
|
|
3488 |
}
|
3489 |
$item_price = apply_filters('woo_discount_rules_price_strikeout_after_discount_price', $item_price, $product);
|
3490 |
}
|
@@ -3571,8 +3576,12 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
3571 |
$item_price = preg_replace('/<del>.*<\/del>/', '', $item_price);
|
3572 |
}
|
3573 |
$item_price = apply_filters('woo_discount_rules_price_strikeout_before_discount_price', $item_price, $product);
|
3574 |
-
|
3575 |
-
|
|
|
|
|
|
|
|
|
3576 |
}
|
3577 |
$item_price = apply_filters('woo_discount_rules_price_strikeout_after_discount_price', $item_price, $product);
|
3578 |
}
|
690 |
public function handleBOGODiscountAfterApplyCoupon($coupon_code){
|
691 |
$carts = FlycartWoocommerceCart::get_cart();
|
692 |
if(is_array($carts) && count($carts)){
|
693 |
+
self::$rule_sets_generated = false;
|
694 |
foreach ($carts as $cart_item_key => $cart_item){
|
695 |
if(empty($cart_item['data'])){
|
696 |
continue;
|
3484 |
$item_price = preg_replace('/<del>.*<\/del>/', '', $item_price);
|
3485 |
}
|
3486 |
$item_price = apply_filters('woo_discount_rules_price_strikeout_before_discount_price', $item_price, $product);
|
3487 |
+
$original_item_price = $item_price;
|
3488 |
+
$new_item_price = (($price_to_display).$product->get_price_suffix($discountPrice));
|
3489 |
+
$is_both_are_same = FlycartWooDiscountRulesGeneralHelper::is_same_string($original_item_price, $new_item_price);
|
3490 |
+
if(!$is_both_are_same){
|
3491 |
+
$item_price = '<span class="cart_price wdr_product_strikeout"><del>' . $original_item_price . '</del> <ins>' . $new_item_price . '</ins></span>';
|
3492 |
+
$item_price = apply_filters('woo_discount_rules_price_strikeout_discount_price_html', $item_price, $product, $original_item_price, $new_item_price);
|
3493 |
}
|
3494 |
$item_price = apply_filters('woo_discount_rules_price_strikeout_after_discount_price', $item_price, $product);
|
3495 |
}
|
3576 |
$item_price = preg_replace('/<del>.*<\/del>/', '', $item_price);
|
3577 |
}
|
3578 |
$item_price = apply_filters('woo_discount_rules_price_strikeout_before_discount_price', $item_price, $product);
|
3579 |
+
$original_item_price = $item_price;
|
3580 |
+
$new_item_price = (self::$product_has_strike_out[$product_id]['new_strikeout_html']);
|
3581 |
+
$is_both_are_same = FlycartWooDiscountRulesGeneralHelper::is_same_string($original_item_price, $new_item_price);
|
3582 |
+
if(!$is_both_are_same){
|
3583 |
+
$item_price = '<span class="cart_price wdr_product_strikeout"><del>' . $original_item_price . '</del> <ins>' . $new_item_price . '</ins></span>';
|
3584 |
+
$item_price = apply_filters('woo_discount_rules_price_strikeout_discount_price_html', $item_price, $product, $original_item_price, $new_item_price);
|
3585 |
}
|
3586 |
$item_price = apply_filters('woo_discount_rules_price_strikeout_after_discount_price', $item_price, $product);
|
3587 |
}
|
loader.php
CHANGED
@@ -430,8 +430,10 @@ if(!class_exists('FlycartWooDiscountRules')){
|
|
430 |
//$all_excluded_products = array_merge($all_excluded_products, $children_ids);
|
431 |
}
|
432 |
}
|
433 |
-
if(
|
434 |
-
$
|
|
|
|
|
435 |
}
|
436 |
}
|
437 |
$sets[$string] = $all_excluded_products;
|
430 |
//$all_excluded_products = array_merge($all_excluded_products, $children_ids);
|
431 |
}
|
432 |
}
|
433 |
+
if(isset(self::$product_variations[$exclude_id])){
|
434 |
+
if(!empty(self::$product_variations[$exclude_id]) && is_array(self::$product_variations[$exclude_id])){
|
435 |
+
$all_excluded_products = array_merge($all_excluded_products, self::$product_variations[$exclude_id]);
|
436 |
+
}
|
437 |
}
|
438 |
}
|
439 |
$sets[$string] = $all_excluded_products;
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Discount Rules for WooCommerce ===
|
2 |
Contributors: flycart
|
3 |
Donate link: https://flycart.org/
|
4 |
-
Tags: woocommerce, discounts, dynamic pricing, Buy One Get One Free, pricing deals,
|
5 |
Requires at least: 4.4.1
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 1.7.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -312,6 +312,11 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
|
|
312 |
|
313 |
== Changelog ==
|
314 |
|
|
|
|
|
|
|
|
|
|
|
315 |
= 1.7.13 - 02/05/19 =
|
316 |
* Improvement - Performance improvement, while having large number of rules with specific product options.
|
317 |
* Improvement - Consider only visible product variations for displaying strikeout.
|
1 |
=== Discount Rules for WooCommerce ===
|
2 |
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.2
|
7 |
+
Stable tag: 1.7.14
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
312 |
|
313 |
== Changelog ==
|
314 |
|
315 |
+
= 1.7.14 - 13/05/19 =
|
316 |
+
* Improvement - BOGO auto add made compatible with WooCommerce v3.6.2
|
317 |
+
* Improvement - Avoid error while selecting additional taxonomy and if it is not valid.
|
318 |
+
* Improvement - Event apply_filters('woo_discount_rules_price_strikeout_discount_price_html', $item_price, $product, $original_item_price, $new_item_price);
|
319 |
+
|
320 |
= 1.7.13 - 02/05/19 =
|
321 |
* Improvement - Performance improvement, while having large number of rules with specific product options.
|
322 |
* Improvement - Consider only visible product variations for displaying strikeout.
|
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.7.
|
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.7.14
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Domain Path: /i18n/languages/
|