Version Description
- 29/06/20 =
- Fix - Dynamic strikeout improvement(strikeout doesn't replace for non matched qty).
- Fix - Custom taxonomy condition for variable products.
- Fix - Report for cart discount not showing.
- Fix - Product doesn't loads based on keyword when WooCommerce Product Search plugin is active.
- Fix - Coupon doesn't removes for BOGO rule (when disable coupon while rule applied option is enabled).
- Fix - Error on currency switcher by villatheme.
- Fix - Set discount value is wrong when rule is marked as exclusive.
- Fix - Warning on apply BOGO rule.
- Improvement - Additional events to get discount table manually.
- Improvement - Composite product compatible improvement.
- Improvement - CSS override for display switch option in v1.
Download this release
Release Info
Developer | flycart |
Plugin | Discount Rules for WooCommerce |
Version | 1.9.12 |
Comparing to | |
See all releases |
Code changes from version 1.9.11 to 1.9.12
- readme.txt +14 -1
- v1/assets/css/style.css +4 -0
- v2/App/Compatibility/CompositeProductsBySomewhereWarm.php +7 -0
- v2/App/Compatibility/CurrencySwitcherByVillatheme.php +4 -4
- v2/App/Conditions/CartSubTotal.php +1 -1
- v2/App/Controllers/Admin/WDRAjax.php +4 -1
- v2/App/Controllers/DiscountCalculator.php +7 -2
- v2/App/Controllers/ManageDiscount.php +75 -13
- v2/App/Helpers/Filter.php +2 -0
- v2/App/Helpers/Rule.php +13 -11
- v2/App/Helpers/Woocommerce.php +7 -2
- v2/App/Models/DBTable.php +1 -5
- v2/App/Router.php +9 -1
- v2/Assets/Js/site_main.js +4 -0
- woo-discount-rules.php +1 -1
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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.4
|
7 |
-
Stable tag: 1.9.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -336,6 +336,19 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
|
|
336 |
|
337 |
== Changelog ==
|
338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
= 1.9.11 - 17/06/20 =
|
340 |
* Fix - Custom taxonomy doesn't works with conditions.
|
341 |
* Fix - Email based rule doesn't works with User role on OR condition.
|
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.4
|
7 |
+
Stable tag: 1.9.12
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
336 |
|
337 |
== Changelog ==
|
338 |
|
339 |
+
= 1.9.12 - 29/06/20 =
|
340 |
+
* Fix - Dynamic strikeout improvement(strikeout doesn't replace for non matched qty).
|
341 |
+
* Fix - Custom taxonomy condition for variable products.
|
342 |
+
* Fix - Report for cart discount not showing.
|
343 |
+
* Fix - Product doesn't loads based on keyword when WooCommerce Product Search plugin is active.
|
344 |
+
* Fix - Coupon doesn't removes for BOGO rule (when disable coupon while rule applied option is enabled).
|
345 |
+
* Fix - Error on currency switcher by villatheme.
|
346 |
+
* Fix - Set discount value is wrong when rule is marked as exclusive.
|
347 |
+
* Fix - Warning on apply BOGO rule.
|
348 |
+
* Improvement - Additional events to get discount table manually.
|
349 |
+
* Improvement - Composite product compatible improvement.
|
350 |
+
* Improvement - CSS override for display switch option in v1.
|
351 |
+
|
352 |
= 1.9.11 - 17/06/20 =
|
353 |
* Fix - Custom taxonomy doesn't works with conditions.
|
354 |
* Fix - Email based rule doesn't works with User role on OR condition.
|
v1/assets/css/style.css
CHANGED
@@ -268,6 +268,10 @@ select.discount_product_option,
|
|
268 |
.wdr_price_rule_listing_table_con{
|
269 |
padding: 0 15px;
|
270 |
}
|
|
|
|
|
|
|
|
|
271 |
|
272 |
/*Model Popup*/
|
273 |
.wdr_woo_discount_header_con .modal,
|
268 |
.wdr_price_rule_listing_table_con{
|
269 |
padding: 0 15px;
|
270 |
}
|
271 |
+
.wdr_woo_discount_header_con.woocommerce-message {
|
272 |
+
display: block !important;
|
273 |
+
opacity: 1 !important;
|
274 |
+
}
|
275 |
|
276 |
/*Model Popup*/
|
277 |
.wdr_woo_discount_header_con .modal,
|
v2/App/Compatibility/CompositeProductsBySomewhereWarm.php
CHANGED
@@ -27,6 +27,13 @@ class CompositeProductsBySomewhereWarm extends Base
|
|
27 |
}
|
28 |
return $take_count;
|
29 |
}, 10, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
}
|
32 |
|
27 |
}
|
28 |
return $take_count;
|
29 |
}, 10, 2);
|
30 |
+
|
31 |
+
add_filter('advanced_woo_discount_rules_process_cart_item_for_cheapest_rule', function($take_count, $cart_item){
|
32 |
+
if(isset($cart_item['composite_item']) && !empty($cart_item['composite_item'])){
|
33 |
+
$take_count = false;
|
34 |
+
}
|
35 |
+
return $take_count;
|
36 |
+
}, 10, 2);
|
37 |
}
|
38 |
}
|
39 |
|
v2/App/Compatibility/CurrencySwitcherByVillatheme.php
CHANGED
@@ -18,11 +18,11 @@ class CurrencySwitcherByVillatheme extends Base
|
|
18 |
$process_conversion = true;
|
19 |
if($process_conversion){
|
20 |
$class_exists = false;
|
21 |
-
if(class_exists('WOOMULTI_CURRENCY_F_Data')){
|
22 |
-
$setting = new WOOMULTI_CURRENCY_F_Data();
|
23 |
$class_exists = true;
|
24 |
-
} elseif(class_exists('WOOMULTI_CURRENCY_Data')){
|
25 |
-
$setting = new WOOMULTI_CURRENCY_Data();
|
26 |
$class_exists = true;
|
27 |
}
|
28 |
if($class_exists === true){
|
18 |
$process_conversion = true;
|
19 |
if($process_conversion){
|
20 |
$class_exists = false;
|
21 |
+
if(class_exists('\WOOMULTI_CURRENCY_F_Data')){
|
22 |
+
$setting = new \WOOMULTI_CURRENCY_F_Data();
|
23 |
$class_exists = true;
|
24 |
+
} elseif(class_exists('\WOOMULTI_CURRENCY_Data')){
|
25 |
+
$setting = new \WOOMULTI_CURRENCY_Data();
|
26 |
$class_exists = true;
|
27 |
}
|
28 |
if($class_exists === true){
|
v2/App/Conditions/CartSubTotal.php
CHANGED
@@ -45,7 +45,7 @@ class CartSubTotal extends Base
|
|
45 |
}
|
46 |
if (isset($options->operator) && $options->value) {
|
47 |
$operator = sanitize_text_field($options->operator);
|
48 |
-
$value = $options->value;
|
49 |
$status = $this->doComparisionOperation($operator, $cart_sub_total, $value);
|
50 |
if(!$status){
|
51 |
$this->processPromotion($operator, $options, $cart_sub_total, $value);
|
45 |
}
|
46 |
if (isset($options->operator) && $options->value) {
|
47 |
$operator = sanitize_text_field($options->operator);
|
48 |
+
$value = self::$woocommerce_helper->getConvertedFixedPrice($options->value, 'subtotal_condition');
|
49 |
$status = $this->doComparisionOperation($operator, $cart_sub_total, $value);
|
50 |
if(!$status){
|
51 |
$this->processPromotion($operator, $options, $cart_sub_total, $value);
|
v2/App/Controllers/Admin/WDRAjax.php
CHANGED
@@ -91,6 +91,8 @@ class WDRAjax extends Base
|
|
91 |
public function wdr_ajax_products()
|
92 |
{
|
93 |
$query = $this->input->post('query', '');
|
|
|
|
|
94 |
$data_store = WC_Data_Store::load('product');
|
95 |
$ids = $data_store->search_products($query, '', true, false, $this->search_result_limit);
|
96 |
return array_values(array_map( function ( $post_id ) {
|
@@ -539,6 +541,7 @@ class WDRAjax extends Base
|
|
539 |
$product = self::$woocommerce_helper->getProduct($product);
|
540 |
$price_html = "<div class='price'></div>";
|
541 |
$price_html = $manage_discount->getPriceHtml($price_html, $product, $product_qty, true);
|
542 |
-
|
|
|
543 |
}
|
544 |
}
|
91 |
public function wdr_ajax_products()
|
92 |
{
|
93 |
$query = $this->input->post('query', '');
|
94 |
+
//to disable other search classes
|
95 |
+
remove_all_filters('woocommerce_data_stores');
|
96 |
$data_store = WC_Data_Store::load('product');
|
97 |
$ids = $data_store->search_products($query, '', true, false, $this->search_result_limit);
|
98 |
return array_values(array_map( function ( $post_id ) {
|
541 |
$product = self::$woocommerce_helper->getProduct($product);
|
542 |
$price_html = "<div class='price'></div>";
|
543 |
$price_html = $manage_discount->getPriceHtml($price_html, $product, $product_qty, true);
|
544 |
+
$original_html = self::$woocommerce_helper->getPriceHtml($product);
|
545 |
+
wp_send_json(array('price_html'=>$price_html, 'original_price_html' => $original_html));
|
546 |
}
|
547 |
}
|
v2/App/Controllers/DiscountCalculator.php
CHANGED
@@ -284,6 +284,7 @@ class DiscountCalculator extends Base
|
|
284 |
switch ($type) {
|
285 |
case 'fixed_price':
|
286 |
if (!empty($value)) {
|
|
|
287 |
if($value < 0){
|
288 |
$value = 0;
|
289 |
}
|
@@ -294,6 +295,7 @@ class DiscountCalculator extends Base
|
|
294 |
break;
|
295 |
case 'fixed_set_price':
|
296 |
if (!empty($value) && !empty($min)) {
|
|
|
297 |
$discounted_price = $value / $min;
|
298 |
if($discounted_price < 0){
|
299 |
$discounted_price = 0;
|
@@ -319,6 +321,7 @@ class DiscountCalculator extends Base
|
|
319 |
default:
|
320 |
case 'flat':
|
321 |
if (!empty($value)) {
|
|
|
322 |
$discount = $product_price - $value;
|
323 |
if($discount < 0){
|
324 |
$discount = 0;
|
@@ -431,7 +434,8 @@ class DiscountCalculator extends Base
|
|
431 |
$rule_passed = true;
|
432 |
}
|
433 |
if($rule_passed){
|
434 |
-
|
|
|
435 |
if ($discounted_price = $rule->calculateDiscount($product_price, $quantity, $product, $ajax_price, $cart_item, $price_display_condition, $is_cart, $manual_request)) {
|
436 |
$has_exclusive_rule = true;
|
437 |
} else {
|
@@ -797,13 +801,14 @@ class DiscountCalculator extends Base
|
|
797 |
foreach ($apply_as_cart_fee_details as $rule_id => $product_id){
|
798 |
$discount_value = 0;
|
799 |
foreach ($product_id as $detail) {
|
800 |
-
$discount_value += $detail['discounted_price'];
|
801 |
$label = (isset($detail['discount_label']) && !empty($detail['discount_label'])) ? $detail['discount_label'] : $detail['rule_name'];
|
802 |
$value = (isset($detail['discount_value']) && !empty($detail['discount_value'])) ? $detail['discount_value'] : 0;
|
803 |
}
|
804 |
self::$cart_adjustments[$rule_id]['cart_discount'] = isset($value) ? $value : '';
|
805 |
self::$cart_adjustments[$rule_id]['cart_shipping'] = 'no';
|
806 |
self::$cart_adjustments[$rule_id]['cart_discount_label'] = isset($label) ? $label : '';
|
|
|
807 |
}
|
808 |
array_push($cart_discount_arr, $apply_as_cart_fee_details);
|
809 |
if ($discount_calculation_call) {
|
284 |
switch ($type) {
|
285 |
case 'fixed_price':
|
286 |
if (!empty($value)) {
|
287 |
+
$value = Woocommerce::getConvertedFixedPrice($value, 'fixed_price');
|
288 |
if($value < 0){
|
289 |
$value = 0;
|
290 |
}
|
295 |
break;
|
296 |
case 'fixed_set_price':
|
297 |
if (!empty($value) && !empty($min)) {
|
298 |
+
$value = Woocommerce::getConvertedFixedPrice($value, 'fixed_set_price');
|
299 |
$discounted_price = $value / $min;
|
300 |
if($discounted_price < 0){
|
301 |
$discounted_price = 0;
|
321 |
default:
|
322 |
case 'flat':
|
323 |
if (!empty($value)) {
|
324 |
+
$value = Woocommerce::getConvertedFixedPrice($value, 'flat');
|
325 |
$discount = $product_price - $value;
|
326 |
if($discount < 0){
|
327 |
$discount = 0;
|
434 |
$rule_passed = true;
|
435 |
}
|
436 |
if($rule_passed){
|
437 |
+
|
438 |
+
if(!in_array($rule->rule->discount_type, array('wdr_buy_x_get_x_discount', 'wdr_set_discount'))){
|
439 |
if ($discounted_price = $rule->calculateDiscount($product_price, $quantity, $product, $ajax_price, $cart_item, $price_display_condition, $is_cart, $manual_request)) {
|
440 |
$has_exclusive_rule = true;
|
441 |
} else {
|
801 |
foreach ($apply_as_cart_fee_details as $rule_id => $product_id){
|
802 |
$discount_value = 0;
|
803 |
foreach ($product_id as $detail) {
|
804 |
+
$discount_value += isset($detail['discounted_price']) ? $detail['discounted_price'] : 0 ;
|
805 |
$label = (isset($detail['discount_label']) && !empty($detail['discount_label'])) ? $detail['discount_label'] : $detail['rule_name'];
|
806 |
$value = (isset($detail['discount_value']) && !empty($detail['discount_value'])) ? $detail['discount_value'] : 0;
|
807 |
}
|
808 |
self::$cart_adjustments[$rule_id]['cart_discount'] = isset($value) ? $value : '';
|
809 |
self::$cart_adjustments[$rule_id]['cart_shipping'] = 'no';
|
810 |
self::$cart_adjustments[$rule_id]['cart_discount_label'] = isset($label) ? $label : '';
|
811 |
+
self::$cart_adjustments[$rule_id]['cart_discount_price'] = $discount_value;
|
812 |
}
|
813 |
array_push($cart_discount_arr, $apply_as_cart_fee_details);
|
814 |
if ($discount_calculation_call) {
|
v2/App/Controllers/ManageDiscount.php
CHANGED
@@ -204,7 +204,8 @@ class ManageDiscount extends Base
|
|
204 |
}
|
205 |
if ($ajax_price) {
|
206 |
$price_html = $initial_price_html;
|
207 |
-
|
|
|
208 |
return false;
|
209 |
}
|
210 |
}
|
@@ -290,6 +291,15 @@ class ManageDiscount extends Base
|
|
290 |
* */
|
291 |
function getPriceHtmlSalePriceAdjustment($price_html, $product, $quantity = 1)
|
292 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
$modify_price = apply_filters('advanced_woo_discount_rules_modify_sale_price_adjustment_html', true, $price_html, $product, $quantity);
|
294 |
if (!$modify_price) {
|
295 |
return $price_html;
|
@@ -298,7 +308,7 @@ class ManageDiscount extends Base
|
|
298 |
if (is_array($excluded_product_type) && !empty($excluded_product_type)) {
|
299 |
if (!Woocommerce::productTypeIs($product, $excluded_product_type)) {
|
300 |
$sale_price = Woocommerce::getProductSalePrice($product);
|
301 |
-
$regular_price = Woocommerce::
|
302 |
if ($sale_price <= 0) {
|
303 |
if($regular_price > 0){
|
304 |
$regular_price = get_option('woocommerce_tax_display_shop') == 'excl' ? Woocommerce::getExcludingTaxPrice($product, 1, $regular_price) : Woocommerce::getIncludingTaxPrice($product, 1, $regular_price);
|
@@ -882,7 +892,10 @@ class ManageDiscount extends Base
|
|
882 |
$price = self::$calculated_cart_item_discount[$key]['discounted_price'];
|
883 |
}
|
884 |
$price = apply_filters('advanced_woo_discount_rules_discounted_price_of_cart_item', $price, $cart_item, $cart_object, self::$calculated_cart_item_discount[$key]);
|
885 |
-
|
|
|
|
|
|
|
886 |
|
887 |
}
|
888 |
}
|
@@ -950,11 +963,10 @@ class ManageDiscount extends Base
|
|
950 |
}
|
951 |
|
952 |
/**
|
953 |
-
*
|
954 |
*/
|
955 |
-
function
|
956 |
{
|
957 |
-
global $product;
|
958 |
if (!empty($product)) {
|
959 |
$bulk_discounts_ranges = self::$calculator->getDefaultLayoutMessagesByRules($product);
|
960 |
$override_path = get_theme_file_path('advanced_woo_discount_rules/discount_table.php');
|
@@ -967,11 +979,21 @@ class ManageDiscount extends Base
|
|
967 |
}
|
968 |
|
969 |
/**
|
970 |
-
* Show the
|
971 |
*/
|
972 |
-
function
|
973 |
{
|
974 |
global $product;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
975 |
if (!empty($product)) {
|
976 |
$bulk_discounts_ranges = self::$calculator->getAdvancedLayoutMessagesByRules($product);
|
977 |
$bulk_table_template_path = WDR_PLUGIN_PATH . 'App/Views/Templates/discount_table.php';
|
@@ -979,6 +1001,17 @@ class ManageDiscount extends Base
|
|
979 |
}
|
980 |
}
|
981 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
982 |
/**
|
983 |
* save discounts of order for future
|
984 |
*
|
@@ -991,7 +1024,7 @@ class ManageDiscount extends Base
|
|
991 |
$model = new DBTable();
|
992 |
$applied_rules = array();
|
993 |
if (!empty(self::$calculated_cart_item_discount)) {
|
994 |
-
foreach (self::$calculated_cart_item_discount as $discount) {
|
995 |
$product_id = isset($discount['product_id']) ? $discount['product_id'] : 0;
|
996 |
if (empty($product_id)) {
|
997 |
return false;
|
@@ -1002,12 +1035,13 @@ class ManageDiscount extends Base
|
|
1002 |
$total_discount_details = isset($discount['total_discount_details']) ? $discount['total_discount_details'] : array();
|
1003 |
$cart_discount_details = isset($discount['cart_discount_details']) ? $discount['cart_discount_details'] : array();
|
1004 |
if (!empty($total_discount_details)) {
|
1005 |
-
$save_order_item_discounts_array = isset($total_discount_details[$
|
1006 |
} else {
|
1007 |
$save_order_item_discounts_array = $cart_discount_details;
|
1008 |
}
|
1009 |
if (!empty($save_order_item_discounts_array)) {
|
1010 |
foreach ($save_order_item_discounts_array as $key => $value) {
|
|
|
1011 |
$rule_id = $key;
|
1012 |
$applied_rules[] = $rule_id;
|
1013 |
$cart_discount = isset($cart_discount_details[$rule_id]['cart_discount']) ? $cart_discount_details[$rule_id]['cart_discount'] : '0';
|
@@ -1026,9 +1060,10 @@ class ManageDiscount extends Base
|
|
1026 |
foreach ($cart_discount_details as $key => $value) {
|
1027 |
if (!in_array($key, $applied_rules)) {
|
1028 |
$rule_id = $key;
|
1029 |
-
|
1030 |
$cart_shipping = (isset($cart_discount_details[$rule_id]['cart_shipping']) && !empty($cart_discount_details[$rule_id]['cart_shipping'])) ? $cart_discount_details[$rule_id]['cart_shipping'] : 'no';
|
1031 |
$cart_discount_label = isset($cart_discount_details[$rule_id]['cart_discount_label']) ? $cart_discount_details[$rule_id]['cart_discount_label'] : '';
|
|
|
1032 |
$model::saveOrderItemDiscounts($order_id, 0, 0, $discount_price, 0, 0, $rule_id, $simple_discount, $bulk_discount, $set_discount, $cart_discount, $cart_discount_label, $cart_shipping);
|
1033 |
}
|
1034 |
}
|
@@ -1250,6 +1285,7 @@ class ManageDiscount extends Base
|
|
1250 |
*/
|
1251 |
function onCreateWoocommerceOrderLineItem($item, $cart_item_key, $values, $order)
|
1252 |
{
|
|
|
1253 |
if (isset(self::$calculated_cart_item_discount[$cart_item_key])) {
|
1254 |
self::$woocommerce_helper->setOrderItemMeta($item, '_advanced_woo_discount_item_total_discount', self::$calculated_cart_item_discount[$cart_item_key]);
|
1255 |
}
|
@@ -1431,7 +1467,7 @@ class ManageDiscount extends Base
|
|
1431 |
* @param string $get_only
|
1432 |
* @return bool
|
1433 |
*/
|
1434 |
-
static function calculateProductDiscountPrice($price, $product, $quantity = 1, $custom_price = 0, $get_only = 'discounted_price', $manual_request = false)
|
1435 |
{
|
1436 |
if (!is_a($product, 'WC_Product')) {
|
1437 |
if (is_integer($product)) {
|
@@ -1443,7 +1479,8 @@ class ManageDiscount extends Base
|
|
1443 |
if (!$product) {
|
1444 |
return false;
|
1445 |
}
|
1446 |
-
$discounts = self::$calculator->mayApplyPriceDiscount($product, $quantity, $custom_price, false, array(),
|
|
|
1447 |
if ($discounts) {
|
1448 |
switch ($get_only) {
|
1449 |
case 'all':
|
@@ -1461,6 +1498,8 @@ class ManageDiscount extends Base
|
|
1461 |
$price = isset($discounts['discounted_price']) ? $discounts['discounted_price'] : $price;
|
1462 |
break;
|
1463 |
}
|
|
|
|
|
1464 |
}
|
1465 |
return $price;
|
1466 |
}
|
@@ -1574,9 +1613,24 @@ class ManageDiscount extends Base
|
|
1574 |
if(empty($callback_details['function'])){
|
1575 |
continue;
|
1576 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1577 |
if (count($callback_details['function']) != 2) {
|
1578 |
continue;
|
1579 |
}
|
|
|
|
|
|
|
|
|
|
|
1580 |
if ($class_name == get_class($callback_details['function'][0]) AND $func_name == $callback_details['function'][1]) {
|
1581 |
$result = true;
|
1582 |
break;// done!
|
@@ -1585,6 +1639,14 @@ class ManageDiscount extends Base
|
|
1585 |
return $result;
|
1586 |
}
|
1587 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1588 |
/**
|
1589 |
* Display you saved text in order pages
|
1590 |
* @param $total
|
204 |
}
|
205 |
if ($ajax_price) {
|
206 |
$price_html = $initial_price_html;
|
207 |
+
$quantity = $this->input->post('qty', '');
|
208 |
+
if(!$price_html || empty($quantity)){
|
209 |
return false;
|
210 |
}
|
211 |
}
|
291 |
* */
|
292 |
function getPriceHtmlSalePriceAdjustment($price_html, $product, $quantity = 1)
|
293 |
{
|
294 |
+
if (empty(self::$available_rules)) {
|
295 |
+
return $price_html;
|
296 |
+
}
|
297 |
+
$show_on_sale_badge = self::$config->getConfig('show_on_sale_badge', 'disabled');
|
298 |
+
|
299 |
+
if($show_on_sale_badge != 'at_least_has_any_rules' ){
|
300 |
+
return $price_html;
|
301 |
+
}
|
302 |
+
|
303 |
$modify_price = apply_filters('advanced_woo_discount_rules_modify_sale_price_adjustment_html', true, $price_html, $product, $quantity);
|
304 |
if (!$modify_price) {
|
305 |
return $price_html;
|
308 |
if (is_array($excluded_product_type) && !empty($excluded_product_type)) {
|
309 |
if (!Woocommerce::productTypeIs($product, $excluded_product_type)) {
|
310 |
$sale_price = Woocommerce::getProductSalePrice($product);
|
311 |
+
$regular_price = Woocommerce::getProductPrice($product);
|
312 |
if ($sale_price <= 0) {
|
313 |
if($regular_price > 0){
|
314 |
$regular_price = get_option('woocommerce_tax_display_shop') == 'excl' ? Woocommerce::getExcludingTaxPrice($product, 1, $regular_price) : Woocommerce::getIncludingTaxPrice($product, 1, $regular_price);
|
892 |
$price = self::$calculated_cart_item_discount[$key]['discounted_price'];
|
893 |
}
|
894 |
$price = apply_filters('advanced_woo_discount_rules_discounted_price_of_cart_item', $price, $cart_item, $cart_object, self::$calculated_cart_item_discount[$key]);
|
895 |
+
$do_apply_price_rules = apply_filters('advanced_woo_discount_rules_do_apply_price_discount', true, $price, $cart_item, $cart_object, self::$calculated_cart_item_discount[$key]);
|
896 |
+
if($do_apply_price_rules){
|
897 |
+
self::$woocommerce_helper->setCartProductPrice($product_obj, $price);
|
898 |
+
}
|
899 |
|
900 |
}
|
901 |
}
|
963 |
}
|
964 |
|
965 |
/**
|
966 |
+
* laod the bulk table discount message manually
|
967 |
*/
|
968 |
+
function showBulkTableInPositionManually($product)
|
969 |
{
|
|
|
970 |
if (!empty($product)) {
|
971 |
$bulk_discounts_ranges = self::$calculator->getDefaultLayoutMessagesByRules($product);
|
972 |
$override_path = get_theme_file_path('advanced_woo_discount_rules/discount_table.php');
|
979 |
}
|
980 |
|
981 |
/**
|
982 |
+
* Show the bulk table discount message
|
983 |
*/
|
984 |
+
function showBulkTableInPosition()
|
985 |
{
|
986 |
global $product;
|
987 |
+
if (!empty($product)) {
|
988 |
+
$this->showBulkTableInPositionManually($product);
|
989 |
+
}
|
990 |
+
}
|
991 |
+
|
992 |
+
/**
|
993 |
+
* load the advanced table discount message manually
|
994 |
+
*/
|
995 |
+
function showAdvancedTableInPositionManually($product)
|
996 |
+
{
|
997 |
if (!empty($product)) {
|
998 |
$bulk_discounts_ranges = self::$calculator->getAdvancedLayoutMessagesByRules($product);
|
999 |
$bulk_table_template_path = WDR_PLUGIN_PATH . 'App/Views/Templates/discount_table.php';
|
1001 |
}
|
1002 |
}
|
1003 |
|
1004 |
+
/**
|
1005 |
+
* Show the advanced table discount message
|
1006 |
+
*/
|
1007 |
+
function showAdvancedTableInPosition()
|
1008 |
+
{
|
1009 |
+
global $product;
|
1010 |
+
if (!empty($product)) {
|
1011 |
+
$this->showAdvancedTableInPositionManually($product);
|
1012 |
+
}
|
1013 |
+
}
|
1014 |
+
|
1015 |
/**
|
1016 |
* save discounts of order for future
|
1017 |
*
|
1024 |
$model = new DBTable();
|
1025 |
$applied_rules = array();
|
1026 |
if (!empty(self::$calculated_cart_item_discount)) {
|
1027 |
+
foreach (self::$calculated_cart_item_discount as $cart_key => $discount) {
|
1028 |
$product_id = isset($discount['product_id']) ? $discount['product_id'] : 0;
|
1029 |
if (empty($product_id)) {
|
1030 |
return false;
|
1035 |
$total_discount_details = isset($discount['total_discount_details']) ? $discount['total_discount_details'] : array();
|
1036 |
$cart_discount_details = isset($discount['cart_discount_details']) ? $discount['cart_discount_details'] : array();
|
1037 |
if (!empty($total_discount_details)) {
|
1038 |
+
$save_order_item_discounts_array = isset($total_discount_details[$cart_key])? $total_discount_details[$cart_key]: array();
|
1039 |
} else {
|
1040 |
$save_order_item_discounts_array = $cart_discount_details;
|
1041 |
}
|
1042 |
if (!empty($save_order_item_discounts_array)) {
|
1043 |
foreach ($save_order_item_discounts_array as $key => $value) {
|
1044 |
+
$simple_discount = $bulk_discount = $set_discount = $cart_discount = 0;
|
1045 |
$rule_id = $key;
|
1046 |
$applied_rules[] = $rule_id;
|
1047 |
$cart_discount = isset($cart_discount_details[$rule_id]['cart_discount']) ? $cart_discount_details[$rule_id]['cart_discount'] : '0';
|
1060 |
foreach ($cart_discount_details as $key => $value) {
|
1061 |
if (!in_array($key, $applied_rules)) {
|
1062 |
$rule_id = $key;
|
1063 |
+
//$cart_discount = isset($cart_discount_details[$rule_id]['cart_discount']) ? $cart_discount_details[$rule_id]['cart_discount'] : '';
|
1064 |
$cart_shipping = (isset($cart_discount_details[$rule_id]['cart_shipping']) && !empty($cart_discount_details[$rule_id]['cart_shipping'])) ? $cart_discount_details[$rule_id]['cart_shipping'] : 'no';
|
1065 |
$cart_discount_label = isset($cart_discount_details[$rule_id]['cart_discount_label']) ? $cart_discount_details[$rule_id]['cart_discount_label'] : '';
|
1066 |
+
$cart_discount = isset($cart_discount_details[$rule_id]['cart_discount_price']) ? $cart_discount_details[$rule_id]['cart_discount_price'] : 0;
|
1067 |
$model::saveOrderItemDiscounts($order_id, 0, 0, $discount_price, 0, 0, $rule_id, $simple_discount, $bulk_discount, $set_discount, $cart_discount, $cart_discount_label, $cart_shipping);
|
1068 |
}
|
1069 |
}
|
1285 |
*/
|
1286 |
function onCreateWoocommerceOrderLineItem($item, $cart_item_key, $values, $order)
|
1287 |
{
|
1288 |
+
|
1289 |
if (isset(self::$calculated_cart_item_discount[$cart_item_key])) {
|
1290 |
self::$woocommerce_helper->setOrderItemMeta($item, '_advanced_woo_discount_item_total_discount', self::$calculated_cart_item_discount[$cart_item_key]);
|
1291 |
}
|
1467 |
* @param string $get_only
|
1468 |
* @return bool
|
1469 |
*/
|
1470 |
+
static function calculateProductDiscountPrice($price, $product, $quantity = 1, $custom_price = 0, $get_only = 'discounted_price', $manual_request = false, $is_cart = true)
|
1471 |
{
|
1472 |
if (!is_a($product, 'WC_Product')) {
|
1473 |
if (is_integer($product)) {
|
1479 |
if (!$product) {
|
1480 |
return false;
|
1481 |
}
|
1482 |
+
$discounts = self::$calculator->mayApplyPriceDiscount($product, $quantity, $custom_price, false, array(), $is_cart, $manual_request);
|
1483 |
+
|
1484 |
if ($discounts) {
|
1485 |
switch ($get_only) {
|
1486 |
case 'all':
|
1498 |
$price = isset($discounts['discounted_price']) ? $discounts['discounted_price'] : $price;
|
1499 |
break;
|
1500 |
}
|
1501 |
+
} else {
|
1502 |
+
return false;
|
1503 |
}
|
1504 |
return $price;
|
1505 |
}
|
1613 |
if(empty($callback_details['function'])){
|
1614 |
continue;
|
1615 |
}
|
1616 |
+
if(is_string($callback_details['function'])){
|
1617 |
+
continue;
|
1618 |
+
}
|
1619 |
+
|
1620 |
+
if(is_object($callback_details['function'])){
|
1621 |
+
if($this->is_closure($callback_details['function'])){
|
1622 |
+
continue;
|
1623 |
+
}
|
1624 |
+
}
|
1625 |
+
|
1626 |
if (count($callback_details['function']) != 2) {
|
1627 |
continue;
|
1628 |
}
|
1629 |
+
|
1630 |
+
if(!is_object($callback_details['function'][0])){
|
1631 |
+
continue;
|
1632 |
+
}
|
1633 |
+
|
1634 |
if ($class_name == get_class($callback_details['function'][0]) AND $func_name == $callback_details['function'][1]) {
|
1635 |
$result = true;
|
1636 |
break;// done!
|
1639 |
return $result;
|
1640 |
}
|
1641 |
|
1642 |
+
function is_closure($t) {
|
1643 |
+
if(class_exists('\Closure')){
|
1644 |
+
return $t instanceof \Closure;
|
1645 |
+
} else {
|
1646 |
+
return false;
|
1647 |
+
}
|
1648 |
+
}
|
1649 |
+
|
1650 |
/**
|
1651 |
* Display you saved text in order pages
|
1652 |
* @param $total
|
v2/App/Helpers/Filter.php
CHANGED
@@ -136,6 +136,8 @@ class Filter
|
|
136 |
*/
|
137 |
protected function compareWithCustomTaxonomy($product_id, $operation_values, $operation_method, $taxonomy)
|
138 |
{
|
|
|
|
|
139 |
$term_ids = wp_get_post_terms($product_id, $taxonomy, array("fields" => "ids"));
|
140 |
$is_product_has_term = count(array_intersect($term_ids, $operation_values)) > 0;
|
141 |
if ('in_list' === $operation_method) {
|
136 |
*/
|
137 |
protected function compareWithCustomTaxonomy($product_id, $operation_values, $operation_method, $taxonomy)
|
138 |
{
|
139 |
+
$product_parent = Woocommerce::getProductParentId($product_id);
|
140 |
+
$product_id = !empty($product_parent) ? $product_parent : $product_id;
|
141 |
$term_ids = wp_get_post_terms($product_id, $taxonomy, array("fields" => "ids"));
|
142 |
$is_product_has_term = count(array_intersect($term_ids, $operation_values)) > 0;
|
143 |
if ('in_list' === $operation_method) {
|
v2/App/Helpers/Rule.php
CHANGED
@@ -969,7 +969,7 @@ class Rule
|
|
969 |
$value = floatval($value);
|
970 |
switch ($type) {
|
971 |
case 'fixed_price':
|
972 |
-
$discount = $original_value - $value;
|
973 |
break;
|
974 |
case 'percentage':
|
975 |
if (!empty($value)) {
|
@@ -978,7 +978,7 @@ class Rule
|
|
978 |
break;
|
979 |
default:
|
980 |
case 'flat':
|
981 |
-
$discount = $value;
|
982 |
break;
|
983 |
}
|
984 |
return $discount;
|
@@ -1005,6 +1005,7 @@ class Rule
|
|
1005 |
*/
|
1006 |
function isCartConditionsPassed($cart)
|
1007 |
{
|
|
|
1008 |
/*if (empty($cart)) {
|
1009 |
//if cart is empty then return with false
|
1010 |
return false;
|
@@ -1013,12 +1014,12 @@ class Rule
|
|
1013 |
if ($conditions = $this->getConditions()) {
|
1014 |
if (empty($conditions)) {
|
1015 |
//If the rule has no condition then return true
|
1016 |
-
return true;
|
1017 |
}
|
1018 |
$condition_relationship = $this->getRelationship('condition', 'and');
|
1019 |
$dont_check_condition = apply_filters('advanced_woo_discount_rules_check_condition', false, $cart, $this, $condition_relationship);
|
1020 |
if($dont_check_condition){
|
1021 |
-
return true;
|
1022 |
}
|
1023 |
foreach ($conditions as $condition) {
|
1024 |
$type = isset($condition->type) ? $condition->type : NULL;
|
@@ -1066,11 +1067,11 @@ class Rule
|
|
1066 |
}
|
1067 |
//if relationship is "and" and if current condition get fails, no need to check any other conditions provided by admin.just return rule condition failed
|
1068 |
if (isset($is_condition_passed) && !$is_condition_passed && $condition_relationship == "and") {
|
1069 |
-
return false;
|
1070 |
}
|
1071 |
//if relationship is "or" and if current condition get pass, no need to check any other conditions provided by admin.just return rule condition passed
|
1072 |
if (isset($is_condition_passed) && $is_condition_passed && $condition_relationship == "or") {
|
1073 |
-
return true;
|
1074 |
}
|
1075 |
//Check if any conditions fails
|
1076 |
if (isset($is_condition_passed) && !$is_condition_passed) {
|
@@ -1080,9 +1081,9 @@ class Rule
|
|
1080 |
}
|
1081 |
}
|
1082 |
if (in_array(false, $conditions_result)) {
|
1083 |
-
return false;
|
1084 |
}
|
1085 |
-
return true;
|
1086 |
}
|
1087 |
|
1088 |
/**
|
@@ -1115,14 +1116,15 @@ class Rule
|
|
1115 |
*/
|
1116 |
function hasConditions()
|
1117 |
{
|
|
|
1118 |
if (isset($this->rule->conditions)) {
|
1119 |
if (empty($this->rule->conditions) || $this->rule->conditions == '{}' || $this->rule->conditions == '[]') {
|
1120 |
-
|
1121 |
} else {
|
1122 |
-
|
1123 |
}
|
1124 |
}
|
1125 |
-
return
|
1126 |
}
|
1127 |
|
1128 |
/**
|
969 |
$value = floatval($value);
|
970 |
switch ($type) {
|
971 |
case 'fixed_price':
|
972 |
+
$discount = $original_value - self::$woocommerce_helper->getConvertedFixedPrice($value, 'fixed_price');
|
973 |
break;
|
974 |
case 'percentage':
|
975 |
if (!empty($value)) {
|
978 |
break;
|
979 |
default:
|
980 |
case 'flat':
|
981 |
+
$discount = self::$woocommerce_helper->getConvertedFixedPrice($value, 'flat');
|
982 |
break;
|
983 |
}
|
984 |
return $discount;
|
1005 |
*/
|
1006 |
function isCartConditionsPassed($cart)
|
1007 |
{
|
1008 |
+
$rule_object = $this;
|
1009 |
/*if (empty($cart)) {
|
1010 |
//if cart is empty then return with false
|
1011 |
return false;
|
1014 |
if ($conditions = $this->getConditions()) {
|
1015 |
if (empty($conditions)) {
|
1016 |
//If the rule has no condition then return true
|
1017 |
+
return apply_filters('advanced_woo_discount_rules_is_conditions_passed', true, $rule_object, $this->rule);
|
1018 |
}
|
1019 |
$condition_relationship = $this->getRelationship('condition', 'and');
|
1020 |
$dont_check_condition = apply_filters('advanced_woo_discount_rules_check_condition', false, $cart, $this, $condition_relationship);
|
1021 |
if($dont_check_condition){
|
1022 |
+
return apply_filters('advanced_woo_discount_rules_is_conditions_passed', true, $rule_object, $this->rule);
|
1023 |
}
|
1024 |
foreach ($conditions as $condition) {
|
1025 |
$type = isset($condition->type) ? $condition->type : NULL;
|
1067 |
}
|
1068 |
//if relationship is "and" and if current condition get fails, no need to check any other conditions provided by admin.just return rule condition failed
|
1069 |
if (isset($is_condition_passed) && !$is_condition_passed && $condition_relationship == "and") {
|
1070 |
+
return apply_filters('advanced_woo_discount_rules_is_conditions_passed', false, $rule_object, $this->rule);
|
1071 |
}
|
1072 |
//if relationship is "or" and if current condition get pass, no need to check any other conditions provided by admin.just return rule condition passed
|
1073 |
if (isset($is_condition_passed) && $is_condition_passed && $condition_relationship == "or") {
|
1074 |
+
return apply_filters('advanced_woo_discount_rules_is_conditions_passed', true, $rule_object, $this->rule);
|
1075 |
}
|
1076 |
//Check if any conditions fails
|
1077 |
if (isset($is_condition_passed) && !$is_condition_passed) {
|
1081 |
}
|
1082 |
}
|
1083 |
if (in_array(false, $conditions_result)) {
|
1084 |
+
return apply_filters('advanced_woo_discount_rules_is_conditions_passed', false, $rule_object, $this->rule);
|
1085 |
}
|
1086 |
+
return apply_filters('advanced_woo_discount_rules_is_conditions_passed', true, $rule_object, $this->rule);
|
1087 |
}
|
1088 |
|
1089 |
/**
|
1116 |
*/
|
1117 |
function hasConditions()
|
1118 |
{
|
1119 |
+
$status = false;
|
1120 |
if (isset($this->rule->conditions)) {
|
1121 |
if (empty($this->rule->conditions) || $this->rule->conditions == '{}' || $this->rule->conditions == '[]') {
|
1122 |
+
$status = false;
|
1123 |
} else {
|
1124 |
+
$status = true;
|
1125 |
}
|
1126 |
}
|
1127 |
+
return apply_filters('advanced_woo_discount_rules_has_rule_conditions', $status, $this->rule);
|
1128 |
}
|
1129 |
|
1130 |
/**
|
v2/App/Helpers/Woocommerce.php
CHANGED
@@ -32,6 +32,11 @@ class Woocommerce
|
|
32 |
return false;
|
33 |
}
|
34 |
|
|
|
|
|
|
|
|
|
|
|
35 |
/**
|
36 |
* Check the order has particular shipping method
|
37 |
* @param $order
|
@@ -689,7 +694,7 @@ class Woocommerce
|
|
689 |
$line_subtotal = $line_subtotal+$line_subtotal_tax;
|
690 |
}
|
691 |
|
692 |
-
return $line_subtotal;
|
693 |
}
|
694 |
|
695 |
/**
|
@@ -1490,7 +1495,7 @@ class Woocommerce
|
|
1490 |
*/
|
1491 |
static function getPriceHtml($product){
|
1492 |
$html = false;
|
1493 |
-
if (method_exists('get_price_html')) {
|
1494 |
$html = $product->get_price_html();
|
1495 |
}
|
1496 |
return apply_filters('advanced_woo_discount_rules_get_price_html', $html, $product);
|
32 |
return false;
|
33 |
}
|
34 |
|
35 |
+
static function getConvertedFixedPrice($value, $type = '')
|
36 |
+
{
|
37 |
+
return apply_filters('advanced_woo_discount_rules_converted_currency_value', $value, $type);
|
38 |
+
}
|
39 |
+
|
40 |
/**
|
41 |
* Check the order has particular shipping method
|
42 |
* @param $order
|
694 |
$line_subtotal = $line_subtotal+$line_subtotal_tax;
|
695 |
}
|
696 |
|
697 |
+
return apply_filters('advanced_woo_discount_rules_line_item_subtotal', $line_subtotal, $cart_item, $tax_display_type);
|
698 |
}
|
699 |
|
700 |
/**
|
1495 |
*/
|
1496 |
static function getPriceHtml($product){
|
1497 |
$html = false;
|
1498 |
+
if (method_exists($product, 'get_price_html')) {
|
1499 |
$html = $product->get_price_html();
|
1500 |
}
|
1501 |
return apply_filters('advanced_woo_discount_rules_get_price_html', $html, $product);
|
v2/App/Models/DBTable.php
CHANGED
@@ -308,11 +308,9 @@ class DBTable
|
|
308 |
//'include_gifted_amount' => false,
|
309 |
//'include_gifted_qty' => false,
|
310 |
), $params );
|
311 |
-
|
312 |
if ( empty( $params['from'] ) || empty( $params['to'] ) ) {
|
313 |
return false;
|
314 |
}
|
315 |
-
|
316 |
$summary_components = array();
|
317 |
if ( $params['include_amount'] ) {
|
318 |
$summary_components[] = 'rules_stats.discount';
|
@@ -339,7 +337,6 @@ class DBTable
|
|
339 |
LIMIT %d",
|
340 |
array( $params['from'], $params['to'], (int) $params['limit'] )
|
341 |
);
|
342 |
-
|
343 |
$top = $wpdb->get_col( $query_total );
|
344 |
if ( empty( $top ) ) {
|
345 |
return false;
|
@@ -347,7 +344,6 @@ class DBTable
|
|
347 |
|
348 |
$placeholders = array_fill( 0, count( $top ), '%d' );
|
349 |
$placeholders = implode( ', ', $placeholders );
|
350 |
-
|
351 |
$query = $wpdb->prepare(
|
352 |
"SELECT DATE(rules_stats.created_at) as date_rep, rules.id AS rule_id, CONCAT('#', rules.id, ' ', rules.title) AS title, SUM({$summary_field}) AS value
|
353 |
FROM {$table_items} AS rules LEFT JOIN {$table_stats} AS rules_stats
|
@@ -391,7 +387,7 @@ class DBTable
|
|
391 |
*/
|
392 |
public function updateTable(){
|
393 |
//Version of currently activated plugin
|
394 |
-
$current_version = '1.9.
|
395 |
//Database version - this may need upgrading.
|
396 |
$installed_version = get_option('awdr_activity_log_version');
|
397 |
if( $installed_version != $current_version ){
|
308 |
//'include_gifted_amount' => false,
|
309 |
//'include_gifted_qty' => false,
|
310 |
), $params );
|
|
|
311 |
if ( empty( $params['from'] ) || empty( $params['to'] ) ) {
|
312 |
return false;
|
313 |
}
|
|
|
314 |
$summary_components = array();
|
315 |
if ( $params['include_amount'] ) {
|
316 |
$summary_components[] = 'rules_stats.discount';
|
337 |
LIMIT %d",
|
338 |
array( $params['from'], $params['to'], (int) $params['limit'] )
|
339 |
);
|
|
|
340 |
$top = $wpdb->get_col( $query_total );
|
341 |
if ( empty( $top ) ) {
|
342 |
return false;
|
344 |
|
345 |
$placeholders = array_fill( 0, count( $top ), '%d' );
|
346 |
$placeholders = implode( ', ', $placeholders );
|
|
|
347 |
$query = $wpdb->prepare(
|
348 |
"SELECT DATE(rules_stats.created_at) as date_rep, rules.id AS rule_id, CONCAT('#', rules.id, ' ', rules.title) AS title, SUM({$summary_field}) AS value
|
349 |
FROM {$table_items} AS rules LEFT JOIN {$table_stats} AS rules_stats
|
387 |
*/
|
388 |
public function updateTable(){
|
389 |
//Version of currently activated plugin
|
390 |
+
$current_version = '1.9.12';
|
391 |
//Database version - this may need upgrading.
|
392 |
$installed_version = get_option('awdr_activity_log_version');
|
393 |
if( $installed_version != $current_version ){
|
v2/App/Router.php
CHANGED
@@ -60,7 +60,7 @@ class Router
|
|
60 |
*/
|
61 |
$manage_discount_class = self::$manage_discount = (!empty(self::$manage_discount)) ? self::$manage_discount : new ManageDiscount();
|
62 |
add_filter('advanced_woo_discount_rules_get_product_discount_price', array(self::$manage_discount, 'calculateProductDiscountPrice'), 100, 3);
|
63 |
-
add_filter('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', array(self::$manage_discount, 'calculateProductDiscountPrice'), 100,
|
64 |
//Showing you saved text
|
65 |
$display_saving_text = $manage_discount_class::$config->getConfig('display_saving_text', 'disabled');
|
66 |
add_action('woocommerce_checkout_create_order_line_item', array(self::$manage_discount, 'onCreateWoocommerceOrderLineItem'), 10, 4);
|
@@ -77,6 +77,8 @@ class Router
|
|
77 |
add_action('woocommerce_get_formatted_order_total', array(self::$manage_discount, 'displayTotalSavingsInOrderAfterOrderTotal'), 10,2);
|
78 |
}
|
79 |
}
|
|
|
|
|
80 |
|
81 |
$show_subtotal_promotion = $manage_discount_class::$config->getConfig('show_subtotal_promotion', '');
|
82 |
if($show_subtotal_promotion == 1){
|
@@ -163,6 +165,9 @@ class Router
|
|
163 |
|
164 |
add_action($position_to_show_discount_bar, array(self::$manage_discount, 'showAdvancedTableInPosition'));
|
165 |
|
|
|
|
|
|
|
166 |
//Short code manager
|
167 |
self::$short_code_manager = (!empty(self::$short_code_manager)) ? self::$short_code_manager : new ShortCodeManager();
|
168 |
add_shortcode('awdr_sale_items_list', array(self::$short_code_manager, 'saleItemsList'));
|
@@ -174,6 +179,9 @@ class Router
|
|
174 |
}
|
175 |
}
|
176 |
add_shortcode('awdr_banner_content', array(self::$short_code_manager, 'bannerContent'));
|
|
|
|
|
|
|
177 |
}
|
178 |
}
|
179 |
}
|
60 |
*/
|
61 |
$manage_discount_class = self::$manage_discount = (!empty(self::$manage_discount)) ? self::$manage_discount : new ManageDiscount();
|
62 |
add_filter('advanced_woo_discount_rules_get_product_discount_price', array(self::$manage_discount, 'calculateProductDiscountPrice'), 100, 3);
|
63 |
+
add_filter('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', array(self::$manage_discount, 'calculateProductDiscountPrice'), 100, 7);
|
64 |
//Showing you saved text
|
65 |
$display_saving_text = $manage_discount_class::$config->getConfig('display_saving_text', 'disabled');
|
66 |
add_action('woocommerce_checkout_create_order_line_item', array(self::$manage_discount, 'onCreateWoocommerceOrderLineItem'), 10, 4);
|
77 |
add_action('woocommerce_get_formatted_order_total', array(self::$manage_discount, 'displayTotalSavingsInOrderAfterOrderTotal'), 10,2);
|
78 |
}
|
79 |
}
|
80 |
+
add_filter('advanced_woo_discount_rules_get_order_line_item_you_saved_text', array(self::$manage_discount, 'orderSubTotalDiscountDetails'), 10, 3);
|
81 |
+
add_filter('advanced_woo_discount_rules_get_order_total_you_saved_text', array(self::$manage_discount, 'displayTotalSavingsInOrderAfterOrderTotal'), 10,2);
|
82 |
|
83 |
$show_subtotal_promotion = $manage_discount_class::$config->getConfig('show_subtotal_promotion', '');
|
84 |
if($show_subtotal_promotion == 1){
|
165 |
|
166 |
add_action($position_to_show_discount_bar, array(self::$manage_discount, 'showAdvancedTableInPosition'));
|
167 |
|
168 |
+
add_action('advanced_woo_discount_rules_load_discount_table', array(self::$manage_discount, 'showBulkTableInPositionManually'), 10);
|
169 |
+
add_action('advanced_woo_discount_rules_load_discount_bar', array(self::$manage_discount, 'showAdvancedTableInPositionManually'), 10);
|
170 |
+
|
171 |
//Short code manager
|
172 |
self::$short_code_manager = (!empty(self::$short_code_manager)) ? self::$short_code_manager : new ShortCodeManager();
|
173 |
add_shortcode('awdr_sale_items_list', array(self::$short_code_manager, 'saleItemsList'));
|
179 |
}
|
180 |
}
|
181 |
add_shortcode('awdr_banner_content', array(self::$short_code_manager, 'bannerContent'));
|
182 |
+
|
183 |
+
// For handling BOGO
|
184 |
+
add_filter('advanced_woo_discount_rules_after_processed_bogo_free_auto_add', array(self::$manage_discount, 'removeThirdPartyCoupon'));
|
185 |
}
|
186 |
}
|
187 |
}
|
v2/Assets/Js/site_main.js
CHANGED
@@ -65,6 +65,10 @@
|
|
65 |
success: function (response) {
|
66 |
if (response.price_html) {
|
67 |
$price_place.html(response.price_html)
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
},
|
70 |
error: function (response) {
|
65 |
success: function (response) {
|
66 |
if (response.price_html) {
|
67 |
$price_place.html(response.price_html)
|
68 |
+
} else {
|
69 |
+
if(response.original_price_html != undefined){
|
70 |
+
$price_place.html(response.original_price_html)
|
71 |
+
}
|
72 |
}
|
73 |
},
|
74 |
error: function (response) {
|
woo-discount-rules.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Simple to complex discount rules for your WooCommerce store. Core package.
|
6 |
* Author: Flycart Technologies LLP
|
7 |
* Author URI: https://www.flycart.org
|
8 |
-
* Version: 1.9.
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Domain Path: /i18n/languages/
|
5 |
* Description: Simple to complex discount rules for your WooCommerce store. Core package.
|
6 |
* Author: Flycart Technologies LLP
|
7 |
* Author URI: https://www.flycart.org
|
8 |
+
* Version: 1.9.12
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Domain Path: /i18n/languages/
|