Version Description
- 05/03/18 =
- Improvement - Dependant product UI improvement
- Fix - Cheapest from category rule for variants not working(Pro)
Download this release
Release Info
Developer | flycart |
Plugin | Discount Rules for WooCommerce |
Version | 1.5.2 |
Comparing to | |
See all releases |
Code changes from version 1.5.1 to 1.5.2
- assets/css/style.css +8 -0
- assets/js/app.js +2 -2
- helper/woo-function.php +1 -1
- includes/pricing-rules.php +7 -1
- loader.php +5 -16
- readme.txt +5 -1
- view/view-pricing-rules.php +9 -5
- woo-discount-rules.php +1 -1
assets/css/style.css
CHANGED
@@ -51,4 +51,12 @@
|
|
51 |
.discount_rule_list {
|
52 |
border-bottom: 1px solid #ddd;
|
53 |
margin-bottom: 20px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
51 |
.discount_rule_list {
|
52 |
border-bottom: 1px solid #ddd;
|
53 |
margin-bottom: 20px;
|
54 |
+
}
|
55 |
+
.product_based_condition_product_from,
|
56 |
+
.product_based_condition_get_product_discount{
|
57 |
+
margin: 15px 0;
|
58 |
+
}
|
59 |
+
#product_list span.select2-container{
|
60 |
+
min-width: 250px;
|
61 |
+
width: auto !important;
|
62 |
}
|
assets/js/app.js
CHANGED
@@ -151,9 +151,9 @@ function validateFields(){
|
|
151 |
form += '</div>';
|
152 |
form += '<div class="discount_product_option_list_con">';
|
153 |
if($('#flycart_wdr_woocommerce_version').val() == 2){
|
154 |
-
form += '<input type="hidden" class="wc-product-search" style="width: 250px" data-multiple="true" name="discount_range[' + count + '][discount_product][]" data-placeholder="Search for a product…" data-action="woocommerce_json_search_products_and_variations" data-selected=""/>';
|
155 |
} else {
|
156 |
-
form += '<select class="wc-product-search" multiple="multiple" style="width: 250px" name="discount_range[' + count + '][discount_product][]" data-placeholder="Search for a product…" data-action="woocommerce_json_search_products_and_variations"></select>'
|
157 |
}
|
158 |
form += '</div>';
|
159 |
form += '<div class="discount_category_option_list_con hide">';
|
151 |
form += '</div>';
|
152 |
form += '<div class="discount_product_option_list_con">';
|
153 |
if($('#flycart_wdr_woocommerce_version').val() == 2){
|
154 |
+
form += '<input type="hidden" class="wc-product-search" style="min-width: 250px" data-multiple="true" name="discount_range[' + count + '][discount_product][]" data-placeholder="Search for a product…" data-action="woocommerce_json_search_products_and_variations" data-selected=""/>';
|
155 |
} else {
|
156 |
+
form += '<select class="wc-product-search" multiple="multiple" style="min-width: 250px" name="discount_range[' + count + '][discount_product][]" data-placeholder="Search for a product…" data-action="woocommerce_json_search_products_and_variations"></select>'
|
157 |
}
|
158 |
form += '</div>';
|
159 |
form += '<div class="discount_category_option_list_con hide">';
|
helper/woo-function.php
CHANGED
@@ -311,7 +311,7 @@ if(!class_exists('FlycartWoocommerceProduct')){
|
|
311 |
public static function getProductAjaxSelectBox($products_list, $name){
|
312 |
$html = '';
|
313 |
if(FlycartWoocommerceVersion::wcVersion('3.0')){
|
314 |
-
$html .= '<select class="wc-product-search" style="width: 250px" multiple="multiple" name="'.$name.'[]" data-placeholder="'.esc_attr__( 'Search for a product…', 'woocommerce' ).'" data-action="woocommerce_json_search_products_and_variations">';
|
315 |
if(!empty($products_list) && count($products_list))
|
316 |
foreach ( $products_list as $product_id ) {
|
317 |
$product = self::wc_get_product($product_id);
|
311 |
public static function getProductAjaxSelectBox($products_list, $name){
|
312 |
$html = '';
|
313 |
if(FlycartWoocommerceVersion::wcVersion('3.0')){
|
314 |
+
$html .= '<select class="wc-product-search" style="min-width: 250px" multiple="multiple" name="'.$name.'[]" data-placeholder="'.esc_attr__( 'Search for a product…', 'woocommerce' ).'" data-action="woocommerce_json_search_products_and_variations">';
|
315 |
if(!empty($products_list) && count($products_list))
|
316 |
foreach ( $products_list as $product_id ) {
|
317 |
$product = self::wc_get_product($product_id);
|
includes/pricing-rules.php
CHANGED
@@ -1085,7 +1085,13 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
1085 |
$cart = FlycartWoocommerceCart::get_cart();
|
1086 |
foreach ( $cart as $cart_item ) {
|
1087 |
$result = $this->isItemInCategoryList($category, $cart_item);
|
1088 |
-
if($result)
|
|
|
|
|
|
|
|
|
|
|
|
|
1089 |
}
|
1090 |
}
|
1091 |
|
1085 |
$cart = FlycartWoocommerceCart::get_cart();
|
1086 |
foreach ( $cart as $cart_item ) {
|
1087 |
$result = $this->isItemInCategoryList($category, $cart_item);
|
1088 |
+
if($result){
|
1089 |
+
if(isset($cart_item['variation_id']) && $cart_item['variation_id']){
|
1090 |
+
$products[] = $cart_item['variation_id'];
|
1091 |
+
} else {
|
1092 |
+
$products[] = $cart_item['product_id'];
|
1093 |
+
}
|
1094 |
+
}
|
1095 |
}
|
1096 |
}
|
1097 |
|
loader.php
CHANGED
@@ -136,23 +136,12 @@ if(!class_exists('FlycartWooDiscountRules')){
|
|
136 |
$woocommerce_version = $pluginDetails['Version'];
|
137 |
}
|
138 |
|
139 |
-
$
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
$empty_update_cart = $postData->get('update_cart');
|
144 |
-
$empty_proceed = $postData->get('proceed');
|
145 |
-
if ((!empty($empty_add_to_cart) && is_numeric($postData->get('add-to-cart'))) || $postData->get('action', false) == 'woocommerce_add_to_cart') {
|
146 |
-
|
147 |
-
} else if (!empty($empty_apply_coupon) || !empty($empty_update_cart) || !empty($empty_proceed)) {
|
148 |
-
add_action('woocommerce_after_cart_item_quantity_update', array($this->discountBase, 'handleDiscount'), 100);
|
149 |
} else {
|
150 |
-
|
151 |
-
add_action('woocommerce_before_calculate_totals', array($this, 'applyDiscountRules'), 1000);
|
152 |
-
add_action('woocommerce_cart_loaded_from_session', array($this, 'applyCartDiscountRules'), 100);
|
153 |
-
} else {
|
154 |
-
add_action('woocommerce_cart_loaded_from_session', array($this->discountBase, 'handleDiscount'), 100);
|
155 |
-
}
|
156 |
}
|
157 |
|
158 |
// Manually Update Line Item Name.
|
136 |
$woocommerce_version = $pluginDetails['Version'];
|
137 |
}
|
138 |
|
139 |
+
add_action('woocommerce_after_cart_item_quantity_update', array($this->discountBase, 'handleDiscount'), 100);
|
140 |
+
if(version_compare($woocommerce_version, '3.0', '>=')){
|
141 |
+
add_action('woocommerce_before_calculate_totals', array($this, 'applyDiscountRules'), 1000);
|
142 |
+
add_action('woocommerce_cart_loaded_from_session', array($this, 'applyCartDiscountRules'), 100);
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
} else {
|
144 |
+
add_action('woocommerce_cart_loaded_from_session', array($this->discountBase, 'handleDiscount'), 100);
|
|
|
|
|
|
|
|
|
|
|
145 |
}
|
146 |
|
147 |
// Manually Update Line Item Name.
|
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
|
5 |
Requires at least: 4.4.1
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 1.5.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -241,6 +241,10 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
|
|
241 |
|
242 |
== Changelog ==
|
243 |
|
|
|
|
|
|
|
|
|
244 |
= 1.5.1 - 27/02/18 =
|
245 |
* Fix - Dependant product not applied for product variants(if choose only child)
|
246 |
|
4 |
Tags: woocommerce, discounts, dynamic pricing, Buy One Get One Free, pricing deals, price rules, bulk discounts, advanced discounts
|
5 |
Requires at least: 4.4.1
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 1.5.2
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
241 |
|
242 |
== Changelog ==
|
243 |
|
244 |
+
= 1.5.2 - 05/03/18 =
|
245 |
+
* Improvement - Dependant product UI improvement
|
246 |
+
* Fix - Cheapest from category rule for variants not working(Pro)
|
247 |
+
|
248 |
= 1.5.1 - 27/02/18 =
|
249 |
* Fix - Dependant product not applied for product variants(if choose only child)
|
250 |
|
view/view-pricing-rules.php
CHANGED
@@ -320,11 +320,15 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
|
|
320 |
<label ><?php esc_html_e('to', 'woo-discount-rules')?></label>
|
321 |
<input placeholder="<?php esc_html_e('Quantity', 'woo-discount-rules') ?>" type="text" name="product_based_condition[product_quantity_to]" value="<?php echo $product_based_condition_product_quantity_to; ?>"/ >
|
322 |
</div>
|
323 |
-
<
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
<
|
|
|
|
|
|
|
|
|
328 |
</div>
|
329 |
</div>
|
330 |
<div class="form-group">
|
320 |
<label ><?php esc_html_e('to', 'woo-discount-rules')?></label>
|
321 |
<input placeholder="<?php esc_html_e('Quantity', 'woo-discount-rules') ?>" type="text" name="product_based_condition[product_quantity_to]" value="<?php echo $product_based_condition_product_quantity_to; ?>"/ >
|
322 |
</div>
|
323 |
+
<div class="product_based_condition_product_from">
|
324 |
+
<label ><?php esc_html_e('Product(s) from', 'woo-discount-rules')?></label>
|
325 |
+
<?php echo FlycartWoocommerceProduct::getProductAjaxSelectBox($product_based_condition_product_to_buy, 'product_based_condition[product_to_buy]'); ?>
|
326 |
+
</div>
|
327 |
+
<div class="product_based_condition_get_product_discount">
|
328 |
+
<label ><?php esc_html_e('and get discount in ', 'woo-discount-rules') ?></label>
|
329 |
+
<?php echo FlycartWoocommerceProduct::getProductAjaxSelectBox($product_based_condition_product_to_apply, 'product_based_condition[product_to_apply]'); ?>
|
330 |
+
<label ><?php esc_html_e('Product(s)', 'woo-discount-rules') ?></label>
|
331 |
+
</div>
|
332 |
</div>
|
333 |
</div>
|
334 |
<div class="form-group">
|
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.5.
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Requires at least: 4.6.1
|
5 |
* Description: Simple Discount Rules for WooCommerce.
|
6 |
* Author: Flycart Technologies LLP
|
7 |
* Author URI: https://www.flycart.org
|
8 |
+
* Version: 1.5.2
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Requires at least: 4.6.1
|