Plugin Directory

Changeset 2856876


Ignore:
Timestamp:
01/30/2023 06:48:38 AM (3 years ago)
Author:
flycart
Message:

v2.5.4 release with 3 fixes

Location:
woo-discount-rules/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • woo-discount-rules/trunk/readme.txt

    r2848944 r2856876  
    55Requires at least: 4.4.1
    66Tested up to: 6.1
    7 Stable tag: 2.5.3
     7Stable tag: 2.5.4
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    337337== Changelog ==
    338338
     339= 2.5.4 - 30/01/23 =
     340* Fix: Discount data is not stored for analytics when change language using WPML [Core].
     341* Fix: Discount value is incorrect on coupon report for fixed discount type [Core].
     342* Fix: Dynamic strikeout not working for variable product [Core].
     343
    339344= 2.5.3 - 16/01/23 =
    340345* Improvement: Show used coupon report [Core]
  • woo-discount-rules/trunk/v2/App/Controllers/ManageDiscount.php

    r2848944 r2856876  
    772772                        }
    773773                        if (isset($discount_coupons[$rule_id])) {
    774                             $discount_coupons[$rule_id]['discount_value'] += $detail['discounted_price'];
     774                            if ($detail['apply_type'] != 'flat_in_subtotal') {
     775                                $discount_coupons[$rule_id]['discount_value'] += $detail['discounted_price'];
     776                            }
    775777                        } else {
    776778                            $discount_coupons[$rule_id] = [
     
    10331035                        }
    10341036                        if (isset($discount_coupons[$rule_id])) {
    1035                             $discount_coupons[$rule_id]['discount_value'] += $detail['discounted_price'];
     1037                            if ($detail['apply_type'] != 'flat_in_subtotal') {
     1038                                $discount_coupons[$rule_id]['discount_value'] += $detail['discounted_price'];
     1039                            }
    10361040                        } else {
    10371041                            $discount_coupons[$rule_id] = [
     
    16081612                $product_discount_total += isset($details['saved_amount']) ? $details['saved_amount'] : 0;
    16091613                $product_discount_total_with_tax += isset($details['saved_amount_based_on_tax_settings']) ? $details['saved_amount_based_on_tax_settings'] : 0;
    1610                 foreach ($details['applied_rules'] as $rule) {
    1611                     $simple_discount = $bulk_discount = $set_discount = $other_discount = 0;
    1612                     $discount = $rule['discount'];
    1613                     if ($discount['applied_in'] == 'product_level') {
    1614                         switch ($rule['type']) {
    1615                             case 'simple_discount':
    1616                                 $simple_discount = $discount['discount_price'] * $quantity;
    1617                                 break;
    1618                             case 'bulk_discount':
    1619                                 $bulk_discount = $discount['discount_price'] * $quantity;
    1620                                 break;
    1621                             case 'set_discount':
    1622                                 $set_discount = $discount['discount_price'] * $discount['discount_quantity'];
    1623                                 break;
    1624                             default:
    1625                                 $other_discount = $discount['discount_price'] * $quantity;
    1626                         }
    1627                         $discount_price = $simple_discount + $bulk_discount + $set_discount + $other_discount;
    1628                         DBTable::saveOrderItemDiscounts($order_id, $item_id, $product_id, $initial_price, $discounted_price, $discount_price, $quantity, $rule['id'], $simple_discount, $bulk_discount, $set_discount, 0, $other_discount, null);
     1614                if (isset($details['applied_rules']) && !empty($details['applied_rules'])) {
     1615                    foreach ($details['applied_rules'] as $rule) {
     1616                        $simple_discount = $bulk_discount = $set_discount = $other_discount = 0;
     1617                        $discount = $rule['discount'];
     1618                        if ($discount['applied_in'] == 'product_level') {
     1619                            switch ($rule['type']) {
     1620                                case 'simple_discount':
     1621                                    $simple_discount = $discount['discount_price'] * $quantity;
     1622                                    break;
     1623                                case 'bulk_discount':
     1624                                    $bulk_discount = $discount['discount_price'] * $quantity;
     1625                                    break;
     1626                                case 'set_discount':
     1627                                    $set_discount = $discount['discount_price'] * $discount['discount_quantity'];
     1628                                    break;
     1629                                default:
     1630                                    $other_discount = $discount['discount_price'] * $quantity;
     1631                            }
     1632                            $discount_price = $simple_discount + $bulk_discount + $set_discount + $other_discount;
     1633                            DBTable::saveOrderItemDiscounts($order_id, $item_id, $product_id, $initial_price, $discounted_price, $discount_price, $quantity, $rule['id'], $simple_discount, $bulk_discount, $set_discount, 0, $other_discount, null);
     1634                        }
    16291635                    }
    16301636                }
     
    20412047                            $details['discount_type'] = 'free_product';
    20422048                            $details['discount_price'] = $product_price;
    2043                             $cart_item_discounts['total_discount_details'][$cart_item_key][$rule_id] = $details;
     2049                            $cart_item_discounts['total_discount_details'][$cart_item['key']][$rule_id] = $details;
    20442050                        }
    20452051                    }
     
    20512057                            $details['discount_type'] = 'free_product';
    20522058                            $details['discount_price'] = $product_price;
    2053                             $cart_item_discounts['total_discount_details'][$cart_item_key][$rule_id] = $details;
     2059                            $cart_item_discounts['total_discount_details'][$cart_item['key']][$rule_id] = $details;
    20542060                        }
    20552061                    }
     
    20642070            $item_discount_info['discounted_price_based_on_tax_settings'] = round($cart_item_discounts['discounted_price_with_tax'], 4);
    20652071            $item_discount_info['is_free_product'] = isset($cart_item_discounts['is_free_product']) && $cart_item_discounts['is_free_product'];
    2066             if (isset($cart_item_discounts['total_discount_details'][$cart_item_key])) { // for product adjustment
    2067                 foreach ($cart_item_discounts['total_discount_details'][$cart_item_key] as $rule_id => $details) {
     2072            if (isset($cart_item_discounts['total_discount_details'][$cart_item['key']])) { // for product adjustment
     2073                foreach ($cart_item_discounts['total_discount_details'][$cart_item['key']] as $rule_id => $details) {
    20682074                    if (!isset(self::$available_rules[$rule_id])) { continue; }
    20692075                    $rule = self::$available_rules[$rule_id];
  • woo-discount-rules/trunk/v2/App/Models/DBTable.php

    r2848944 r2856876  
    138138                }
    139139            }
    140             $back_end_ajax_actions = array();
     140            $back_end_ajax_actions = array('wdr_admin_statistics');
    141141            $back_end_ajax_actions = apply_filters('advanced_woo_discount_rules_backend_end_ajax_actions', $back_end_ajax_actions);
    142142            if(!empty($back_end_ajax_actions) && is_array($back_end_ajax_actions)){
  • woo-discount-rules/trunk/v2/Assets/Js/site_main.js

    r2848944 r2856876  
    5151                        var $price_place = "";
    5252                        var form = awdr_qty_object.closest("form");
    53                         if (form.find('button[name="add-to-cart"], input[name="add-to-cart"]').length) {
    54                             $product_id = form.find('button[name="add-to-cart"], input[name="add-to-cart"]').first().val();
     53                        if (form.find('button[name="add-to-cart"]').length) {
     54                            $product_id = form.find('button[name="add-to-cart"]').first().val();
    5555                            var target = 'div.product p.price';
    5656                            if(awdr_params.custom_target_simple_product != undefined){
     
    6969                            }
    7070                            $price_place = getWDRDPTarget(form, target, true);
     71                        } else if (form.find('input[name="add-to-cart"]').length) {
     72                            $product_id = form.find('input[name="add-to-cart"]').first().val();
     73                            var target = 'div.product p.price';
     74                            if(awdr_params.custom_target_simple_product != undefined){
     75                                if(awdr_params.custom_target_simple_product != ""){
     76                                    target = awdr_params.custom_target_simple_product;
     77                                }
     78                            }
     79                            $price_place = getWDRDPTarget(form, target, false);
    7180                        }
    7281                        if(!$product_id || $product_id == 0){
  • woo-discount-rules/trunk/v2/Assets/Js/site_main.min.js

    r2848944 r2856876  
    1 !function(t){function i(){t("body").trigger("update_checkout")}"1"==awdr_params.refresh_order_review&&(t(document).on("change",'input[name="payment_method"],input[name="billing_city"],input[name="billing_postcode"]',function(){i()}),t(document).on("blur",'input[name="billing_email"], select#billing_state',function(){i()})),t(document).ready(function(t){function i(){if("show_dynamically"==awdr_params.enable_update_price_with_qty){function i(i,e,a){let o="";return i.find(e).length?(o=i.find(e).first(),!0===a&&(i.find(e+" .price").length||o.html("<div class='price'></div>"),o=i.find(e+" .price").first())):(o=t(e).first(),!0===a&&(t(e+" .price").length||o.html("<div class='price'></div>"),o=t(e+" .price").first())),o}t(document).on("change",'[name="quantity"]',function(){var e=t(this);setTimeout(function(){var a=e.val(),o=0,r="",c=e.closest("form");if(c.find('button[name="add-to-cart"], input[name="add-to-cart"]').length){o=c.find('button[name="add-to-cart"], input[name="add-to-cart"]').first().val();var n="div.product p.price";void 0!=awdr_params.custom_target_simple_product&&""!=awdr_params.custom_target_simple_product&&(n=awdr_params.custom_target_simple_product),r=i(c,n,!1)}else if(c.find('input[name="variation_id"]').length){o=c.find('input[name="variation_id"]').val();var n="div.product .woocommerce-variation-price";void 0!=awdr_params.custom_target_variable_product&&""!=awdr_params.custom_target_variable_product&&(n=awdr_params.custom_target_variable_product),r=i(c,n,!0)}if(!o||0==o){if(void 0!=awdr_params.custom_simple_product_id_selector&&""!=awdr_params.custom_simple_product_id_selector){o=t(awdr_params.custom_simple_product_id_selector).val();let l="div.product p.price";void 0!=awdr_params.custom_target_simple_product&&""!=awdr_params.custom_target_simple_product&&(l=awdr_params.custom_target_simple_product),r=i(c,l,!1)}if(void 0!=awdr_params.custom_variable_product_id_selector&&""!=awdr_params.custom_variable_product_id_selector){o=t(awdr_params.custom_variable_product_id_selector).val();let d="div.product .woocommerce-variation-price";void 0!=awdr_params.custom_target_variable_product&&""!=awdr_params.custom_target_variable_product&&(d=awdr_params.custom_target_variable_product),r=i(c,d,!0)}}if(o&&r&&0!=o){var u={action:"wdr_ajax",method:"get_price_html",product_id:o,qty:a,awdr_nonce:awdr_params.nonce};t.ajax({url:awdr_params.ajaxurl,data:u,type:"POST",success:function(t){t.price_html?r.html(t.price_html):void 0!=t.original_price_html&&r.html(t.original_price_html)},error:function(t){r.html("")}})}},0)})}}if(awdr_params.js_init_trigger&&t(document).on(awdr_params.js_init_trigger,function(){i()}),i(),"1"==awdr_params.awdr_dynamic_bulk_table_status&&"on"==awdr_params.awdr_dynamic_bulk_table_off){function e(i){setTimeout(function(){if(""!=i&&"0"!=i){var e={action:"wdr_ajax",method:"get_variable_product_bulk_table",product_id:i,awdr_nonce:awdr_params.nonce};let a="div.awdr-bulk-customizable-table";void 0!=awdr_params.awdr_opacity_to_bulk_table&&""!=awdr_params.awdr_opacity_to_bulk_table&&(a=awdr_params.awdr_opacity_to_bulk_table),t.ajax({url:awdr_params.ajaxurl,data:e,type:"POST",beforeSend:function(){t(a).css("opacity","0.5")},complete:function(){t(a).css("opacity","1")},success:function(i){i.bulk_table&&t(".awdr-bulk-customizable-table").html(i.bulk_table)},error:function(i){t(".awdr-bulk-customizable-table").html("")}})}},100)}t(".single_variation_wrap").on("hide_variation",function(i){e(t(this).closest("form").find('input[name="product_id"]').val())}),t(".single_variation_wrap").on("show_variation",function(t,i,a){let o=i.variation_id;(void 0==i.is_bundled||!0!=i.is_bundled)&&e(o)})}})}(jQuery);
     1!function(t){function i(){t("body").trigger("update_checkout")}"1"==awdr_params.refresh_order_review&&(t(document).on("change",'input[name="payment_method"],input[name="billing_city"],input[name="billing_postcode"]',function(){i()}),t(document).on("blur",'input[name="billing_email"], select#billing_state',function(){i()})),t(document).ready(function(t){function i(){if("show_dynamically"==awdr_params.enable_update_price_with_qty){function i(i,e,a){let o="";return i.find(e).length?(o=i.find(e).first(),!0===a&&(i.find(e+" .price").length||o.html("<div class='price'></div>"),o=i.find(e+" .price").first())):(o=t(e).first(),!0===a&&(t(e+" .price").length||o.html("<div class='price'></div>"),o=t(e+" .price").first())),o}t(document).on("change",'[name="quantity"]',function(){var e=t(this);setTimeout(function(){var a=e.val(),o=0,r="",c=e.closest("form");if(c.find('button[name="add-to-cart"]').length){o=c.find('button[name="add-to-cart"]').first().val();var n="div.product p.price";void 0!=awdr_params.custom_target_simple_product&&""!=awdr_params.custom_target_simple_product&&(n=awdr_params.custom_target_simple_product),r=i(c,n,!1)}else if(c.find('input[name="variation_id"]').length){o=c.find('input[name="variation_id"]').val();var n="div.product .woocommerce-variation-price";void 0!=awdr_params.custom_target_variable_product&&""!=awdr_params.custom_target_variable_product&&(n=awdr_params.custom_target_variable_product),r=i(c,n,!0)}else if(c.find('input[name="add-to-cart"]').length){o=c.find('input[name="add-to-cart"]').first().val();var n="div.product p.price";void 0!=awdr_params.custom_target_simple_product&&""!=awdr_params.custom_target_simple_product&&(n=awdr_params.custom_target_simple_product),r=i(c,n,!1)}if(!o||0==o){if(void 0!=awdr_params.custom_simple_product_id_selector&&""!=awdr_params.custom_simple_product_id_selector){o=t(awdr_params.custom_simple_product_id_selector).val();let l="div.product p.price";void 0!=awdr_params.custom_target_simple_product&&""!=awdr_params.custom_target_simple_product&&(l=awdr_params.custom_target_simple_product),r=i(c,l,!1)}if(void 0!=awdr_params.custom_variable_product_id_selector&&""!=awdr_params.custom_variable_product_id_selector){o=t(awdr_params.custom_variable_product_id_selector).val();let d="div.product .woocommerce-variation-price";void 0!=awdr_params.custom_target_variable_product&&""!=awdr_params.custom_target_variable_product&&(d=awdr_params.custom_target_variable_product),r=i(c,d,!0)}}if(o&&r&&0!=o){var u={action:"wdr_ajax",method:"get_price_html",product_id:o,qty:a,awdr_nonce:awdr_params.nonce};t.ajax({url:awdr_params.ajaxurl,data:u,type:"POST",success:function(t){t.price_html?r.html(t.price_html):void 0!=t.original_price_html&&r.html(t.original_price_html)},error:function(t){r.html("")}})}},0)})}}if(awdr_params.js_init_trigger&&t(document).on(awdr_params.js_init_trigger,function(){i()}),i(),"1"==awdr_params.awdr_dynamic_bulk_table_status&&"on"==awdr_params.awdr_dynamic_bulk_table_off){function e(i){setTimeout(function(){if(""!=i&&"0"!=i){var e={action:"wdr_ajax",method:"get_variable_product_bulk_table",product_id:i,awdr_nonce:awdr_params.nonce};let a="div.awdr-bulk-customizable-table";void 0!=awdr_params.awdr_opacity_to_bulk_table&&""!=awdr_params.awdr_opacity_to_bulk_table&&(a=awdr_params.awdr_opacity_to_bulk_table),t.ajax({url:awdr_params.ajaxurl,data:e,type:"POST",beforeSend:function(){t(a).css("opacity","0.5")},complete:function(){t(a).css("opacity","1")},success:function(i){i.bulk_table&&t(".awdr-bulk-customizable-table").html(i.bulk_table)},error:function(i){t(".awdr-bulk-customizable-table").html("")}})}},100)}t(".single_variation_wrap").on("hide_variation",function(i){e(t(this).closest("form").find('input[name="product_id"]').val())}),t(".single_variation_wrap").on("show_variation",function(t,i,a){let o=i.variation_id;(void 0==i.is_bundled||!0!=i.is_bundled)&&e(o)})}})}(jQuery);
  • woo-discount-rules/trunk/woo-discount-rules.php

    r2848944 r2856876  
    66 * Author: Flycart
    77 * Author URI: https://www.flycart.org
    8  * Version: 2.5.3
     8 * Version: 2.5.4
    99 * Slug: woo-discount-rules
    1010 * Text Domain: woo-discount-rules
     
    2222 */
    2323if (!defined('WDR_VERSION')) {
    24     define('WDR_VERSION', '2.5.3');
     24    define('WDR_VERSION', '2.5.4');
    2525}
    2626
Note: See TracChangeset for help on using the changeset viewer.