Version Description
- (23 Nov 2013) Corrected an issue of forcing Bulk Discount disabled on products after updating from previous versions of Bulk Discount.
Download this release
Release Info
Developer | Rene Puchinger |
Plugin | WooCommerce Bulk Discount |
Version | 2.1.4 |
Comparing to | |
See all releases |
Code changes from version 2.1.3 to 2.1.4
- readme.txt +8 -2
- woocommerce-bulk-discount.php +14 -11
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: Rene Puchinger
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6VEQ8XXK6B3UE
|
4 |
Tags: woocommerce, bulk, discount
|
5 |
Requires at least: 3.5
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 2.1.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -138,6 +138,9 @@ Setting bulk discounts couldn't have been easier.
|
|
138 |
|
139 |
== Changelog ==
|
140 |
|
|
|
|
|
|
|
141 |
= 2.1.3 =
|
142 |
* (18 Nov 2013) Corrected a bug of being not able to disable Bulk Discount on products.
|
143 |
|
@@ -232,6 +235,9 @@ Setting bulk discounts couldn't have been easier.
|
|
232 |
|
233 |
== Upgrade Notice ==
|
234 |
|
|
|
|
|
|
|
235 |
= 2.1.3 =
|
236 |
Bugfix release. Please update immediately.
|
237 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6VEQ8XXK6B3UE
|
4 |
Tags: woocommerce, bulk, discount
|
5 |
Requires at least: 3.5
|
6 |
+
Tested up to: 3.7.1
|
7 |
+
Stable tag: 2.1.4
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
138 |
|
139 |
== Changelog ==
|
140 |
|
141 |
+
= 2.1.4 =
|
142 |
+
* (23 Nov 2013) Corrected an issue of forcing Bulk Discount disabled on products after updating from previous versions of Bulk Discount.
|
143 |
+
|
144 |
= 2.1.3 =
|
145 |
* (18 Nov 2013) Corrected a bug of being not able to disable Bulk Discount on products.
|
146 |
|
235 |
|
236 |
== Upgrade Notice ==
|
237 |
|
238 |
+
= 2.1.4 =
|
239 |
+
Bugfix release. Please update immediately.
|
240 |
+
|
241 |
= 2.1.3 =
|
242 |
Bugfix release. Please update immediately.
|
243 |
|
woocommerce-bulk-discount.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WooCommerce Bulk Discount
|
|
4 |
Plugin URI: http://www.renepuchinger.com
|
5 |
Description: Apply fine-grained bulk discounts to items in the shopping cart.
|
6 |
Author: Rene Puchinger
|
7 |
-
Version: 2.1.
|
8 |
Author URI: http://www.renepuchinger.com
|
9 |
License: GPL3
|
10 |
|
@@ -141,7 +141,7 @@ if ( !class_exists( 'Woo_Bulk_Discount_Plugin_t4m' ) ) {
|
|
141 |
return $price;
|
142 |
}
|
143 |
$_product = $values['data'];
|
144 |
-
if ( get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) != 'yes' ) {
|
145 |
return $price;
|
146 |
}
|
147 |
if ( ( get_option( 'woocommerce_t4m_show_on_item', 'yes' ) == 'no' ) ) {
|
@@ -183,7 +183,7 @@ if ( !class_exists( 'Woo_Bulk_Discount_Plugin_t4m' ) ) {
|
|
183 |
return $price;
|
184 |
}
|
185 |
$_product = $values['data'];
|
186 |
-
if ( get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) != 'yes' ) {
|
187 |
return $price;
|
188 |
}
|
189 |
if ( ( get_option( 'woocommerce_t4m_show_on_subtotal', 'yes' ) == 'no' ) ) {
|
@@ -249,7 +249,7 @@ if ( !class_exists( 'Woo_Bulk_Discount_Plugin_t4m' ) ) {
|
|
249 |
return $price;
|
250 |
}
|
251 |
$_product = get_product( $values['product_id'] );
|
252 |
-
if ( get_post_meta( $values['product_id'], "_bulkdiscount_enabled", true ) != 'yes' ) {
|
253 |
return $price;
|
254 |
}
|
255 |
if ( ( get_option( 'woocommerce_t4m_show_on_order_subtotal', 'yes' ) == 'no' ) ) {
|
@@ -263,7 +263,10 @@ if ( !class_exists( 'Woo_Bulk_Discount_Plugin_t4m' ) ) {
|
|
263 |
if ( empty( $discount_coeffs ) ) {
|
264 |
return $price;
|
265 |
}
|
266 |
-
|
|
|
|
|
|
|
267 |
$discount_type = get_post_meta( $order->id, '_woocommerce_t4m_discount_type', true );
|
268 |
if ( ( $discount_type == 'flat' && $coeff == 0 ) || ( $discount_type == '' && $coeff == 1.0 ) ) {
|
269 |
return $price; // no price modification
|
@@ -306,7 +309,7 @@ if ( !class_exists( 'Woo_Bulk_Discount_Plugin_t4m' ) ) {
|
|
306 |
if ( sizeof( $cart->cart_contents ) > 0 ) {
|
307 |
foreach ( $cart->cart_contents as $cart_item_key => $values ) {
|
308 |
$_product = $values['data'];
|
309 |
-
if ( get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) != 'yes' ) {
|
310 |
continue;
|
311 |
}
|
312 |
if ( ( get_option( 'woocommerce_t4m_discount_type', '' ) == 'flat' ) ) {
|
@@ -346,7 +349,7 @@ if ( !class_exists( 'Woo_Bulk_Discount_Plugin_t4m' ) ) {
|
|
346 |
if ( sizeof( $cart->cart_contents ) > 0 ) {
|
347 |
foreach ( $cart->cart_contents as $cart_item_key => $values ) {
|
348 |
$_product = $values['data'];
|
349 |
-
if ( get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) != 'yes' ) {
|
350 |
continue;
|
351 |
}
|
352 |
$values['data']->set_price( $this->discount_coeffs[$this->get_actual_id( $_product )]['orig_price'] );
|
@@ -381,7 +384,7 @@ if ( !class_exists( 'Woo_Bulk_Discount_Plugin_t4m' ) ) {
|
|
381 |
if ( $this->is_coupon_applied() ) {
|
382 |
return $subtotal;
|
383 |
}
|
384 |
-
if ( get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) != 'yes' ) {
|
385 |
return $subtotal;
|
386 |
}
|
387 |
$coeff = $this->discount_coeffs[$this->get_actual_id( $_product )]['coeff'];
|
@@ -504,7 +507,7 @@ if ( !class_exists( 'Woo_Bulk_Discount_Plugin_t4m' ) ) {
|
|
504 |
|
505 |
<div class="options_group">
|
506 |
<?php
|
507 |
-
woocommerce_wp_checkbox( array( 'id' => '_bulkdiscount_enabled', 'value' => get_post_meta($thepostid, '_bulkdiscount_enabled', true) ? get_post_meta($thepostid, '_bulkdiscount_enabled', true) : 'yes', 'label' => __( 'Bulk Discount enabled', 'wc_bulk_discount' ) ) );
|
508 |
woocommerce_wp_textarea_input( array( 'id' => "_bulkdiscount_text_info", 'label' => __( 'Bulk discount special offer text in product description', 'wc_bulk_discount' ), 'description' => __( 'Optionally enter bulk discount information that will be visible on the product page.', 'wc_bulk_discount' ), 'desc_tip' => 'yes', 'class' => 'fullWidth' ) );
|
509 |
?>
|
510 |
</div>
|
@@ -757,13 +760,13 @@ if ( !class_exists( 'Woo_Bulk_Discount_Plugin_t4m' ) ) {
|
|
757 |
),
|
758 |
|
759 |
array( 'type' => 'sectionend', 'id' => 't4m_bulk_discounts_options' ),
|
760 |
-
|
761 |
array(
|
762 |
'desc' => 'If you find the WooCommerce Bulk Discount extension useful, please rate it <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/woocommerce-bulk-discount#postform">★★★★★</a>. You can also contact us if you want a custom tailored WooCommerce extension.',
|
763 |
'id' => 'woocommerce_t4m_bulk_discount_notice_text',
|
764 |
'type' => 'title'
|
765 |
),
|
766 |
-
|
767 |
array( 'type' => 'sectionend', 'id' => 'woocommerce_t4m_bulk_discount_notice_text' )
|
768 |
|
769 |
) ); // End settings
|
4 |
Plugin URI: http://www.renepuchinger.com
|
5 |
Description: Apply fine-grained bulk discounts to items in the shopping cart.
|
6 |
Author: Rene Puchinger
|
7 |
+
Version: 2.1.4
|
8 |
Author URI: http://www.renepuchinger.com
|
9 |
License: GPL3
|
10 |
|
141 |
return $price;
|
142 |
}
|
143 |
$_product = $values['data'];
|
144 |
+
if ( get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) != '' && get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) !== 'yes' ) {
|
145 |
return $price;
|
146 |
}
|
147 |
if ( ( get_option( 'woocommerce_t4m_show_on_item', 'yes' ) == 'no' ) ) {
|
183 |
return $price;
|
184 |
}
|
185 |
$_product = $values['data'];
|
186 |
+
if ( get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) != '' && get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) !== 'yes' ) {
|
187 |
return $price;
|
188 |
}
|
189 |
if ( ( get_option( 'woocommerce_t4m_show_on_subtotal', 'yes' ) == 'no' ) ) {
|
249 |
return $price;
|
250 |
}
|
251 |
$_product = get_product( $values['product_id'] );
|
252 |
+
if ( get_post_meta( $values['product_id'], "_bulkdiscount_enabled", true ) != '' && get_post_meta( $values['product_id'], "_bulkdiscount_enabled", true ) !== 'yes' ) {
|
253 |
return $price;
|
254 |
}
|
255 |
if ( ( get_option( 'woocommerce_t4m_show_on_order_subtotal', 'yes' ) == 'no' ) ) {
|
263 |
if ( empty( $discount_coeffs ) ) {
|
264 |
return $price;
|
265 |
}
|
266 |
+
@$coeff = $discount_coeffs[$actual_id]['coeff'];
|
267 |
+
if ( !$coeff ) {
|
268 |
+
return $price;
|
269 |
+
}
|
270 |
$discount_type = get_post_meta( $order->id, '_woocommerce_t4m_discount_type', true );
|
271 |
if ( ( $discount_type == 'flat' && $coeff == 0 ) || ( $discount_type == '' && $coeff == 1.0 ) ) {
|
272 |
return $price; // no price modification
|
309 |
if ( sizeof( $cart->cart_contents ) > 0 ) {
|
310 |
foreach ( $cart->cart_contents as $cart_item_key => $values ) {
|
311 |
$_product = $values['data'];
|
312 |
+
if ( get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) != '' && get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) !== 'yes' ) {
|
313 |
continue;
|
314 |
}
|
315 |
if ( ( get_option( 'woocommerce_t4m_discount_type', '' ) == 'flat' ) ) {
|
349 |
if ( sizeof( $cart->cart_contents ) > 0 ) {
|
350 |
foreach ( $cart->cart_contents as $cart_item_key => $values ) {
|
351 |
$_product = $values['data'];
|
352 |
+
if ( get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) != '' && get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) !== 'yes' ) {
|
353 |
continue;
|
354 |
}
|
355 |
$values['data']->set_price( $this->discount_coeffs[$this->get_actual_id( $_product )]['orig_price'] );
|
384 |
if ( $this->is_coupon_applied() ) {
|
385 |
return $subtotal;
|
386 |
}
|
387 |
+
if ( get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) != '' && get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) !== 'yes' ) {
|
388 |
return $subtotal;
|
389 |
}
|
390 |
$coeff = $this->discount_coeffs[$this->get_actual_id( $_product )]['coeff'];
|
507 |
|
508 |
<div class="options_group">
|
509 |
<?php
|
510 |
+
woocommerce_wp_checkbox( array( 'id' => '_bulkdiscount_enabled', 'value' => get_post_meta( $thepostid, '_bulkdiscount_enabled', true ) ? get_post_meta( $thepostid, '_bulkdiscount_enabled', true ) : 'yes', 'label' => __( 'Bulk Discount enabled', 'wc_bulk_discount' ) ) );
|
511 |
woocommerce_wp_textarea_input( array( 'id' => "_bulkdiscount_text_info", 'label' => __( 'Bulk discount special offer text in product description', 'wc_bulk_discount' ), 'description' => __( 'Optionally enter bulk discount information that will be visible on the product page.', 'wc_bulk_discount' ), 'desc_tip' => 'yes', 'class' => 'fullWidth' ) );
|
512 |
?>
|
513 |
</div>
|
760 |
),
|
761 |
|
762 |
array( 'type' => 'sectionend', 'id' => 't4m_bulk_discounts_options' ),
|
763 |
+
|
764 |
array(
|
765 |
'desc' => 'If you find the WooCommerce Bulk Discount extension useful, please rate it <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/woocommerce-bulk-discount#postform">★★★★★</a>. You can also contact us if you want a custom tailored WooCommerce extension.',
|
766 |
'id' => 'woocommerce_t4m_bulk_discount_notice_text',
|
767 |
'type' => 'title'
|
768 |
),
|
769 |
+
|
770 |
array( 'type' => 'sectionend', 'id' => 'woocommerce_t4m_bulk_discount_notice_text' )
|
771 |
|
772 |
) ); // End settings
|