Booster for WooCommerce - Version 1.1.7

Version Description

  • 12/08/2014 =
  • Dev - Call for Price - "Hide sale tag" code fixed.
  • Feature Upgraded - Call for Price - Separate label to show for related products.
  • Dev - PDF Invoices - Text align to right on cells with prices.
  • Dev - PDF Invoices - "PDF" renamed to "PDF Invoice" (in orders list).
Download this release

Release Info

Developer algoritmika
Plugin Icon 128x128 Booster for WooCommerce
Version 1.1.7
Comparing to
See all releases

Code changes from version 1.1.6 to 1.1.7

includes/class-wcj-call-for-price.php CHANGED
@@ -9,24 +9,24 @@
9
  * @author Algoritmika Ltd.
10
  */
11
 
12
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
13
 
14
  if ( ! class_exists( 'WCJ_Call_For_Price' ) ) :
15
 
16
  class WCJ_Call_For_Price {
17
 
 
 
 
18
  public function __construct() {
19
 
20
  // Defaults
21
  $this->default_empty_price_text = '<strong>Call for price</strong>';
22
 
23
- // HOOKS
24
- // Main hooks
25
  // Empty Price hooks
26
- if ( get_option( 'wcj_call_for_price_enabled' ) == 'yes' ) {
27
-
28
  add_filter( 'woocommerce_empty_price_html', array( $this, 'on_empty_price' ), 100 );
29
- add_filter( 'woocommerce_sale_flash', array( $this, 'hide_sales_flash' ), 100, 2 );
30
  }
31
 
32
  // Settings hooks
@@ -36,64 +36,34 @@ class WCJ_Call_For_Price {
36
  }
37
 
38
  /**
39
- * add_enabled_option.
40
- */
41
- public function add_enabled_option( $settings ) {
42
-
43
- $all_settings = $this->get_settings();
44
- $settings[] = $all_settings[1];
45
-
46
- return $settings;
47
- }
48
-
49
- /**
50
- * hide_sales_flash.
51
  */
52
- public function hide_sales_flash( $post, $product ) {
53
-
54
- if ( get_option('wcj_call_for_price_hide_sale_sign') === 'yes' ) {
55
-
56
- $current_product = get_product( $product->ID );
57
- if ( $current_product->get_price() == '' ) return false;
58
- }
59
-
60
- return '<span class="onsale">' . __( 'Sale!', 'woocommerce' ) . '</span>';
61
  }
62
 
63
  /**
64
- * on_empty_price.
65
- *
66
- public function on_empty_price( $price ) {
67
-
68
- if ( ( get_option('wcj_call_for_price_show_on_single') == 'yes' ) && is_single() ) return $this->default_empty_price_text;
69
- if ( ( get_option('wcj_call_for_price_show_on_archive') == 'yes' ) && is_archive() ) return $this->default_empty_price_text;
70
- if ( ( get_option('wcj_call_for_price_show_on_home') == 'yes' ) && is_front_page() ) return $this->default_empty_price_text;
71
-
72
- // No changes
73
- return $price;
74
- }
75
-
76
- /**
77
- * On empty price.
78
  */
79
- public function on_empty_price( $price ) {
80
-
81
- /*$updated_price = get_option( 'wcj_call_for_price_text' );
82
-
83
- if ( ( get_option('wcj_call_for_price_show_on_single') == 'yes' ) && is_single() ) return apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, $updated_price );
84
- if ( ( get_option('wcj_call_for_price_show_on_archive') == 'yes' ) && is_archive() ) return apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, $updated_price );
85
- if ( ( get_option('wcj_call_for_price_show_on_home') == 'yes' ) && is_front_page() ) return apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, $updated_price );*/
86
-
87
- if ( ( get_option('wcj_call_for_price_text') !== '' ) && is_single() ) return apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text') );
88
- if ( ( get_option('wcj_call_for_price_text_on_archive') !== '' ) && is_archive() ) return apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text_on_archive') );
89
- if ( ( get_option('wcj_call_for_price_text_on_home') !== '' ) && is_front_page() ) return apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text_on_home') );
90
 
91
  // No changes
92
  return $price;
93
  }
94
 
95
  /**
96
- * get_settings.
97
  */
98
  function get_settings() {
99
 
@@ -144,38 +114,22 @@ class WCJ_Call_For_Price {
144
  'css' => 'width:50%;min-width:300px;',
145
  'custom_attributes'
146
  => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
147
- ),
148
-
149
- /*array(
150
- 'title' => __( 'Visibility', 'woocommerce-jetpack' ),
151
- //'title' => __( 'Show on Single Product', 'woocommerce-jetpack' ),
152
- 'desc' => __( 'Check to show on single products page', 'woocommerce-jetpack' ),
153
- 'id' => 'wcj_call_for_price_show_on_single',
154
- 'default' => 'yes',
155
- 'type' => 'checkbox',
156
- 'checkboxgroup' => 'start',
157
  ),
158
 
159
  array(
160
- //'title' => __( 'Show on Products Archive', 'woocommerce-jetpack' ),
161
- 'desc' => __( 'Check to show on products archive page', 'woocommerce-jetpack' ),
162
- 'id' => 'wcj_call_for_price_show_on_archive',
163
- 'default' => 'yes',
164
- 'type' => 'checkbox',
165
- 'checkboxgroup' => '',
166
- ),
167
-
168
- array(
169
- //'title' => __( 'Show on Home Page', 'woocommerce-jetpack' ),
170
- 'desc' => __( 'Check to show on home page', 'woocommerce-jetpack' ),
171
- 'id' => 'wcj_call_for_price_show_on_home',
172
- 'default' => 'yes',
173
- 'type' => 'checkbox',
174
- 'checkboxgroup' => 'end',
175
- ),*/
176
-
177
  array(
178
- 'title' => __( 'Hide Sale! Tag', 'woocommerce-jetpack' ),
179
  'desc' => __( 'Hide the tag', 'woocommerce-jetpack' ),
180
  'id' => 'wcj_call_for_price_hide_sale_sign',
181
  'default' => 'yes',
@@ -189,12 +143,19 @@ class WCJ_Call_For_Price {
189
  }
190
 
191
  /**
192
- * settings_section.
193
- */
194
- function settings_section( $sections ) {
 
 
 
 
195
 
196
- $sections['call_for_price'] = __( 'Call for Price', 'woocommerce-jetpack' );
197
-
 
 
 
198
  return $sections;
199
  }
200
  }
9
  * @author Algoritmika Ltd.
10
  */
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) exit; // exit if accessed directly
13
 
14
  if ( ! class_exists( 'WCJ_Call_For_Price' ) ) :
15
 
16
  class WCJ_Call_For_Price {
17
 
18
+ /**
19
+ * Constructor.
20
+ */
21
  public function __construct() {
22
 
23
  // Defaults
24
  $this->default_empty_price_text = '<strong>Call for price</strong>';
25
 
 
 
26
  // Empty Price hooks
27
+ if ( get_option( 'wcj_call_for_price_enabled' ) == 'yes' ) {
 
28
  add_filter( 'woocommerce_empty_price_html', array( $this, 'on_empty_price' ), 100 );
29
+ add_filter( 'woocommerce_sale_flash', array( $this, 'hide_sales_flash' ), 100, 3 );
30
  }
31
 
32
  // Settings hooks
36
  }
37
 
38
  /**
39
+ * Hide "sales" icon for empty price products.
 
 
 
 
 
 
 
 
 
 
 
40
  */
41
+ public function hide_sales_flash( $onsale_html, $post, $product ) {
42
+ if ( get_option('wcj_call_for_price_hide_sale_sign') === 'yes' )
43
+ if ( $product->get_price() === '' )
44
+ return '';
45
+ return $onsale_html;
 
 
 
 
46
  }
47
 
48
  /**
49
+ * On empty price filter - return the label.
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  */
51
+ public function on_empty_price( $price ) {
52
+ if ( ( get_option('wcj_call_for_price_text') !== '' ) && is_single( get_the_ID() ) )
53
+ return apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text') );
54
+ if ( ( get_option('wcj_call_for_price_text_on_related') !== '' ) && ( is_single() ) && ( ! is_single( get_the_ID() ) ) )
55
+ return apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text_on_related') );
56
+ if ( ( get_option('wcj_call_for_price_text_on_archive') !== '' ) && is_archive() )
57
+ return apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text_on_archive') );
58
+ if ( ( get_option('wcj_call_for_price_text_on_home') !== '' ) && is_front_page() )
59
+ return apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text_on_home') );
 
 
60
 
61
  // No changes
62
  return $price;
63
  }
64
 
65
  /**
66
+ * Get settings array.
67
  */
68
  function get_settings() {
69
 
114
  'css' => 'width:50%;min-width:300px;',
115
  'custom_attributes'
116
  => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
 
 
 
 
 
 
 
 
 
 
117
  ),
118
 
119
  array(
120
+ 'title' => __( 'Label to Show on Related', 'woocommerce-jetpack' ),
121
+ 'desc_tip' => __( 'This sets the html to output on empty price. Leave blank to disable.', 'woocommerce-jetpack' ),
122
+ 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
123
+ 'id' => 'wcj_call_for_price_text_on_related',
124
+ 'default' => $this->default_empty_price_text,
125
+ 'type' => 'textarea',
126
+ 'css' => 'width:50%;min-width:300px;',
127
+ 'custom_attributes'
128
+ => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
129
+ ),
130
+
 
 
 
 
 
 
131
  array(
132
+ 'title' => __( 'Hide Sale! Tag', 'woocommerce-jetpack' ),
133
  'desc' => __( 'Hide the tag', 'woocommerce-jetpack' ),
134
  'id' => 'wcj_call_for_price_hide_sale_sign',
135
  'default' => 'yes',
143
  }
144
 
145
  /**
146
+ * Get "enabled" setting from settings array.
147
+ */
148
+ public function add_enabled_option( $settings ) {
149
+ $all_settings = $this->get_settings();
150
+ $settings[] = $all_settings[1];
151
+ return $settings;
152
+ }
153
 
154
+ /**
155
+ * Add section to WooCommerce > Settings > Jetpack.
156
+ */
157
+ function settings_section( $sections ) {
158
+ $sections['call_for_price'] = __( 'Call for Price', 'woocommerce-jetpack' );
159
  return $sections;
160
  }
161
  }
includes/class-wcj-pdf-invoices.php CHANGED
@@ -227,8 +227,8 @@ class WCJ_PDF_Invoices {
227
  $html .= '<td>' . $item['qty'] . '</td>';
228
  //if ( '' !== $the_order->get_formatted_line_subtotal( $item, 'excl' ) ) $html .= '<td>' . $the_order->get_formatted_line_subtotal( $item, 'excl' ) . '</td>';
229
  if ( $the_order->get_line_tax( $item ) != 0 )
230
- $html .= '<td>' . wc_price( $the_order->get_line_subtotal( $item ), array( 'currency' => $the_order->get_order_currency() ) ) . '</td>';
231
- $html .= '<td>' . $the_order->get_formatted_line_subtotal( $item, 'incl' ) . '</td>';
232
  //$html .= '</li>';
233
  $html .= '</tr>';
234
  }
@@ -243,23 +243,23 @@ class WCJ_PDF_Invoices {
243
  // SUBTOTAL
244
  //$html .= '<tr><td colspan="3"></td><td style="border: 1px solid #F0F0F0;">' . get_option( 'wcj_pdf_invoices_order_subtotal_text' ) . '</td><td style="border: 1px solid #F0F0F0;">' . $the_order->get_subtotal_to_display( false, 'excl' ) . '</td></tr>';
245
  $subtotal = wc_price( ( $the_order->get_total() - $the_order->get_total_tax() - $the_order->get_total_shipping() - $the_order->get_total_discount() ), array( 'currency' => $the_order->get_order_currency() ) ); //$the_order->get_total_discount() $the_order->get_total_shipping()
246
- $html .= '<tr><td colspan="3"></td><td style="border: 1px solid #F0F0F0;">' . get_option( 'wcj_pdf_invoices_order_subtotal_text' ) . '</td><td style="border: 1px solid #F0F0F0;">' . $subtotal . '</td></tr>';
247
 
248
  // SHIPPING
249
  if ( $the_order->get_total_shipping() != 0 )
250
- $html .= '<tr><td colspan="3"></td><td style="border: 1px solid #F0F0F0;">' . get_option( 'wcj_pdf_invoices_order_shipping_text' ) . '</td><td style="border: 1px solid #F0F0F0;">' . wc_price( $the_order->get_total_shipping(), array( 'currency' => $the_order->get_order_currency() ) ) . '</td></tr>';
251
 
252
  // DISCOUNT
253
  if ( $the_order->get_total_discount() != 0 )
254
- $html .= '<tr><td colspan="3"></td><td style="border: 1px solid #F0F0F0;">' . get_option( 'wcj_pdf_invoices_order_discount_text' ) . '</td><td style="border: 1px solid #F0F0F0;">' . wc_price( $the_order->get_total_discount(), array( 'currency' => $the_order->get_order_currency() ) ) . '</td></tr>';
255
  //
256
 
257
  // TAXES
258
  foreach ( $the_order->get_tax_totals() as $tax_object )
259
- $html .= '<tr><td colspan="3"></td><td style="border: 1px solid #F0F0F0;">' . $tax_object->label . '</td><td style="border: 1px solid #F0F0F0;">' . $tax_object->formatted_amount . '</td></tr>';
260
 
261
  // TOTAL
262
- $html .= '<tr><td colspan="3"></td><td style="border: 1px solid #F0F0F0;">' . get_option( 'wcj_pdf_invoices_order_total_text' ) . '</td><td style="border: 1px solid #F0F0F0;">' . $the_order->get_formatted_order_total() . '</td></tr>';
263
 
264
  $html .= '</tbody></table></p>';
265
 
@@ -292,7 +292,7 @@ class WCJ_PDF_Invoices {
292
 
293
  $actions['pdf_invoice'] = array(
294
  'url' => basename( $_SERVER['REQUEST_URI'] ) . '&pdf_invoice=' . $the_order->id,
295
- 'name' => __( 'PDF', 'woocommerce-jetpack' ),
296
  'action' => "view pdf_invoice"
297
  );
298
 
227
  $html .= '<td>' . $item['qty'] . '</td>';
228
  //if ( '' !== $the_order->get_formatted_line_subtotal( $item, 'excl' ) ) $html .= '<td>' . $the_order->get_formatted_line_subtotal( $item, 'excl' ) . '</td>';
229
  if ( $the_order->get_line_tax( $item ) != 0 )
230
+ $html .= '<td style="text-align:right;">' . wc_price( $the_order->get_line_subtotal( $item ), array( 'currency' => $the_order->get_order_currency() ) ) . '</td>';
231
+ $html .= '<td style="text-align:right;">' . $the_order->get_formatted_line_subtotal( $item, 'incl' ) . '</td>';
232
  //$html .= '</li>';
233
  $html .= '</tr>';
234
  }
243
  // SUBTOTAL
244
  //$html .= '<tr><td colspan="3"></td><td style="border: 1px solid #F0F0F0;">' . get_option( 'wcj_pdf_invoices_order_subtotal_text' ) . '</td><td style="border: 1px solid #F0F0F0;">' . $the_order->get_subtotal_to_display( false, 'excl' ) . '</td></tr>';
245
  $subtotal = wc_price( ( $the_order->get_total() - $the_order->get_total_tax() - $the_order->get_total_shipping() - $the_order->get_total_discount() ), array( 'currency' => $the_order->get_order_currency() ) ); //$the_order->get_total_discount() $the_order->get_total_shipping()
246
+ $html .= '<tr><td colspan="3"></td><td style="border: 1px solid #F0F0F0;">' . get_option( 'wcj_pdf_invoices_order_subtotal_text' ) . '</td><td style="border: 1px solid #F0F0F0; text-align:right;">' . $subtotal . '</td></tr>';
247
 
248
  // SHIPPING
249
  if ( $the_order->get_total_shipping() != 0 )
250
+ $html .= '<tr><td colspan="3"></td><td style="border: 1px solid #F0F0F0;">' . get_option( 'wcj_pdf_invoices_order_shipping_text' ) . '</td><td style="border: 1px solid #F0F0F0; text-align:right;">' . wc_price( $the_order->get_total_shipping(), array( 'currency' => $the_order->get_order_currency() ) ) . '</td></tr>';
251
 
252
  // DISCOUNT
253
  if ( $the_order->get_total_discount() != 0 )
254
+ $html .= '<tr><td colspan="3"></td><td style="border: 1px solid #F0F0F0;">' . get_option( 'wcj_pdf_invoices_order_discount_text' ) . '</td><td style="border: 1px solid #F0F0F0; text-align:right;">' . wc_price( $the_order->get_total_discount(), array( 'currency' => $the_order->get_order_currency() ) ) . '</td></tr>';
255
  //
256
 
257
  // TAXES
258
  foreach ( $the_order->get_tax_totals() as $tax_object )
259
+ $html .= '<tr><td colspan="3"></td><td style="border: 1px solid #F0F0F0;">' . $tax_object->label . '</td><td style="border: 1px solid #F0F0F0; text-align:right;">' . $tax_object->formatted_amount . '</td></tr>';
260
 
261
  // TOTAL
262
+ $html .= '<tr><td colspan="3"></td><td style="border: 1px solid #F0F0F0;">' . get_option( 'wcj_pdf_invoices_order_total_text' ) . '</td><td style="border: 1px solid #F0F0F0; text-align:right;">' . $the_order->get_formatted_order_total() . '</td></tr>';
263
 
264
  $html .= '</tbody></table></p>';
265
 
292
 
293
  $actions['pdf_invoice'] = array(
294
  'url' => basename( $_SERVER['REQUEST_URI'] ) . '&pdf_invoice=' . $the_order->id,
295
+ 'name' => __( 'PDF Invoice', 'woocommerce-jetpack' ),
296
  'action' => "view pdf_invoice"
297
  );
298
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://algoritmika.com/donate/
4
  Tags: woocommerce,woocommerce jetpack,custom price labels,call for price,currency symbol,remove sorting,remove old product slugs,add to cart text,order number,sequential order numbering,pdf invoice,pdf invoices,already in cart,empty cart,redirect to checkout,minimum order amount,customize checkout fields,checkout fields,email,customize product tabs,product tabs,related products number,empty cart,redirect add to cart,redirect to checkout,product already in cart,custom payment gateway,payment gateway icon
5
  Requires at least: 3.9.1
6
  Tested up to: 3.9.2
7
- Stable tag: 1.1.6
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -57,11 +57,17 @@ To unlock all WooCommerce Jetpack features, please install additional <a href="h
57
 
58
  == Changelog ==
59
 
 
 
 
 
 
 
60
  = 1.1.6 - 11/08/2014 =
61
  * Fix - PDF Invoices - Bug with subtotal calculation (discounts were not included), fixed.
62
 
63
  = 1.1.5 - 11/08/2014 =
64
- * Dev - PDF Invoices - "Save as..." disabled.
65
  * Feature Upgraded - PDF Invoices - New fields added: line total excluding tax, subtotal, shipping, discount, taxes.
66
 
67
  = 1.1.4 - 10/08/2014 =
4
  Tags: woocommerce,woocommerce jetpack,custom price labels,call for price,currency symbol,remove sorting,remove old product slugs,add to cart text,order number,sequential order numbering,pdf invoice,pdf invoices,already in cart,empty cart,redirect to checkout,minimum order amount,customize checkout fields,checkout fields,email,customize product tabs,product tabs,related products number,empty cart,redirect add to cart,redirect to checkout,product already in cart,custom payment gateway,payment gateway icon
5
  Requires at least: 3.9.1
6
  Tested up to: 3.9.2
7
+ Stable tag: 1.1.7
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
57
 
58
  == Changelog ==
59
 
60
+ = 1.1.7 - 12/08/2014 =
61
+ * Dev - Call for Price - "Hide sale tag" code fixed.
62
+ * Feature Upgraded - Call for Price - Separate label to show for related products.
63
+ * Dev - PDF Invoices - Text align to right on cells with prices.
64
+ * Dev - PDF Invoices - "PDF" renamed to "PDF Invoice" (in orders list).
65
+
66
  = 1.1.6 - 11/08/2014 =
67
  * Fix - PDF Invoices - Bug with subtotal calculation (discounts were not included), fixed.
68
 
69
  = 1.1.5 - 11/08/2014 =
70
+ * Dev - PDF Invoices - "Save as..." disabled (in orders list).
71
  * Feature Upgraded - PDF Invoices - New fields added: line total excluding tax, subtotal, shipping, discount, taxes.
72
 
73
  = 1.1.4 - 10/08/2014 =
woocommerce-jetpack.php CHANGED
@@ -3,16 +3,17 @@
3
  Plugin Name: WooCommerce Jetpack
4
  Plugin URI: http://woojetpack.com
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
- Version: 1.1.6
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2014 Algoritmika Ltd.
10
  License: GNU General Public License v3.0
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
  */
13
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
 
15
- if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) return; // Check if WooCommerce is active
 
 
16
 
17
  if ( ! class_exists( 'WC_Jetpack' ) ) :
18
 
3
  Plugin Name: WooCommerce Jetpack
4
  Plugin URI: http://woojetpack.com
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
+ Version: 1.1.7
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2014 Algoritmika Ltd.
10
  License: GNU General Public License v3.0
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
  */
 
13
 
14
+ if ( ! defined( 'ABSPATH' ) ) exit; // exit if accessed directly
15
+
16
+ if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) return; // check if WooCommerce is active
17
 
18
  if ( ! class_exists( 'WC_Jetpack' ) ) :
19