Version Description
- 29/06/18 =
- Fix - Invalid function wc_products_array_filter_visible_grouped in woocommerce 2.6
- Removed - Disable product discount while have subtotal option
Download this release
Release Info
Developer | flycart |
Plugin | Discount Rules for WooCommerce |
Version | 1.6.7 |
Comparing to | |
See all releases |
Code changes from version 1.6.6 to 1.6.7
- assets/js/app.js +0 -9
- includes/pricing-rules.php +75 -30
- readme.txt +5 -1
- woo-discount-rules.php +1 -1
assets/js/app.js
CHANGED
@@ -57,10 +57,6 @@ function trigger_woocommerce_tooltip(){
|
|
57 |
$('#user_list').css('display', 'none');
|
58 |
}
|
59 |
|
60 |
-
if($('#subtotal_option_price_rule').val() != 'none'){
|
61 |
-
$('select.price_discount_type option[value=product_discount]').attr('disabled', 'disabled').html(woo_discount_localization.product_discount_not_work_on_subtotal_based);
|
62 |
-
}
|
63 |
-
|
64 |
// Saving Rule.
|
65 |
$('#savePriceRule').on('click', function (event) {
|
66 |
var validate = validateFields();
|
@@ -213,9 +209,6 @@ function trigger_woocommerce_tooltip(){
|
|
213 |
$('.product_list,.selectpicker').selectpicker('refresh');
|
214 |
$('.wc-product-search').trigger( 'wc-enhanced-select-init' );
|
215 |
$('select.discount_product_discount_type').trigger('change');
|
216 |
-
if($('#subtotal_option_price_rule').val() != 'none'){
|
217 |
-
$('select.price_discount_type option[value=product_discount]').attr('disabled', 'disabled').html(woo_discount_localization.product_discount_not_work_on_subtotal_based);
|
218 |
-
}
|
219 |
// Tooltips
|
220 |
trigger_woocommerce_tooltip();
|
221 |
});
|
@@ -353,10 +346,8 @@ function trigger_woocommerce_tooltip(){
|
|
353 |
var option = $(this).val();
|
354 |
if (option == 'none') {
|
355 |
$('.subtotal_to_apply_price_rule_con').hide();
|
356 |
-
$('select.price_discount_type option[value=product_discount]').removeAttr('disabled').html(woo_discount_localization.product_discount);
|
357 |
} else {
|
358 |
$('.subtotal_to_apply_price_rule_con').show();
|
359 |
-
$('select.price_discount_type option[value=product_discount]').attr('disabled', 'disabled').html(woo_discount_localization.product_discount_not_work_on_subtotal_based);
|
360 |
}
|
361 |
});
|
362 |
$('#subtotal_option_price_rule').trigger('change');
|
57 |
$('#user_list').css('display', 'none');
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
60 |
// Saving Rule.
|
61 |
$('#savePriceRule').on('click', function (event) {
|
62 |
var validate = validateFields();
|
209 |
$('.product_list,.selectpicker').selectpicker('refresh');
|
210 |
$('.wc-product-search').trigger( 'wc-enhanced-select-init' );
|
211 |
$('select.discount_product_discount_type').trigger('change');
|
|
|
|
|
|
|
212 |
// Tooltips
|
213 |
trigger_woocommerce_tooltip();
|
214 |
});
|
346 |
var option = $(this).val();
|
347 |
if (option == 'none') {
|
348 |
$('.subtotal_to_apply_price_rule_con').hide();
|
|
|
349 |
} else {
|
350 |
$('.subtotal_to_apply_price_rule_con').show();
|
|
|
351 |
}
|
352 |
});
|
353 |
$('#subtotal_option_price_rule').trigger('change');
|
includes/pricing-rules.php
CHANGED
@@ -2154,12 +2154,16 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
2154 |
return true;
|
2155 |
}
|
2156 |
if($product->is_type(array('variable', 'subscription_variation', 'variable-subscription'))){
|
2157 |
-
$children = array_filter( array_map( 'wc_get_product', FlycartWoocommerceProduct::get_children($product) ), 'wc_products_array_filter_visible_grouped' );
|
2158 |
$childProducts = array();
|
2159 |
-
|
2160 |
-
|
2161 |
-
|
|
|
|
|
|
|
2162 |
}
|
|
|
|
|
2163 |
}
|
2164 |
if(!empty($childProducts)){
|
2165 |
foreach ($childProducts as $childProductId){
|
@@ -2168,13 +2172,18 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
2168 |
$item['data'] = $product;
|
2169 |
// To display the strike out price in product page for variant (specific attribute rule)
|
2170 |
if($product->get_type() == 'variation'){
|
2171 |
-
|
2172 |
-
|
2173 |
-
$
|
2174 |
-
|
2175 |
-
$
|
|
|
|
|
|
|
|
|
2176 |
}
|
2177 |
-
|
|
|
2178 |
$item['variation_id'] = $product_id;
|
2179 |
}
|
2180 |
}
|
@@ -2822,13 +2831,24 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
2822 |
$display_only_lowest_price = 0;
|
2823 |
$tax_display_mode = get_option( 'woocommerce_tax_display_shop' );
|
2824 |
$child_prices = array();
|
2825 |
-
$children = array_filter( array_map( 'wc_get_product', FlycartWoocommerceProduct::get_children($product) ), 'wc_products_array_filter_visible_grouped' );
|
2826 |
|
2827 |
-
|
2828 |
-
|
2829 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2830 |
}
|
2831 |
}
|
|
|
2832 |
$maxProductId = 0;
|
2833 |
$minProductId = 0;
|
2834 |
if ( ! empty( $child_prices ) ) {
|
@@ -2906,18 +2926,38 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
2906 |
|
2907 |
if(!$on_sale){
|
2908 |
if($product->is_type(array('variable', 'subscription_variation', 'variable-subscription'))){
|
2909 |
-
|
2910 |
-
|
2911 |
-
|
2912 |
-
|
2913 |
-
|
2914 |
-
$
|
2915 |
-
break;
|
2916 |
-
} else {
|
2917 |
-
$product_id = FlycartWoocommerceProduct::get_id($child);
|
2918 |
-
if($this->hasDiscountForProductId($product_id)){
|
2919 |
$on_sale = true;
|
2920 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2921 |
}
|
2922 |
}
|
2923 |
}
|
@@ -2970,13 +3010,18 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
2970 |
|
2971 |
// To display the strike out price in product page for variant (specific attribute rule)
|
2972 |
if($product->get_type() == 'variation'){
|
2973 |
-
|
2974 |
-
|
2975 |
-
$
|
2976 |
-
|
2977 |
-
$
|
|
|
|
|
|
|
|
|
2978 |
}
|
2979 |
-
|
|
|
2980 |
$item['variation_id'] = $product_id;
|
2981 |
}
|
2982 |
}
|
2154 |
return true;
|
2155 |
}
|
2156 |
if($product->is_type(array('variable', 'subscription_variation', 'variable-subscription'))){
|
|
|
2157 |
$childProducts = array();
|
2158 |
+
if(FlycartWoocommerceVersion::wcVersion('3.1.0')){
|
2159 |
+
$children = array_filter( array_map( 'wc_get_product', FlycartWoocommerceProduct::get_children($product) ), 'wc_products_array_filter_visible_grouped' );
|
2160 |
+
foreach ( $children as $child ) {
|
2161 |
+
if ( '' !== FlycartWoocommerceProduct::get_price($child) ) {
|
2162 |
+
$childProducts[] = FlycartWoocommerceProduct::get_id($child);
|
2163 |
+
}
|
2164 |
}
|
2165 |
+
} else {
|
2166 |
+
$childProducts = $product->get_children();
|
2167 |
}
|
2168 |
if(!empty($childProducts)){
|
2169 |
foreach ($childProducts as $childProductId){
|
2172 |
$item['data'] = $product;
|
2173 |
// To display the strike out price in product page for variant (specific attribute rule)
|
2174 |
if($product->get_type() == 'variation'){
|
2175 |
+
if(FlycartWoocommerceVersion::wcVersion('3.1.0')){
|
2176 |
+
$p_data = $product->get_data();
|
2177 |
+
if(!empty($p_data['attributes'])){
|
2178 |
+
$attr = array();
|
2179 |
+
foreach ($p_data['attributes'] as $key => $value){
|
2180 |
+
$attr['attribute_'.$key] = $value;
|
2181 |
+
}
|
2182 |
+
$item['variation'] = $attr;
|
2183 |
+
$item['variation_id'] = $product_id;
|
2184 |
}
|
2185 |
+
} else {
|
2186 |
+
$item['variation'] = $product->get_variation_attributes();
|
2187 |
$item['variation_id'] = $product_id;
|
2188 |
}
|
2189 |
}
|
2831 |
$display_only_lowest_price = 0;
|
2832 |
$tax_display_mode = get_option( 'woocommerce_tax_display_shop' );
|
2833 |
$child_prices = array();
|
|
|
2834 |
|
2835 |
+
if(FlycartWoocommerceVersion::wcVersion('3.1.0')){
|
2836 |
+
$children = array_filter( array_map( 'wc_get_product', FlycartWoocommerceProduct::get_children($product) ), 'wc_products_array_filter_visible_grouped' );
|
2837 |
+
foreach ( $children as $child ) {
|
2838 |
+
if ( '' !== FlycartWoocommerceProduct::get_price($child) ) {
|
2839 |
+
$child_prices[FlycartWoocommerceProduct::get_id($child)] = 'incl' === $tax_display_mode ? FlycartWoocommerceProduct::get_price_including_tax($child) : FlycartWoocommerceProduct::get_price_excluding_tax( $child );
|
2840 |
+
}
|
2841 |
+
}
|
2842 |
+
} else {
|
2843 |
+
$children = $product->get_children();
|
2844 |
+
foreach ( $children as $child_id ) {
|
2845 |
+
$child = FlycartWoocommerceProduct::wc_get_product($child_id);
|
2846 |
+
if ( '' !== FlycartWoocommerceProduct::get_price($child) ) {
|
2847 |
+
$child_prices[FlycartWoocommerceProduct::get_id($child)] = 'incl' === $tax_display_mode ? FlycartWoocommerceProduct::get_price_including_tax($child) : FlycartWoocommerceProduct::get_price_excluding_tax( $child );
|
2848 |
+
}
|
2849 |
}
|
2850 |
}
|
2851 |
+
|
2852 |
$maxProductId = 0;
|
2853 |
$minProductId = 0;
|
2854 |
if ( ! empty( $child_prices ) ) {
|
2926 |
|
2927 |
if(!$on_sale){
|
2928 |
if($product->is_type(array('variable', 'subscription_variation', 'variable-subscription'))){
|
2929 |
+
if(FlycartWoocommerceVersion::wcVersion('3.1.0')){
|
2930 |
+
$children = array_filter( array_map( 'wc_get_product', FlycartWoocommerceProduct::get_children($product) ), 'wc_products_array_filter_visible_grouped' );
|
2931 |
+
foreach ( $children as $child ) {
|
2932 |
+
if ( '' !== FlycartWoocommerceProduct::get_price($child) ) {
|
2933 |
+
$discountPrice = $this->getDiscountPriceForTheProduct($child);
|
2934 |
+
if($discountPrice > 0){
|
|
|
|
|
|
|
|
|
2935 |
$on_sale = true;
|
2936 |
break;
|
2937 |
+
} else {
|
2938 |
+
$product_id = FlycartWoocommerceProduct::get_id($child);
|
2939 |
+
if($this->hasDiscountForProductId($product_id)){
|
2940 |
+
$on_sale = true;
|
2941 |
+
break;
|
2942 |
+
}
|
2943 |
+
}
|
2944 |
+
}
|
2945 |
+
}
|
2946 |
+
} else {
|
2947 |
+
$children = $product->get_children();
|
2948 |
+
foreach ( $children as $child_id ) {
|
2949 |
+
$child = FlycartWoocommerceProduct::wc_get_product($child_id);
|
2950 |
+
if ( '' !== FlycartWoocommerceProduct::get_price($child) ) {
|
2951 |
+
$discountPrice = $this->getDiscountPriceForTheProduct($child);
|
2952 |
+
if($discountPrice > 0){
|
2953 |
+
$on_sale = true;
|
2954 |
+
break;
|
2955 |
+
} else {
|
2956 |
+
$product_id = FlycartWoocommerceProduct::get_id($child);
|
2957 |
+
if($this->hasDiscountForProductId($product_id)){
|
2958 |
+
$on_sale = true;
|
2959 |
+
break;
|
2960 |
+
}
|
2961 |
}
|
2962 |
}
|
2963 |
}
|
3010 |
|
3011 |
// To display the strike out price in product page for variant (specific attribute rule)
|
3012 |
if($product->get_type() == 'variation'){
|
3013 |
+
if(FlycartWoocommerceVersion::wcVersion('3.1.0')){
|
3014 |
+
$p_data = $product->get_data();
|
3015 |
+
if(!empty($p_data['attributes'])){
|
3016 |
+
$attr = array();
|
3017 |
+
foreach ($p_data['attributes'] as $key => $value){
|
3018 |
+
$attr['attribute_'.$key] = $value;
|
3019 |
+
}
|
3020 |
+
$item['variation'] = $attr;
|
3021 |
+
$item['variation_id'] = $product_id;
|
3022 |
}
|
3023 |
+
} else {
|
3024 |
+
$item['variation'] = $product->get_variation_attributes();
|
3025 |
$item['variation_id'] = $product_id;
|
3026 |
}
|
3027 |
}
|
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.6 - 27/06/18 =
|
312 |
* Fix - Warning while ajax request in admin
|
313 |
* Improvement - Localisation improvement
|
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.7
|
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.7 - 29/06/18 =
|
312 |
+
* Fix - Invalid function wc_products_array_filter_visible_grouped in woocommerce 2.6
|
313 |
+
* Removed - Disable product discount while have subtotal option
|
314 |
+
|
315 |
= 1.6.6 - 27/06/18 =
|
316 |
* Fix - Warning while ajax request in admin
|
317 |
* Improvement - Localisation improvement
|
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.7
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Domain Path: /i18n/languages/
|