Booster for WooCommerce - Version 1.8.2

Version Description

  • 01/11/2014 =
  • Fix - Orders - Custom Order Statuses - Bug causing fail on changing status with slug more that 17 characters, fixed. Reported by Patryk.
  • Fix - Product Tabs - Priority was not working in custom local tabs, fixed. Also added default priority in custom local product tabs.
  • Fix - Settings link in WooCommerce > Jetpack Settings was wrong, fixed. This caused bug, where on non-root WordPress instalations Settings link gave 404 error. Reported by Brian.
  • Fix - Product Tabs - Wrong default priority for WooCommerce Standard Product Tabs, fixed. Reviews Tab priority was 20 (wrong), changed to 30 (good), Additional Information Tab 30 and 20 accordingly. Reported by Patryk.
  • Feature Upgraded - Product Info - Major upgrade: added new info options with separate lines. Also added about 20 new short codes, including: %price%, %price_excluding_tax% (suggested by Josh), %stock_availability% (by https://wordpress.org/support/topic/custom-tabs-1), %time_since_last_sale%, %weight%, %list_attributes% etc. For full list of short codes, please visit http://woojetpack.com/features/product-info/
  • Feature Upgraded - Product Listings - Option to change default WooCommece behavior on displaying all products if none categories are dispalyed. Now it's possible to disable displaying the products. Suggested by Xavier.
  • Feature Upgraded - PDF Invoices - Order date and time added. Suggested by https://wordpress.org/support/topic/order-time
Download this release

Release Info

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

Code changes from version 1.8.1 to 1.8.2

includes/admin/settings/class-wc-settings-jetpack.php CHANGED
@@ -5,7 +5,7 @@
5
  * The WooCommerce Jetpack Settings class.
6
  *
7
  * @class WC_Settings_Jetpack
8
- * @version 1.0.1
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
@@ -22,7 +22,6 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
22
  public function __construct() {
23
  $this->id = 'jetpack';
24
  $this->label = __( 'Jetpack', 'woocommerce-jetpack' );
25
-
26
  add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
27
  add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) );
28
  add_action( 'woocommerce_settings_save_' . $this->id, array( $this, 'save' ) );
@@ -34,8 +33,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
34
  *
35
  * @return array
36
  */
37
- public function get_sections() {
38
-
39
  return apply_filters( 'wcj_settings_sections', array(
40
  '' => __( 'Dashboard', 'woocommerce-jetpack' ),
41
  ) );
@@ -70,16 +68,16 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
70
  ?><table class="wp-list-table widefat plugins">
71
  <thead>
72
  <tr>
73
- <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><label class="screen-reader-text" for="cb-select-all-1">Select All</label><input id="cb-select-all-1" type="checkbox"></th>
74
- <th scope="col" id="name" class="manage-column column-name" style="">Feature</th>
75
- <th scope="col" id="description" class="manage-column column-description" style="">Description</th>
76
  </tr>
77
  </thead>
78
  <tfoot>
79
  <tr>
80
- <th scope="col" class="manage-column column-cb check-column" style=""><label class="screen-reader-text" for="cb-select-all-2">Select All</label><input id="cb-select-all-2" type="checkbox"></th>
81
- <th scope="col" class="manage-column column-name" style="">Feature</th>
82
- <th scope="col" class="manage-column column-description" style="">Description</th>
83
  </tr>
84
  </tfoot>
85
  <tbody id="the-list"><?php
@@ -91,14 +89,12 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
91
  $html .= '<tr id="' . $the_feature['id'] . '" ' . 'class="' . $this->active( get_option( $the_feature['id'] ) ) . '">';
92
 
93
  $html .= '<th scope="row" class="check-column">';
94
- //$html .= '<label class="screen-reader-text" for="' . $the_feature['id'] . '">' . __( 'Enable the ', 'woocommerce-jetpack' ) . $the_feature['title'] . ' feature</label>';
95
  $html .= '<label class="screen-reader-text" for="' . $the_feature['id'] . '">' . $the_feature['desc'] . '</label>';
96
  $html .= '<input type="checkbox" name="' . $the_feature['id'] . '" value="1" id="' . $the_feature['id'] . '" ' . checked( get_option( $the_feature['id'] ), 'yes', false ) . '>';
97
  $html .= '</th>';
98
 
99
  $html .= '<td class="plugin-title"><strong>' . $the_feature['title'] . '</strong>';
100
  $html .= '<div class="row-actions visible">';
101
- //$html .= '<span class="deactivate"><a href="" title="Deactivate feature">Deactivate</a> | </span>';
102
 
103
  // Temporary solution - 17/09/2014
104
  $section = $the_feature['id'];
@@ -106,13 +102,12 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
106
  $section = str_replace( '_enabled', '', $section );
107
  if ( 'currency' === $section ) $section = 'currencies';
108
 
109
- $html .= '<span class="0"><a href="/wp-admin/admin.php?page=wc-settings&tab=jetpack&section=' . $section . '">Settings</a></span>';
110
  $html .= '</div>';
111
  $html .= '</td>';
112
 
113
  $html .= '<td class="column-description desc">';
114
  $html .= '<div class="plugin-description"><p>' . $the_feature['desc_tip'] . '</p></div>';
115
- //$html .= '<div class="active second plugin-version-author-uri">Versija 2.1.1 | Sukūrė <a href="" title="Aplankyti autoriaus puslapį">Ramoonus</a> | <a href="" title="Aplankyti įskiepio puslapį">Aplankyti įskiepio puslapį</a></div>';
116
  $html .= '</td>';
117
 
118
  $html .= '</tr>';
@@ -126,13 +121,10 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
126
  /**
127
  * Save settings
128
  */
129
- public function save() {
130
-
131
  global $current_section;
132
-
133
  $settings = $this->get_settings( $current_section );
134
- WC_Admin_Settings::save_fields( $settings );
135
-
136
  echo apply_filters('get_wc_jetpack_plus_message', '', 'global' );
137
  }
138
 
@@ -142,64 +134,15 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
142
  * @return array
143
  */
144
  public function get_settings( $current_section = '' ) {
145
-
146
  if ( $current_section != '' ) {
147
-
148
  return apply_filters('wcj_settings_' . $current_section, array() );
149
  }
150
  else {
151
-
152
  $settings[] = array( 'title' => __( 'WooCommerce Jetpack Dashboard', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => 'This dashboard lets you enable/disable any Jetpack feature. Each checkbox comes with short feature\'s description. Please visit <a href="http://woojetpack.com" target="_blank">WooJetpack.com</a> for detailed info on each feature.', 'id' => 'wcj_options' );
153
-
154
  $settings = apply_filters( 'wcj_features_status', $settings );
155
-
156
- /*$statuses = array();
157
- $statuses[] = include_once( 'class-wcj-price-labels.php' );
158
- $statuses[] = include_once( 'includes/class-wcj-call-for-price.php' );
159
- $statuses[] = include_once( 'includes/class-wcj-currencies.php' );
160
- $statuses[] = include_once( 'includes/class-wcj-sorting.php' );
161
- $statuses[] = include_once( 'includes/class-wcj-old-slugs.php' );
162
- $statuses[] = include_once( 'includes/class-wcj-product-info.php' );
163
- foreach ( $statuses as $section )
164
- $settings[] = $section->get_statuses()[1];*/
165
-
166
  $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_options' );
167
-
168
- /*$updated_settings = array();
169
- $i = 0;
170
- $s = count( $settings );
171
- foreach ( $settings as $single_item ) {
172
-
173
- if ( ( 'checkbox' === $single_item['type'] ) && ( $i > 0 ) ) {
174
-
175
- if ( 1 == $i ) {
176
- $single_item['checkboxgroup'] = 'start';
177
- $single_item['title'] = 'The Features';
178
- }
179
- else {
180
- if ( ( $s - 2 ) == $i )
181
- $single_item['checkboxgroup'] = 'end';
182
- else
183
- $single_item['checkboxgroup'] = '';
184
-
185
- $single_item['title'] = '';
186
- }
187
-
188
- // Temporary solution - 2014.07.21
189
- $single_item['desc'] = str_replace( 'Enable the ', 'Enable the <strong>', $single_item['desc'] );
190
- $single_item['desc'] = str_replace( ' feature', '</strong> feature', $single_item['desc'] );
191
-
192
- $single_item['desc'] .= ': <em>' . $single_item['desc_tip'] . '</em>';
193
- //$single_item['desc'] .= ': <em>' . $single_item['desc_tip'] . __( ' Default: ', 'woocommerce-jetpack' ) . $single_item['default'] . '</em>';
194
- $single_item['desc_tip'] = '';
195
- }
196
-
197
- $updated_settings[] = $single_item;
198
-
199
- $i++;
200
- }*/
201
-
202
- return $settings;//apply_filters('wcj_general_settings', $settings );
203
  }
204
  }
205
  }
5
  * The WooCommerce Jetpack Settings class.
6
  *
7
  * @class WC_Settings_Jetpack
8
+ * @version 1.1.0
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
22
  public function __construct() {
23
  $this->id = 'jetpack';
24
  $this->label = __( 'Jetpack', 'woocommerce-jetpack' );
 
25
  add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
26
  add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) );
27
  add_action( 'woocommerce_settings_save_' . $this->id, array( $this, 'save' ) );
33
  *
34
  * @return array
35
  */
36
+ public function get_sections() {
 
37
  return apply_filters( 'wcj_settings_sections', array(
38
  '' => __( 'Dashboard', 'woocommerce-jetpack' ),
39
  ) );
68
  ?><table class="wp-list-table widefat plugins">
69
  <thead>
70
  <tr>
71
+ <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><label class="screen-reader-text" for="cb-select-all-1"><?php _e( 'Select All', 'woocommerce-jetpack' ); ?></label><input id="cb-select-all-1" type="checkbox"></th>
72
+ <th scope="col" id="name" class="manage-column column-name" style=""><?php _e( 'Feature', 'woocommerce-jetpack' ); ?></th>
73
+ <th scope="col" id="description" class="manage-column column-description" style=""><?php _e( 'Description', 'woocommerce-jetpack' ); ?></th>
74
  </tr>
75
  </thead>
76
  <tfoot>
77
  <tr>
78
+ <th scope="col" class="manage-column column-cb check-column" style=""><label class="screen-reader-text" for="cb-select-all-2"><?php _e( 'Select All', 'woocommerce-jetpack' ); ?></label><input id="cb-select-all-2" type="checkbox"></th>
79
+ <th scope="col" class="manage-column column-name" style=""><?php _e( 'Feature', 'woocommerce-jetpack' ); ?></th>
80
+ <th scope="col" class="manage-column column-description" style=""><?php _e( 'Description', 'woocommerce-jetpack' ); ?></th>
81
  </tr>
82
  </tfoot>
83
  <tbody id="the-list"><?php
89
  $html .= '<tr id="' . $the_feature['id'] . '" ' . 'class="' . $this->active( get_option( $the_feature['id'] ) ) . '">';
90
 
91
  $html .= '<th scope="row" class="check-column">';
 
92
  $html .= '<label class="screen-reader-text" for="' . $the_feature['id'] . '">' . $the_feature['desc'] . '</label>';
93
  $html .= '<input type="checkbox" name="' . $the_feature['id'] . '" value="1" id="' . $the_feature['id'] . '" ' . checked( get_option( $the_feature['id'] ), 'yes', false ) . '>';
94
  $html .= '</th>';
95
 
96
  $html .= '<td class="plugin-title"><strong>' . $the_feature['title'] . '</strong>';
97
  $html .= '<div class="row-actions visible">';
 
98
 
99
  // Temporary solution - 17/09/2014
100
  $section = $the_feature['id'];
102
  $section = str_replace( '_enabled', '', $section );
103
  if ( 'currency' === $section ) $section = 'currencies';
104
 
105
+ $html .= '<span class="0"><a href="' . admin_url() . 'admin.php?page=wc-settings&tab=jetpack&section=' . $section . '">Settings</a></span>';
106
  $html .= '</div>';
107
  $html .= '</td>';
108
 
109
  $html .= '<td class="column-description desc">';
110
  $html .= '<div class="plugin-description"><p>' . $the_feature['desc_tip'] . '</p></div>';
 
111
  $html .= '</td>';
112
 
113
  $html .= '</tr>';
121
  /**
122
  * Save settings
123
  */
124
+ public function save() {
 
125
  global $current_section;
 
126
  $settings = $this->get_settings( $current_section );
127
+ WC_Admin_Settings::save_fields( $settings );
 
128
  echo apply_filters('get_wc_jetpack_plus_message', '', 'global' );
129
  }
130
 
134
  * @return array
135
  */
136
  public function get_settings( $current_section = '' ) {
 
137
  if ( $current_section != '' ) {
 
138
  return apply_filters('wcj_settings_' . $current_section, array() );
139
  }
140
  else {
 
141
  $settings[] = array( 'title' => __( 'WooCommerce Jetpack Dashboard', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => 'This dashboard lets you enable/disable any Jetpack feature. Each checkbox comes with short feature\'s description. Please visit <a href="http://woojetpack.com" target="_blank">WooJetpack.com</a> for detailed info on each feature.', 'id' => 'wcj_options' );
 
142
  $settings = apply_filters( 'wcj_features_status', $settings );
 
 
 
 
 
 
 
 
 
 
 
143
  $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_options' );
144
+ return $settings;
145
+ //apply_filters('wcj_general_settings', $settings );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  }
147
  }
148
  }
includes/class-wcj-add-to-cart.php CHANGED
@@ -97,7 +97,7 @@ class WCJ_Add_to_cart {
97
  */
98
  public function custom_add_to_cart_button_text( $add_to_cart_text) {
99
 
100
- global $woocommerce,$product;
101
 
102
  $product_type = $product->product_type;
103
 
97
  */
98
  public function custom_add_to_cart_button_text( $add_to_cart_text) {
99
 
100
+ global $woocommerce, $product;
101
 
102
  $product_type = $product->product_type;
103
 
includes/class-wcj-orders.php CHANGED
@@ -5,7 +5,7 @@
5
  * The WooCommerce Jetpack Orders class.
6
  *
7
  * @class WCJ_Orders
8
- * @version 1.5.1
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
@@ -153,6 +153,8 @@ class WCJ_Orders {
153
  // Checking function arguments
154
  if ( ! isset( $new_status ) || '' == $new_status )
155
  return '<div class="error"><p>' . __( 'Status slug is empty. Status not added.', 'woocommerce-jetpack' ) . '</p></div>';
 
 
156
  if ( ! isset( $new_status_label ) || '' == $new_status_label )
157
  return '<div class="error"><p>' . __( 'Status label is empty. Status not added.', 'woocommerce-jetpack' ) . '</p></div>';
158
 
5
  * The WooCommerce Jetpack Orders class.
6
  *
7
  * @class WCJ_Orders
8
+ * @version 1.6.0
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
153
  // Checking function arguments
154
  if ( ! isset( $new_status ) || '' == $new_status )
155
  return '<div class="error"><p>' . __( 'Status slug is empty. Status not added.', 'woocommerce-jetpack' ) . '</p></div>';
156
+ if ( strlen( $new_status ) > 17 )
157
+ return '<div class="error"><p>' . __( 'The length of status slug must be 17 or less characters.', 'woocommerce-jetpack' ) . '</p></div>';
158
  if ( ! isset( $new_status_label ) || '' == $new_status_label )
159
  return '<div class="error"><p>' . __( 'Status label is empty. Status not added.', 'woocommerce-jetpack' ) . '</p></div>';
160
 
includes/class-wcj-pdf-invoices.php CHANGED
@@ -5,7 +5,7 @@
5
  * The WooCommerce Jetpack PDF Invoices class.
6
  *
7
  * @class WCJ_PDF_Invoices
8
- * @version 1.6.0
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
@@ -328,13 +328,17 @@ class WCJ_PDF_Invoices {
328
  $html .= '<img src="' . get_option( 'wcj_pdf_invoices_seller_logo_url' ) . '">';
329
  $html .= '<div class="pdf_invoice_header_text_wcj">' . get_option( 'wcj_pdf_invoices_header_text' ) . '</div>';
330
  // NUMBER AND DATE //
331
- $html .= '<table class="pdf_invoice_number_and_date_table_wcj"><tbody>';
332
- $html .= '<tr><td>' . get_option( 'wcj_pdf_invoices_invoice_number_text' ) . '</td><td>' . $order_number . '</td></tr>';
333
- $html .= '<tr><td>' . get_option( 'wcj_pdf_invoices_invoice_date_text' ) . '</td><td>' . date_i18n( get_option('date_format'), strtotime( $the_order->order_date ) ) . '</td></tr>';
 
 
 
 
334
  if ( '' != get_option( 'wcj_pdf_invoices_invoice_due_date_text' ) )
335
- $html .= '<tr><td>' . get_option( 'wcj_pdf_invoices_invoice_due_date_text' ) . '</td><td>' . date_i18n( get_option('date_format'), ( strtotime( $the_order->order_date ) + get_option( 'wcj_pdf_invoices_invoice_due_date_days' ) * 24 * 60 *60 ) ) . '</td></tr>';
336
  if ( '' != get_option( 'wcj_pdf_invoices_invoice_fulfillment_date_text' ) )
337
- $html .= '<tr><td>' . get_option( 'wcj_pdf_invoices_invoice_fulfillment_date_text' ) . '</td><td>' . date_i18n( get_option('date_format'), ( strtotime( $the_order->order_date ) + get_option( 'wcj_pdf_invoices_invoice_fulfillment_date_days' ) * 24 * 60 *60 ) ) . '</td></tr>';
338
  $html .= '</tbody></table>';
339
  $html .= '</p>';
340
 
@@ -688,6 +692,26 @@ class WCJ_PDF_Invoices {
688
  'type' => 'text',
689
  'css' => 'width:33%;min-width:300px;',
690
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
691
 
692
  array(
693
  'title' => __( 'Invoice Date', 'woocommerce-jetpack' ),
@@ -698,15 +722,6 @@ class WCJ_PDF_Invoices {
698
  'css' => 'width:33%;min-width:300px;',
699
  ),
700
 
701
- /*array(
702
- 'title' => __( 'Invoice Due Date', 'woocommerce-jetpack' ),
703
- 'desc' => __( 'Enable', 'woocommerce-jetpack' ),
704
- //'desc_tip' => __( 'Set to 0 to disable', 'woocommerce-jetpack' ),
705
- 'id' => 'wcj_pdf_invoices_invoice_due_date_enabled',
706
- 'default' => 'no',
707
- 'type' => 'checkbox',
708
- ),*/
709
-
710
  array(
711
  'title' => 'Invoice Due Date',
712
  'desc' => __( 'Default: Invoice due date', 'woocommerce-jetpack' ),
@@ -727,15 +742,6 @@ class WCJ_PDF_Invoices {
727
  'css' => 'width:33%;min-width:300px;',
728
  ),
729
 
730
- /*array(
731
- 'title' => __( 'Invoice Fulfillment Date', 'woocommerce-jetpack' ),
732
- 'desc' => __( 'Enable', 'woocommerce-jetpack' ),
733
- //'desc_tip' => __( 'Set to 0 to disable', 'woocommerce-jetpack' ),
734
- 'id' => 'wcj_pdf_invoices_invoice_fulfillment_date_enabled',
735
- 'default' => 'no',
736
- 'type' => 'checkbox',
737
- ),*/
738
-
739
  array(
740
  'title' => 'Invoice Fulfillment Date',
741
  'desc' => __( 'Default: Invoice fulfillment date', 'woocommerce-jetpack' ),
5
  * The WooCommerce Jetpack PDF Invoices class.
6
  *
7
  * @class WCJ_PDF_Invoices
8
+ * @version 1.7.0
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
328
  $html .= '<img src="' . get_option( 'wcj_pdf_invoices_seller_logo_url' ) . '">';
329
  $html .= '<div class="pdf_invoice_header_text_wcj">' . get_option( 'wcj_pdf_invoices_header_text' ) . '</div>';
330
  // NUMBER AND DATE //
331
+ $html .= '<table class="pdf_invoice_number_and_date_table_wcj"><tbody>';
332
+ $html .= '<tr><td>' . get_option( 'wcj_pdf_invoices_invoice_number_text' ) . '</td><td>' . $order_number . '</td></tr>';
333
+ if ( '' != get_option( 'wcj_pdf_invoices_order_date_text' ) )
334
+ $html .= '<tr><td>' . get_option( 'wcj_pdf_invoices_order_date_text' ) . '</td><td>' . date_i18n( get_option( 'date_format' ), strtotime( $the_order->order_date ) ) . '</td></tr>';
335
+ if ( '' != get_option( 'wcj_pdf_invoices_order_time_text' ) )
336
+ $html .= '<tr><td>' . get_option( 'wcj_pdf_invoices_order_time_text' ) . '</td><td>' . date_i18n( get_option( 'time_format' ), strtotime( $the_order->order_date ) ) . '</td></tr>';
337
+ $html .= '<tr><td>' . get_option( 'wcj_pdf_invoices_invoice_date_text' ) . '</td><td>' . date_i18n( get_option( 'date_format' ), strtotime( $the_order->order_date ) ) . '</td></tr>';
338
  if ( '' != get_option( 'wcj_pdf_invoices_invoice_due_date_text' ) )
339
+ $html .= '<tr><td>' . get_option( 'wcj_pdf_invoices_invoice_due_date_text' ) . '</td><td>' . date_i18n( get_option( 'date_format' ), ( strtotime( $the_order->order_date ) + get_option( 'wcj_pdf_invoices_invoice_due_date_days' ) * 24 * 60 *60 ) ) . '</td></tr>';
340
  if ( '' != get_option( 'wcj_pdf_invoices_invoice_fulfillment_date_text' ) )
341
+ $html .= '<tr><td>' . get_option( 'wcj_pdf_invoices_invoice_fulfillment_date_text' ) . '</td><td>' . date_i18n( get_option( 'date_format' ), ( strtotime( $the_order->order_date ) + get_option( 'wcj_pdf_invoices_invoice_fulfillment_date_days' ) * 24 * 60 *60 ) ) . '</td></tr>';
342
  $html .= '</tbody></table>';
343
  $html .= '</p>';
344
 
692
  'type' => 'text',
693
  'css' => 'width:33%;min-width:300px;',
694
  ),
695
+
696
+ array(
697
+ 'title' => __( 'Order Date', 'woocommerce-jetpack' ),
698
+ 'desc' => __( 'Default: Order date', 'woocommerce-jetpack' ),
699
+ 'desc_tip' => __( 'Leave blank to disable', 'woocommerce-jetpack' ),
700
+ 'id' => 'wcj_pdf_invoices_order_date_text',
701
+ 'default' => __( 'Order date', 'woocommerce-jetpack' ),
702
+ 'type' => 'text',
703
+ 'css' => 'width:33%;min-width:300px;',
704
+ ),
705
+
706
+ array(
707
+ 'title' => __( 'Order Time', 'woocommerce-jetpack' ),
708
+ 'desc' => __( 'Default: Order time', 'woocommerce-jetpack' ),
709
+ 'desc_tip' => __( 'Leave blank to disable', 'woocommerce-jetpack' ),
710
+ 'id' => 'wcj_pdf_invoices_order_time_text',
711
+ 'default' => __( 'Order time', 'woocommerce-jetpack' ),
712
+ 'type' => 'text',
713
+ 'css' => 'width:33%;min-width:300px;',
714
+ ),
715
 
716
  array(
717
  'title' => __( 'Invoice Date', 'woocommerce-jetpack' ),
722
  'css' => 'width:33%;min-width:300px;',
723
  ),
724
 
 
 
 
 
 
 
 
 
 
725
  array(
726
  'title' => 'Invoice Due Date',
727
  'desc' => __( 'Default: Invoice due date', 'woocommerce-jetpack' ),
742
  'css' => 'width:33%;min-width:300px;',
743
  ),
744
 
 
 
 
 
 
 
 
 
 
745
  array(
746
  'title' => 'Invoice Fulfillment Date',
747
  'desc' => __( 'Default: Invoice fulfillment date', 'woocommerce-jetpack' ),
includes/class-wcj-product-info.php CHANGED
@@ -5,7 +5,7 @@
5
  * The WooCommerce Jetpack Product Info class.
6
  *
7
  * @class WCJ_Product_Info
8
- * @version 1.2.1
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
@@ -34,29 +34,51 @@ class WCJ_Product_Info {
34
  'woocommerce_single_product_summary' => __( 'Inside single product summary', 'woocommerce-jetpack' ),
35
  'woocommerce_before_single_product_summary' => __( 'Before single product summary', 'woocommerce-jetpack' ),
36
  'woocommerce_after_single_product_summary' => __( 'After single product summary', 'woocommerce-jetpack' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  );
38
 
39
  // Main hooks
40
- if ( 'yes' === get_option( 'wcj_product_info_enabled' ) ) {
41
-
 
 
 
42
  if ( get_option( 'wcj_product_info_related_products_enable' ) === 'yes' ) {
43
  add_filter( 'woocommerce_related_products_args', array( $this, 'related_products_limit' ), 100 );
44
  add_filter( 'woocommerce_output_related_products_args', array( $this, 'related_products_limit_args' ), 100 );
45
- }
46
-
47
- if ( ( 'yes' === get_option( 'wcj_product_info_on_archive_enabled' ) ) &&
48
- ( '' != get_option( 'wcj_product_info_on_archive' ) ) &&
49
- ( '' != get_option( 'wcj_product_info_on_archive_filter' ) ) &&
50
- ( '' != get_option( 'wcj_product_info_on_archive_filter_priority' ) ) &&
51
- ( array_key_exists( get_option( 'wcj_product_info_on_archive_filter' ), $this->product_info_on_archive_filters_array ) ) )
52
- add_action( get_option( 'wcj_product_info_on_archive_filter' ), array( $this, 'product_info' ), get_option( 'wcj_product_info_on_archive_filter_priority' ) );
53
-
54
- if ( ( 'yes' === get_option( 'wcj_product_info_on_single_enabled' ) ) &&
55
- ( '' != get_option( 'wcj_product_info_on_single' ) ) &&
56
- ( '' != get_option( 'wcj_product_info_on_single_filter' ) ) &&
57
- ( '' != get_option( 'wcj_product_info_on_single_filter_priority' ) ) &&
58
- ( array_key_exists( get_option( 'wcj_product_info_on_single_filter' ), $this->product_info_on_single_filters_array ) ) )
59
- add_action( get_option( 'wcj_product_info_on_single_filter' ), array( $this, 'product_info' ), get_option( 'wcj_product_info_on_single_filter_priority' ) );
60
  }
61
 
62
  // Settings hooks
@@ -64,78 +86,393 @@ class WCJ_Product_Info {
64
  add_filter( 'wcj_settings_product_info', array( $this, 'get_settings' ), 100 );
65
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
66
  }
67
-
68
  /**
69
- * Return feature's enable/disable option.
70
- */
71
- public function add_enabled_option( $settings ) {
 
 
 
72
 
73
- $all_settings = $this->get_settings();
74
- $settings[] = $all_settings[1];
75
-
76
- return $settings;
 
 
 
 
 
 
 
 
 
77
  }
78
 
79
  /**
80
  * product_info.
81
  */
82
  public function product_info() {
83
-
84
- $the_action_name = current_filter();
85
- if ( array_key_exists( $the_action_name, $this->product_info_on_archive_filters_array ) )
86
  $the_product_info = get_option( 'wcj_product_info_on_archive' );
87
- else if ( array_key_exists( $the_action_name, $this->product_info_on_single_filters_array ) )
88
- $the_product_info = apply_filters( 'wcj_get_option_filter', 'Total sales: %total_sales%', get_option( 'wcj_product_info_on_single' ) );
89
- global $product;
90
- $product_custom_fields = get_post_custom( $product->id );
91
- $total_sales = ( isset( $product_custom_fields['total_sales'][0] ) ) ? $product_custom_fields['total_sales'][0] : 0;
92
- /*$you_save = 0;
93
- $you_save_percent = 0;
94
- if ( $product->is_on_sale() ) {
95
- $you_save = $product->get_regular_price() - $product->get_sale_price();
96
- if ( 0 != $product->get_regular_price() )
97
- $you_save_percent = intval( $you_save / $product->get_regular_price() * 100 );
98
  }
99
- */
100
- /*//$available_variations = '';
101
- //if ( 'variable' === $product->product_type )
102
- $available_variations = $product->list_attributes();// $product->get_formatted_name();// print_r( $product->get_available_variations() );*/
103
- $product_info_shortcodes_array = array(
104
- '%sku%' => $product->get_sku(),
105
- '%total_sales%' => $total_sales,
106
- //'%you_save%' => wc_price( $you_save ),
107
- //'%you_save_percent%' => $you_save_percent . '%',
108
- //'%available_variations%' => $available_variations,
109
- );
110
- foreach ( $product_info_shortcodes_array as $search_for_phrase => $replace_with_phrase )
111
- $the_product_info = str_replace( $search_for_phrase, $replace_with_phrase, $the_product_info );
112
- echo $the_product_info;
 
113
  }
114
 
115
  /**
116
- * Change number of related products on product page.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  */
118
- function related_products_limit_args( $args ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  $args['posts_per_page'] = get_option( 'wcj_product_info_related_products_num' );
121
  $args['orderby'] = get_option( 'wcj_product_info_related_products_orderby' );
122
- $args['columns'] = get_option( 'wcj_product_info_related_products_columns' );
123
-
124
  return $args;
125
  }
126
 
127
  /**
128
  * Change number of related products on product page.
129
  */
130
- function related_products_limit( $args ) {
131
-
132
  $args['posts_per_page'] = get_option( 'wcj_product_info_related_products_num' );
133
  $args['orderby'] = get_option( 'wcj_product_info_related_products_orderby' );
134
- if ( get_option( 'wcj_product_info_related_products_orderby' ) != 'rand' ) $args['order'] = get_option( 'wcj_product_info_related_products_order' );
135
-
136
  return $args;
137
  }
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  /**
140
  * Get settings.
141
  */
@@ -143,7 +480,7 @@ class WCJ_Product_Info {
143
 
144
  $settings = array(
145
 
146
- // Product Info Options
147
  array( 'title' => __( 'Product Info Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_product_info_options' ),
148
 
149
  array(
@@ -155,10 +492,24 @@ class WCJ_Product_Info {
155
  'type' => 'checkbox',
156
  ),
157
 
158
- array( 'type' => 'sectionend', 'id' => 'wcj_product_info_options' ),
159
 
160
- // Product Info Additional Options
161
- array( 'title' => __( 'More Products Info', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_product_info_additional_options' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
163
  array(
164
  'title' => __( 'Product Info on Archive Pages', 'woocommerce-jetpack' ),
@@ -167,53 +518,16 @@ class WCJ_Product_Info {
167
  'default' => 'no',
168
  'type' => 'checkbox',
169
  ),
170
-
171
  array(
172
  'title' => '',
173
- 'desc_tip' => __( 'HTML info. Predefined: %total_sales%, %sku%', 'woocommerce-jetpack' ),
174
  'id' => 'wcj_product_info_on_archive',
175
- 'default' => 'SKU: %sku%',
176
  'type' => 'textarea',
177
  'css' => 'width:50%;min-width:300px;height:100px;',
178
- ),
179
-
180
- /*
181
- array(
182
- 'title' => '',
183
- 'desc_tip' => __( '"You save" information for products on sale.', 'woocommerce-jetpack' ),
184
- 'id' => 'wcj_product_info_on_archive_you_save',
185
- 'default' => '<p>You save: %you_save% (%you_save_percent%)</p>',
186
- 'type' => 'textarea',
187
- 'css' => 'width:30%;min-width:300px;',
188
- ),
189
-
190
- array(
191
- 'title' => '',
192
- 'desc_tip' => __( '"You save" information for products on sale.', 'woocommerce-jetpack' ),
193
- 'id' => 'wcj_product_info_on_archive_you_save_priority',
194
- 'default' => '<p>You save: %you_save% (%you_save_percent%)</p>',
195
- 'type' => 'number',
196
  ),
197
 
198
- array(
199
- 'title' => '',
200
- 'desc_tip' => __( 'Product\'s total sales counter.', 'woocommerce-jetpack' ),
201
- 'id' => 'wcj_product_info_on_archive_total_sales',
202
- 'default' => '<p>Total sales: %total_sales%</p>',
203
- 'type' => 'textarea',
204
- 'css' => 'width:30%;min-width:300px;',
205
- ),
206
-
207
- array(
208
- 'title' => '',
209
- 'desc_tip' => __( 'SKU.', 'woocommerce-jetpack' ),
210
- 'id' => 'wcj_product_info_on_archive_sku',
211
- 'default' => '<p>SKU: %sku%</p>',
212
- 'type' => 'textarea',
213
- 'css' => 'width:30%;min-width:300px;',
214
- ),
215
- */
216
-
217
  array(
218
  'title' => '',
219
  'desc' => __( 'Position', 'woocommerce-jetpack' ),
@@ -232,7 +546,7 @@ class WCJ_Product_Info {
232
  'id' => 'wcj_product_info_on_archive_filter_priority',
233
  'default' => 10,
234
  'type' => 'number',
235
- ),
236
 
237
  array(
238
  'title' => __( 'Product Info on Single Product Pages', 'woocommerce-jetpack' ),
@@ -244,13 +558,13 @@ class WCJ_Product_Info {
244
 
245
  array(
246
  'title' => '',
247
- 'desc_tip' => __( 'HTML info. Predefined: %total_sales%, %sku%', 'woocommerce-jetpack' ),
248
  'id' => 'wcj_product_info_on_single',
249
- 'default' => 'Total sales: %total_sales%',
250
  'type' => 'textarea',
251
- 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
252
  'custom_attributes'
253
- => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
254
  'css' => 'width:50%;min-width:300px;height:100px;',
255
  ),
256
 
@@ -325,8 +639,8 @@ class WCJ_Product_Info {
325
  ),
326
 
327
  array( 'type' => 'sectionend', 'id' => 'wcj_product_info_related_products_options' ),
328
-
329
- );
330
 
331
  return $settings;
332
  }
5
  * The WooCommerce Jetpack Product Info class.
6
  *
7
  * @class WCJ_Product_Info
8
+ * @version 1.3.0
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
34
  'woocommerce_single_product_summary' => __( 'Inside single product summary', 'woocommerce-jetpack' ),
35
  'woocommerce_before_single_product_summary' => __( 'Before single product summary', 'woocommerce-jetpack' ),
36
  'woocommerce_after_single_product_summary' => __( 'After single product summary', 'woocommerce-jetpack' ),
37
+ );
38
+
39
+ // List of product info short codes
40
+ $this->product_info_shortcodes_array = array(
41
+ '%sku%',
42
+ '%title%',
43
+ '%weight%',
44
+ '%sale_price%',
45
+ '%regular_price_if_on_sale%',
46
+ '%regular_price%',
47
+ '%price%',
48
+ '%price_including_tax%',
49
+ '%price_excluding_tax%',
50
+ '%tax_class%',
51
+ '%average_rating%',
52
+ '%categories%',
53
+ '%shipping_class%',
54
+ '%dimensions%',
55
+ '%formatted_name%',
56
+ '%stock_availability%',
57
+ '%total_sales%',
58
+ '%you_save%',
59
+ '%you_save_percent%',
60
+ '%sale_price_formatted%',
61
+ '%regular_price_if_on_sale_formatted%',
62
+ '%regular_price_formatted%',
63
+ '%price_formatted%',
64
+ '%price_including_tax_formatted%',
65
+ '%price_excluding_tax_formatted%',
66
+ '%you_save_formatted%',
67
+ '%time_since_last_sale%',
68
+ //'%available_variations%',
69
+ '%list_attributes%',
70
  );
71
 
72
  // Main hooks
73
+ if ( 'yes' === get_option( 'wcj_product_info_enabled' ) ) {
74
+ // Product Info
75
+ $this->add_product_info_filters( 'archive' );
76
+ $this->add_product_info_filters( 'single' );
77
+ // Related products
78
  if ( get_option( 'wcj_product_info_related_products_enable' ) === 'yes' ) {
79
  add_filter( 'woocommerce_related_products_args', array( $this, 'related_products_limit' ), 100 );
80
  add_filter( 'woocommerce_output_related_products_args', array( $this, 'related_products_limit_args' ), 100 );
81
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  }
83
 
84
  // Settings hooks
86
  add_filter( 'wcj_settings_product_info', array( $this, 'get_settings' ), 100 );
87
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
88
  }
89
+
90
  /**
91
+ * add_product_info_filters.
92
+ */
93
+ public function list_short_codes() {
94
+ //return __( 'Available short codes are:', 'woocommerce-jetpack' ) . ' ' . implode( ", ", $this->product_info_shortcodes_array );
95
+ return __( 'Available short codes are:', 'woocommerce-jetpack' ) . '<ul><li>' . implode( '</li><li>', $this->product_info_shortcodes_array ) . '</li></ul>';
96
+ }
97
 
98
+ /**
99
+ * add_product_info_filters.
100
+ */
101
+ public function add_product_info_filters( $single_or_archive ) {
102
+ // Product Info
103
+ if ( ( 'yes' === get_option( 'wcj_product_info_on_' . $single_or_archive . '_enabled' ) ) &&
104
+ ( '' != get_option( 'wcj_product_info_on_' . $single_or_archive ) ) &&
105
+ ( '' != get_option( 'wcj_product_info_on_' . $single_or_archive . '_filter' ) ) &&
106
+ ( '' != get_option( 'wcj_product_info_on_' . $single_or_archive . '_filter_priority' ) ) )
107
+ add_action( get_option( 'wcj_product_info_on_' . $single_or_archive . '_filter' ), array( $this, 'product_info' ), get_option( 'wcj_product_info_on_' . $single_or_archive . '_filter_priority' ) );
108
+ // More product Info
109
+ if ( 'yes' === get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_enabled' ) )
110
+ add_action( get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_filter' ), array( $this, 'more_product_info' ), get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_filter_priority' ) );
111
  }
112
 
113
  /**
114
  * product_info.
115
  */
116
  public function product_info() {
117
+ $the_action_name = current_filter();
118
+ if ( array_key_exists( $the_action_name, $this->product_info_on_archive_filters_array ) ) {
 
119
  $the_product_info = get_option( 'wcj_product_info_on_archive' );
120
+ $this->apply_product_info_short_codes( $the_product_info, false );
 
 
 
 
 
 
 
 
 
 
121
  }
122
+ else if ( array_key_exists( $the_action_name, $this->product_info_on_single_filters_array ) ) {
123
+ $the_product_info = get_option( 'wcj_product_info_on_single' );
124
+ $this->apply_product_info_short_codes( $the_product_info, false );
125
+ }
126
+ }
127
+
128
+ /**
129
+ * more_product_info.
130
+ */
131
+ public function more_product_info() {
132
+ $the_action_name = current_filter();
133
+ if ( array_key_exists( $the_action_name, $this->product_info_on_archive_filters_array ) )
134
+ $this->add_more_product_info( 'archive' );
135
+ else if ( array_key_exists( $the_action_name, $this->product_info_on_single_filters_array ) )
136
+ $this->add_more_product_info( 'single' );
137
  }
138
 
139
  /**
140
+ * add_more_product_info.
141
+ */
142
+ public function add_more_product_info( $single_or_archive ) {
143
+ //$single_or_archive = 'archive';
144
+ for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 4, get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_fields_total', 4 ) ); $i++ ) {
145
+ $field_id = 'wcj_more_product_info_on_' . $single_or_archive . '_' . $i ;
146
+ $the_product_info = get_option( $field_id );
147
+ $this->apply_product_info_short_codes( $the_product_info, true );
148
+ }
149
+ }
150
+
151
+ /**
152
+ * apply_product_info_short_codes.
153
+ */
154
+ public function apply_product_info_short_codes( $the_product_info, $remove_on_empty ) {
155
+ if ( '' == $the_product_info )
156
+ return;
157
+ foreach ( $this->product_info_shortcodes_array as $product_info_short_code ) {
158
+ if ( false !== strpos( $the_product_info, $product_info_short_code ) ) {
159
+ // We found short code in the text
160
+ $replace_with_phrase = $this->get_product_info_short_code( $product_info_short_code );
161
+ if ( false === $replace_with_phrase && true === $remove_on_empty ) {
162
+ // No phrase to replace exists, then empty the text and continue with next field
163
+ $the_product_info = '';
164
+ return;
165
+ }
166
+ else {
167
+ if ( false === $replace_with_phrase ) $replace_with_phrase = '';
168
+ // Replacing the short code
169
+ $the_product_info = str_replace( $product_info_short_code, $replace_with_phrase, $the_product_info );
170
+ }
171
+ }
172
+ }
173
+ echo $the_product_info;
174
+ }
175
+
176
+ /**
177
+ * get_product_info.
178
  */
179
+ public function get_product_info_short_code( $short_code ) {
180
+
181
+ global $product;
182
+
183
+ switch( $short_code ) {
184
+
185
+ case '%sku%':
186
+ return $product->get_sku();
187
+
188
+ case '%title%':
189
+ return $product->get_title();
190
+
191
+ case '%weight%':
192
+ if ( $product->has_weight() )
193
+ return $product->get_weight();
194
+ else
195
+ return false;
196
+
197
+ case '%sale_price%':
198
+ if ( $product->is_on_sale() )
199
+ return $product->get_sale_price();
200
+ else
201
+ return false;
202
+
203
+ case '%regular_price_if_on_sale%':
204
+ if ( $product->is_on_sale() )
205
+ return $product->get_regular_price();
206
+ else
207
+ return false;
208
+
209
+ case '%regular_price%':
210
+ return $product->get_regular_price();
211
+
212
+ case '%price%':
213
+ return $product->get_price();
214
+
215
+ case '%price_including_tax%':
216
+ return $product->get_price_including_tax();
217
+
218
+ case '%price_excluding_tax%':
219
+ return $product->get_price_excluding_tax();
220
+
221
+ case '%tax_class%':
222
+ return $product->get_tax_class();
223
+
224
+ case '%average_rating%':
225
+ return $product->get_average_rating();
226
+
227
+ case '%categories%':
228
+ return $product->get_categories();
229
+
230
+ case '%shipping_class%':
231
+ return $product->get_shipping_class();
232
+
233
+ case '%dimensions%':
234
+ if ( $product->has_dimensions() )
235
+ return $product->get_dimensions();
236
+ else
237
+ return false;
238
+
239
+ case '%formatted_name%':
240
+ return $product->get_formatted_name();
241
 
242
+ case '%stock_availability%':
243
+ $stock_availability_array = $product->get_availability();
244
+ if ( isset( $stock_availability_array['availability'] ) )
245
+ return $stock_availability_array['availability'];
246
+ else
247
+ return false;
248
+
249
+ case '%total_sales%':
250
+ $product_custom_fields = get_post_custom( $product->id );
251
+ if ( isset( $product_custom_fields['total_sales'][0] ) )
252
+ return $product_custom_fields['total_sales'][0];
253
+ else
254
+ return false;
255
+
256
+ case '%you_save%':
257
+ if ( $product->is_on_sale() )
258
+ return ( $product->get_regular_price() - $product->get_sale_price() );
259
+ else
260
+ return false;
261
+
262
+ case '%you_save_percent%':
263
+ if ( $product->is_on_sale() ) {
264
+ if ( 0 != $product->get_regular_price() ) {
265
+ $you_save = ( $product->get_regular_price() - $product->get_sale_price() );
266
+ return intval( $you_save / $product->get_regular_price() * 100 );
267
+ }
268
+ else
269
+ return false;
270
+ }
271
+ else
272
+ return false;
273
+
274
+ case '%sale_price_formatted%':
275
+ if ( $product->is_on_sale() )
276
+ return wc_price( $product->get_sale_price() );
277
+ else
278
+ return false;
279
+
280
+ case '%regular_price_if_on_sale_formatted%':
281
+ if ( $product->is_on_sale() )
282
+ return wc_price( $product->get_regular_price() );
283
+ else
284
+ return false;
285
+
286
+ case '%regular_price_formatted%':
287
+ return wc_price( $product->get_regular_price() );
288
+
289
+ case '%price_formatted%':
290
+ return wc_price( $product->get_price() );
291
+
292
+ case '%price_including_tax_formatted%':
293
+ return wc_price( $product->get_price_including_tax() );
294
+
295
+ case '%price_excluding_tax_formatted%':
296
+ return wc_price( $product->get_price_excluding_tax() );
297
+
298
+ case '%you_save_formatted%':
299
+ if ( $product->is_on_sale() )
300
+ return wc_price( $product->get_regular_price() - $product->get_sale_price() );
301
+ else
302
+ return false;
303
+
304
+ case '%time_since_last_sale%':
305
+ return $this->get_time_since_last_sale();
306
+
307
+ case '%list_attributes%':
308
+ if ( $product->has_attributes() )
309
+ return $product->list_attributes();
310
+ else
311
+ return false;
312
+
313
+ // Not finished!
314
+ case '%available_variations%':
315
+ if ( $product->is_type( 'variable' ) )
316
+ return print_r( $product->get_available_variations(), true );
317
+ else
318
+ return false;
319
+
320
+ default:
321
+ return false;
322
+ }
323
+
324
+ return false;
325
+ }
326
+
327
+ /**
328
+ * get_time_since_last_sale.
329
+ */
330
+ public function get_time_since_last_sale() {
331
+ // Constants
332
+ $days_to_cover = 90;
333
+ $do_use_only_completed_orders = true;
334
+ // Get the ID before new query
335
+ $the_ID = get_the_ID();
336
+ // Create args for new query
337
+ $args = array(
338
+ 'post_type' => 'shop_order',
339
+ 'post_status' => ( true === $do_use_only_completed_orders ? 'completed' : 'any' ),
340
+ 'posts_per_page' => -1,
341
+ 'orderby' => 'date',
342
+ 'order' => 'DESC',
343
+ 'date_query' => array( array( 'after' => strtotime( '-' . $days_to_cover . ' days' ) ) ),
344
+ );
345
+ // Run new query
346
+ $loop = new WP_Query( $args );
347
+ // Analyze the results, i.e. orders
348
+ while ( $loop->have_posts() ) : $loop->the_post();
349
+ $order = new WC_Order( $loop->post->ID );
350
+ $items = $order->get_items();
351
+ foreach ( $items as $item ) {
352
+ // Run through all order's items
353
+ if ( $item['product_id'] == $the_ID ) {
354
+ // Found sale!
355
+ $result = sprintf( __( '%s ago', 'woocommerce-jetpack' ), human_time_diff( get_the_time('U'), current_time('timestamp') ) );
356
+ wp_reset_query();
357
+ return $result;
358
+ }
359
+ }
360
+ endwhile;
361
+ wp_reset_query();
362
+ // No sales found
363
+ return false;
364
+ }
365
+
366
+ // RELATED PRODUCTS //
367
+
368
+ /**
369
+ * Change number of related products on product page.
370
+ */
371
+ function related_products_limit_args( $args ) {
372
  $args['posts_per_page'] = get_option( 'wcj_product_info_related_products_num' );
373
  $args['orderby'] = get_option( 'wcj_product_info_related_products_orderby' );
374
+ $args['columns'] = get_option( 'wcj_product_info_related_products_columns' );
 
375
  return $args;
376
  }
377
 
378
  /**
379
  * Change number of related products on product page.
380
  */
381
+ function related_products_limit( $args ) {
 
382
  $args['posts_per_page'] = get_option( 'wcj_product_info_related_products_num' );
383
  $args['orderby'] = get_option( 'wcj_product_info_related_products_orderby' );
384
+ if ( get_option( 'wcj_product_info_related_products_orderby' ) != 'rand' ) $args['order'] = get_option( 'wcj_product_info_related_products_order' );
 
385
  return $args;
386
  }
387
 
388
+ // ADMIN //
389
+
390
+ /**
391
+ * admin_add_product_info_fields_with_header.
392
+ */
393
+ function admin_add_product_info_fields_with_header( &$settings, $single_or_archive, $title, $filters_array ) {
394
+ $settings = array_merge( $settings, array(
395
+ array(
396
+ 'title' => $title,//__( 'Product Info on Archive Pages', 'woocommerce-jetpack' ),
397
+ 'desc' => __( 'Enable', 'woocommerce-jetpack' ),
398
+ 'id' => 'wcj_more_product_info_on_' . $single_or_archive . '_enabled',
399
+ 'default' => 'no',
400
+ 'type' => 'checkbox',
401
+ ),
402
+
403
+ array(
404
+ 'title' => '',
405
+ 'desc' => __( 'Position', 'woocommerce-jetpack' ),
406
+ 'id' => 'wcj_more_product_info_on_' . $single_or_archive . '_filter',
407
+ 'css' => 'min-width:350px;',
408
+ 'class' => 'chosen_select',
409
+ 'default' => 'woocommerce_after_shop_loop_item_title',
410
+ 'type' => 'select',
411
+ 'options' => $filters_array,// $this->product_info_on_archive_filters_array,
412
+ 'desc_tip' => true,
413
+ ),
414
+
415
+ array(
416
+ 'title' => '',
417
+ 'desc_tip' => __( 'Priority (i.e. Order)', 'woocommerce-jetpack' ),
418
+ 'id' => 'wcj_more_product_info_on_' . $single_or_archive . '_filter_priority',
419
+ 'default' => 10,
420
+ 'type' => 'number',
421
+ ),
422
+
423
+ array(
424
+ 'title' => '',
425
+ 'desc_tip' => __( 'Number of product info fields. Click "Save changes" after you change this number.', 'woocommerce-jetpack' ),
426
+ 'id' => 'wcj_more_product_info_on_' . $single_or_archive . '_fields_total',
427
+ 'default' => 4,
428
+ 'type' => 'number',
429
+ 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
430
+ 'custom_attributes'
431
+ => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
432
+ ),
433
+ ) );
434
+
435
+ $this->admin_add_product_info_fields( $settings, $single_or_archive );
436
+ }
437
+
438
+ /**
439
+ * admin_add_product_info_fields.
440
+ */
441
+ function admin_add_product_info_fields( &$settings, $single_or_archive ) {
442
+ //$single_or_archive = 'archive';
443
+ for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 4, get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_fields_total', 4 ) ); $i++ ) {
444
+ $field_id = 'wcj_more_product_info_on_' . $single_or_archive . '_' . $i ;
445
+ $default_value = '';
446
+ switch ( $i ) {
447
+ case 1: $default_value = '<ul>'; break;
448
+ case 2: $default_value = '<li>' . __( 'You save: <strong>%you_save_formatted%</strong> (%you_save_percent%%)', 'woocommerce-jetpack' ) . '</li>'; break;
449
+ case 3: $default_value = '<li>' . __( 'Total sales: %total_sales%', 'woocommerce-jetpack' ) . '</li>'; break;
450
+ case 4: $default_value = '</ul>'; break;
451
+ }
452
+ $desc = ( '' != $default_value ) ? __( 'Default', 'woocommerce-jetpack' ) . ': ' . esc_html( $default_value ) : '';
453
+ $short_codes_list = '%you_save%, %total_sales%';
454
+ $desc_tip = __( 'Field Nr. ', 'woocommerce-jetpack' ) . $i . '<br>' . __( 'Available short codes: ', 'woocommerce-jetpack' ) . $short_codes_list;
455
+ $settings[] = array(
456
+ 'title' => '',
457
+ //'desc_tip' => $desc_tip,
458
+ //'desc' => $desc,
459
+ 'id' => $field_id,
460
+ 'default' => $default_value,
461
+ 'type' => 'textarea',
462
+ 'css' => 'width:50%;min-width:300px;',
463
+ );
464
+ }
465
+ }
466
+
467
+ /**
468
+ * Return feature's enable/disable option.
469
+ */
470
+ public function add_enabled_option( $settings ) {
471
+ $all_settings = $this->get_settings();
472
+ $settings[] = $all_settings[1];
473
+ return $settings;
474
+ }
475
+
476
  /**
477
  * Get settings.
478
  */
480
 
481
  $settings = array(
482
 
483
+ // Product Info Options - Global
484
  array( 'title' => __( 'Product Info Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_product_info_options' ),
485
 
486
  array(
492
  'type' => 'checkbox',
493
  ),
494
 
495
+ array( 'type' => 'sectionend', 'id' => 'wcj_product_info_options' ),
496
 
497
+ // More Product Info
498
+ array( 'title' => __( 'More Products Info', 'woocommerce-jetpack' ), 'type' => 'title',
499
+ 'desc' => __( 'For full list of short codes, please visit <a target="_blank" href="http://woojetpack.com/features/product-info/">http://woojetpack.com/features/product-info/</a>', 'woocommerce-jetpack' ),
500
+ //'desc' => $this->list_short_codes(),
501
+ 'id' => 'wcj_more_product_info_options' ),
502
+ );
503
+
504
+ $this->admin_add_product_info_fields_with_header( $settings, 'archive', __( 'Product Info on Archive Pages', 'woocommerce-jetpack' ), $this->product_info_on_archive_filters_array );
505
+ $this->admin_add_product_info_fields_with_header( $settings, 'single', __( 'Product Info on Single Pages', 'woocommerce-jetpack' ), $this->product_info_on_single_filters_array );
506
+
507
+ $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_more_product_info_options' );
508
+
509
+ $settings = array_merge( $settings, array(
510
+
511
+ // More Product Info - "Constant" modification
512
+ array( 'title' => __( 'Even More Products Info', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_product_info_additional_options' ),
513
 
514
  array(
515
  'title' => __( 'Product Info on Archive Pages', 'woocommerce-jetpack' ),
518
  'default' => 'no',
519
  'type' => 'checkbox',
520
  ),
521
+
522
  array(
523
  'title' => '',
524
+ 'desc_tip' => __( 'HTML info.', 'woocommerce-jetpack' ),
525
  'id' => 'wcj_product_info_on_archive',
526
+ 'default' => __( 'SKU: %sku%', 'woocommerce-jetpack' ),
527
  'type' => 'textarea',
528
  'css' => 'width:50%;min-width:300px;height:100px;',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
529
  ),
530
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
531
  array(
532
  'title' => '',
533
  'desc' => __( 'Position', 'woocommerce-jetpack' ),
546
  'id' => 'wcj_product_info_on_archive_filter_priority',
547
  'default' => 10,
548
  'type' => 'number',
549
+ ),
550
 
551
  array(
552
  'title' => __( 'Product Info on Single Product Pages', 'woocommerce-jetpack' ),
558
 
559
  array(
560
  'title' => '',
561
+ 'desc_tip' => __( 'HTML info.', 'woocommerce-jetpack' ),// . ' ' . $this->list_short_codes(),
562
  'id' => 'wcj_product_info_on_single',
563
+ 'default' => __( 'Total sales: %total_sales%', 'woocommerce-jetpack' ),
564
  'type' => 'textarea',
565
+ /*'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
566
  'custom_attributes'
567
+ => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),*/
568
  'css' => 'width:50%;min-width:300px;height:100px;',
569
  ),
570
 
639
  ),
640
 
641
  array( 'type' => 'sectionend', 'id' => 'wcj_product_info_related_products_options' ),
642
+
643
+ ) );
644
 
645
  return $settings;
646
  }
includes/class-wcj-product-listings.php CHANGED
@@ -5,7 +5,7 @@
5
  * The WooCommerce Jetpack Product Listings class.
6
  *
7
  * @class WCJ_Product_Listings
8
- * @version 1.1.0
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
@@ -77,7 +77,7 @@ class WCJ_Product_Listings {
77
  ),
78
 
79
  array(
80
- 'title' => __( 'Exclude Categories', 'woocommerce-jetpack' ),
81
  'desc_tip' => __(' Excludes one or more categories from the shop page. This parameter takes a comma-separated list of categories by unique ID, in ascending order. Leave blank to disable.', 'woocommerce-jetpack' ),
82
  'id' => 'wcj_product_listings_exclude_cats_on_shop',
83
  'default' => '',
@@ -86,12 +86,20 @@ class WCJ_Product_Listings {
86
  ),
87
 
88
  array(
89
- 'title' => __( 'Hide Empty', 'woocommerce-jetpack' ),
90
  'desc' => __( 'Hide empty categories on shop page', 'woocommerce-jetpack' ),
91
  'id' => 'wcj_product_listings_hide_empty_cats_on_shop',
92
  'default' => 'yes',
93
  'type' => 'checkbox',
94
  ),
 
 
 
 
 
 
 
 
95
 
96
  array( 'type' => 'sectionend', 'id' => 'wcj_product_listings_shop_page_options' ),
97
 
@@ -123,6 +131,14 @@ class WCJ_Product_Listings {
123
  'default' => 'yes',
124
  'type' => 'checkbox',
125
  ),
 
 
 
 
 
 
 
 
126
 
127
  array( 'type' => 'sectionend', 'id' => 'wcj_product_listings_archive_pages_options' ),
128
  );
@@ -175,7 +191,14 @@ class WCJ_Product_Listings {
175
  'default' => 'yes',
176
  'type' => 'checkbox',
177
  );
178
-
 
 
 
 
 
 
 
179
  }
180
 
181
  if ( isset( $section['id'] ) && 'woocommerce_category_archive_display' == $section['id'] ) {
@@ -206,6 +229,14 @@ class WCJ_Product_Listings {
206
  'default' => 'yes',
207
  'type' => 'checkbox',
208
  );
 
 
 
 
 
 
 
 
209
  }
210
  }
211
 
@@ -237,16 +268,40 @@ class WCJ_Product_Listings {
237
  return $args;
238
  }
239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  /**
241
  * filter_subcategories_show_empty.
242
  */
243
  public function filter_subcategories_show_empty() {
 
 
 
 
244
  $show_empty = false;
245
  if ( is_shop() )
246
  $show_empty = ( 'yes' === get_option( 'wcj_product_listings_hide_empty_cats_on_shop' ) ) ? false : true;
247
  else
248
  $show_empty = ( 'yes' === get_option( 'wcj_product_listings_hide_empty_cats_on_archives' ) ) ? false : true;
249
-
250
  return $show_empty;
251
  }
252
  }
5
  * The WooCommerce Jetpack Product Listings class.
6
  *
7
  * @class WCJ_Product_Listings
8
+ * @version 1.2.0
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
77
  ),
78
 
79
  array(
80
+ 'title' => __( 'Exclude Categories', 'woocommerce-jetpack' ),
81
  'desc_tip' => __(' Excludes one or more categories from the shop page. This parameter takes a comma-separated list of categories by unique ID, in ascending order. Leave blank to disable.', 'woocommerce-jetpack' ),
82
  'id' => 'wcj_product_listings_exclude_cats_on_shop',
83
  'default' => '',
86
  ),
87
 
88
  array(
89
+ 'title' => __( 'Hide Empty', 'woocommerce-jetpack' ),
90
  'desc' => __( 'Hide empty categories on shop page', 'woocommerce-jetpack' ),
91
  'id' => 'wcj_product_listings_hide_empty_cats_on_shop',
92
  'default' => 'yes',
93
  'type' => 'checkbox',
94
  ),
95
+
96
+ array(
97
+ 'title' => __( 'Show Products', 'woocommerce-jetpack' ),
98
+ 'desc' => __( 'Show products if no categories are displayed on shop page', 'woocommerce-jetpack' ),
99
+ 'id' => 'wcj_product_listings_show_products_if_no_cats_on_shop',
100
+ 'default' => 'yes',
101
+ 'type' => 'checkbox',
102
+ ),
103
 
104
  array( 'type' => 'sectionend', 'id' => 'wcj_product_listings_shop_page_options' ),
105
 
131
  'default' => 'yes',
132
  'type' => 'checkbox',
133
  ),
134
+
135
+ array(
136
+ 'title' => __( 'Show Products', 'woocommerce-jetpack' ),
137
+ 'desc' => __( 'Show products if no categories are displayed on category page', 'woocommerce-jetpack' ),
138
+ 'id' => 'wcj_product_listings_show_products_if_no_cats_on_archives',
139
+ 'default' => 'yes',
140
+ 'type' => 'checkbox',
141
+ ),
142
 
143
  array( 'type' => 'sectionend', 'id' => 'wcj_product_listings_archive_pages_options' ),
144
  );
191
  'default' => 'yes',
192
  'type' => 'checkbox',
193
  );
194
+
195
+ $updated_settings[] = array(
196
+ 'title' => __( 'WooJetpack: Show Products', 'woocommerce-jetpack' ),
197
+ 'desc' => __( 'Show products if no categories are displayed on shop page', 'woocommerce-jetpack' ),
198
+ 'id' => 'wcj_product_listings_show_products_if_no_cats_on_shop',
199
+ 'default' => 'yes',
200
+ 'type' => 'checkbox',
201
+ );
202
  }
203
 
204
  if ( isset( $section['id'] ) && 'woocommerce_category_archive_display' == $section['id'] ) {
229
  'default' => 'yes',
230
  'type' => 'checkbox',
231
  );
232
+
233
+ $updated_settings[] = array(
234
+ 'title' => __( 'WooJetpack: Show Products', 'woocommerce-jetpack' ),
235
+ 'desc' => __( 'Show products if no categories are displayed on category page', 'woocommerce-jetpack' ),
236
+ 'id' => 'wcj_product_listings_show_products_if_no_cats_on_archives',
237
+ 'default' => 'yes',
238
+ 'type' => 'checkbox',
239
+ );
240
  }
241
  }
242
 
268
  return $args;
269
  }
270
 
271
+ /**
272
+ * hide_products_by_disabling_loop.
273
+ */
274
+ public function hide_products_by_disabling_loop() {
275
+ // If we are hiding products disable the loop and pagination
276
+ global $wp_query;
277
+ if ( is_product_category() &&
278
+ get_option( 'woocommerce_category_archive_display' ) == 'subcategories' &&
279
+ 'no' === get_option( 'wcj_product_listings_show_products_if_no_cats_on_archives' ) ) {
280
+ $wp_query->post_count = 0;
281
+ $wp_query->max_num_pages = 0;
282
+ }
283
+ if ( is_shop() &&
284
+ get_option( 'woocommerce_shop_page_display' ) == 'subcategories' &&
285
+ 'no' === get_option( 'wcj_product_listings_show_products_if_no_cats_on_shop' ) ) {
286
+ $wp_query->post_count = 0;
287
+ $wp_query->max_num_pages = 0;
288
+ }
289
+ }
290
+
291
  /**
292
  * filter_subcategories_show_empty.
293
  */
294
  public function filter_subcategories_show_empty() {
295
+
296
+ // Not the best solution, but it's the only place I found to put it...
297
+ $this->hide_products_by_disabling_loop();
298
+
299
  $show_empty = false;
300
  if ( is_shop() )
301
  $show_empty = ( 'yes' === get_option( 'wcj_product_listings_hide_empty_cats_on_shop' ) ) ? false : true;
302
  else
303
  $show_empty = ( 'yes' === get_option( 'wcj_product_listings_hide_empty_cats_on_archives' ) ) ? false : true;
304
+
305
  return $show_empty;
306
  }
307
  }
includes/class-wcj-product-tabs.php CHANGED
@@ -5,7 +5,7 @@
5
  * The WooCommerce Jetpack Product Tabs class.
6
  *
7
  * @class WCJ_Product_Tabs
8
- * @version 1.0.0
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
@@ -92,13 +92,13 @@ class WCJ_Product_Tabs {
92
  $key = 'local_' . $i;
93
 
94
  $tab_priority = get_post_meta( $current_post_id, '_' . 'wcj_custom_product_tabs_priority_' . $key, true );
95
- if ( ! $tab_prority )
96
- $tab_prority = (50 + $i - 1);
97
 
98
  if ( '' != get_post_meta( $current_post_id, '_' . 'wcj_custom_product_tabs_title_' . $key, true ) && '' != get_post_meta( $current_post_id, '_' . 'wcj_custom_product_tabs_content_' . $key, true ) )
99
  $tabs[ $key ] = array(
100
  'title' => get_post_meta( $current_post_id, '_' . 'wcj_custom_product_tabs_title_' . $key, true ),
101
- 'priority' => $tab_prority,
102
  'callback' => array( $this, 'create_new_custom_product_tab_local' ),
103
  );
104
  }
@@ -164,7 +164,11 @@ class WCJ_Product_Tabs {
164
  $html .= __( 'Total number of custom tabs', 'woocommerce-jetpack' );
165
  $html .= '</th>';
166
  $html .= '<td>';
167
- $html .= '<input type="number" id="' . $option_name . '" name="' . $option_name . '" value="' . $total_custom_tabs . '" ' . $is_disabled . '> ' . $is_disabled_message;
 
 
 
 
168
  $html .= '</td>';
169
  $html .= '</tr>';
170
  $html .= '</table>';
@@ -194,8 +198,8 @@ class WCJ_Product_Tabs {
194
  foreach ( $options as $option ) {
195
  $option_id = $option['id'] . $i;
196
  $option_value = get_post_meta( $current_post_id, '_' . $option_id, true );
197
- /*if ( ! $option_value )
198
- $option_value = get_option( $option['id'] . 'default', '' );*/
199
  $html .= '<th>' . $option['title'] . '</th>';
200
  if ( 'textarea' === $option['type'] )
201
  $html .= '<td style="width:30%;">';
@@ -261,6 +265,7 @@ class WCJ_Product_Tabs {
261
 
262
  array(
263
  'title' => __( 'Custom Product Tabs Number', 'woocommerce-jetpack' ),
 
264
  'id' => 'wcj_custom_product_tabs_global_total_number',
265
  'default' => 1,
266
  'type' => 'number',
@@ -354,56 +359,56 @@ class WCJ_Product_Tabs {
354
  'id' => 'wcj_product_info_product_tabs_description_title',
355
  'default' => '',
356
  'type' => 'text',
357
- ),
358
-
359
  array(
360
- 'title' => __( 'Reviews Tab', 'woocommerce-jetpack' ),
361
  'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
362
- 'id' => 'wcj_product_info_product_tabs_reviews_disable',
363
  'default' => 'no',
364
  'type' => 'checkbox',
365
  ),
366
-
367
  array(
368
  'title' => __( 'Priority (i.e. Order)', 'woocommerce-jetpack' ),
369
- 'id' => 'wcj_product_info_product_tabs_reviews_priority',
370
  'default' => 20,
371
  'type' => 'number',
372
  'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
373
  'custom_attributes'
374
  => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
375
  ),
376
-
377
  array(
378
  'title' => __( 'Title', 'woocommerce-jetpack' ),
379
- 'desc_tip' => __( 'Leave blank for WooCommerce defaults', 'woocommerce-jetpack' ),
380
- 'id' => 'wcj_product_info_product_tabs_reviews_title',
381
  'default' => '',
382
  'type' => 'text',
383
  ),
384
-
385
  array(
386
- 'title' => __( 'Additional Information Tab', 'woocommerce-jetpack' ),
387
  'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
388
- 'id' => 'wcj_product_info_product_tabs_additional_information_disable',
389
  'default' => 'no',
390
  'type' => 'checkbox',
391
  ),
392
-
393
  array(
394
  'title' => __( 'Priority (i.e. Order)', 'woocommerce-jetpack' ),
395
- 'id' => 'wcj_product_info_product_tabs_additional_information_priority',
396
  'default' => 30,
397
  'type' => 'number',
398
  'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
399
  'custom_attributes'
400
  => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
401
  ),
402
-
403
  array(
404
  'title' => __( 'Title', 'woocommerce-jetpack' ),
405
- 'desc_tip' => __( 'Leave blank for WooCommerce defaults', 'woocommerce-jetpack' ),
406
- 'id' => 'wcj_product_info_product_tabs_additional_information_title',
407
  'default' => '',
408
  'type' => 'text',
409
  ),
5
  * The WooCommerce Jetpack Product Tabs class.
6
  *
7
  * @class WCJ_Product_Tabs
8
+ * @version 1.1.0
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
92
  $key = 'local_' . $i;
93
 
94
  $tab_priority = get_post_meta( $current_post_id, '_' . 'wcj_custom_product_tabs_priority_' . $key, true );
95
+ if ( ! $tab_priority )
96
+ $tab_priority = (50 + $i - 1);
97
 
98
  if ( '' != get_post_meta( $current_post_id, '_' . 'wcj_custom_product_tabs_title_' . $key, true ) && '' != get_post_meta( $current_post_id, '_' . 'wcj_custom_product_tabs_content_' . $key, true ) )
99
  $tabs[ $key ] = array(
100
  'title' => get_post_meta( $current_post_id, '_' . 'wcj_custom_product_tabs_title_' . $key, true ),
101
+ 'priority' => $tab_priority,
102
  'callback' => array( $this, 'create_new_custom_product_tab_local' ),
103
  );
104
  }
164
  $html .= __( 'Total number of custom tabs', 'woocommerce-jetpack' );
165
  $html .= '</th>';
166
  $html .= '<td>';
167
+ $html .= '<input type="number" id="' . $option_name . '" name="' . $option_name . '" value="' . $total_custom_tabs . '" ' . $is_disabled . '>';
168
+ $html .= '</td>';
169
+ $html .= '<td>';
170
+ $html .= __( 'Click "Update" product after you change this number.', 'woocommerce-jetpack' ) . '<br>' . $is_disabled_message;
171
+ $html .= '</td>';
172
  $html .= '</td>';
173
  $html .= '</tr>';
174
  $html .= '</table>';
198
  foreach ( $options as $option ) {
199
  $option_id = $option['id'] . $i;
200
  $option_value = get_post_meta( $current_post_id, '_' . $option_id, true );
201
+ if ( ! $option_value && 'wcj_custom_product_tabs_priority_local_' == $option['id'] )
202
+ $option_value = 50;
203
  $html .= '<th>' . $option['title'] . '</th>';
204
  if ( 'textarea' === $option['type'] )
205
  $html .= '<td style="width:30%;">';
265
 
266
  array(
267
  'title' => __( 'Custom Product Tabs Number', 'woocommerce-jetpack' ),
268
+ 'desc_tip' => __( 'Click "Save changes" after you change this number.', 'woocommerce-jetpack' ),
269
  'id' => 'wcj_custom_product_tabs_global_total_number',
270
  'default' => 1,
271
  'type' => 'number',
359
  'id' => 'wcj_product_info_product_tabs_description_title',
360
  'default' => '',
361
  'type' => 'text',
362
+ ),
363
+
364
  array(
365
+ 'title' => __( 'Additional Information Tab', 'woocommerce-jetpack' ),
366
  'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
367
+ 'id' => 'wcj_product_info_product_tabs_additional_information_disable',
368
  'default' => 'no',
369
  'type' => 'checkbox',
370
  ),
371
+
372
  array(
373
  'title' => __( 'Priority (i.e. Order)', 'woocommerce-jetpack' ),
374
+ 'id' => 'wcj_product_info_product_tabs_additional_information_priority',
375
  'default' => 20,
376
  'type' => 'number',
377
  'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
378
  'custom_attributes'
379
  => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
380
  ),
381
+
382
  array(
383
  'title' => __( 'Title', 'woocommerce-jetpack' ),
384
+ 'desc_tip' => __( 'Leave blank for WooCommerce defaults', 'woocommerce-jetpack' ),
385
+ 'id' => 'wcj_product_info_product_tabs_additional_information_title',
386
  'default' => '',
387
  'type' => 'text',
388
  ),
389
+
390
  array(
391
+ 'title' => __( 'Reviews Tab', 'woocommerce-jetpack' ),
392
  'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
393
+ 'id' => 'wcj_product_info_product_tabs_reviews_disable',
394
  'default' => 'no',
395
  'type' => 'checkbox',
396
  ),
397
+
398
  array(
399
  'title' => __( 'Priority (i.e. Order)', 'woocommerce-jetpack' ),
400
+ 'id' => 'wcj_product_info_product_tabs_reviews_priority',
401
  'default' => 30,
402
  'type' => 'number',
403
  'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
404
  'custom_attributes'
405
  => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
406
  ),
407
+
408
  array(
409
  'title' => __( 'Title', 'woocommerce-jetpack' ),
410
+ 'desc_tip' => __( 'Leave blank for WooCommerce defaults', 'woocommerce-jetpack' ),
411
+ 'id' => 'wcj_product_info_product_tabs_reviews_title',
412
  'default' => '',
413
  'type' => 'text',
414
  ),
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,email pdf invoice,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,auto-complete all orders,custom order statuses,custom order status,remove text from price,custom css,hide categories count,hide subcategories count,hide category count,hide subcategory count,display total sales,custom product tabs,remove product tab,
5
  Requires at least: 3.9.1
6
  Tested up to: 4.0
7
- Stable tag: 1.8.1
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -27,7 +27,7 @@ WooCommerce Jetpack is a WordPress plugin that supercharges your site with aweso
27
  * Shipping - Hide shipping when free is available.
28
  * Emails - Add another email recipient(s) to all WooCommerce emails.
29
  * Product Listings - Change display options for shop and category pages: show/hide categories count, exclude categories, show/hide empty categories.
30
- * Product Info - Add additional info to product. Change related products number.
31
  * Product Tabs - Add custom product tabs - globally or per product. Customize or completely remove WooCommerce default product tabs.
32
  * Cart - Add "Empty Cart" button to cart page, automatically add product to cart on visit.
33
  * Add to Cart - Change text for add to cart buttons for each product type. Display "Product already in cart" instead of "Add to cart" button. Redirect add to cart button to any url (e.g. checkout page).
@@ -69,8 +69,8 @@ Please let us know if you want anything added to list by <a href="http://woojetp
69
 
70
  If you wish that some task would go up the queue to make it faster, please contact us by <a href="http://woojetpack.com/contact-us/">filling this form</a>. We are listening carefully to our users!
71
 
72
- = 1.9.0 - XX/10/2014 =
73
- * Fix - Crash report - https://wordpress.org/support/topic/crash-15?replies=2#post-
74
  * Upgrade Feature - PDF Invoices - Make emailing PDF as attachment option available for certain payment methods only (user selection). Idea by Jen.
75
  * Upgrade Feature - PDF Invoices - Sending invoice on customer's request. Idea by Jen.
76
  * Upgrade Feature - PDF Invoices - Bilingual invoice. Idea by Tudor Mateescu.
@@ -80,11 +80,11 @@ If you wish that some task would go up the queue to make it faster, please conta
80
  * Upgrade Feature - Checkout - Extra fee (e.g. for PayPal). Idea by Daniele.
81
  * Product Info on Archive Pages option within WooJetpack to list the different colour variations of a product on the category sections. Idea by Tony.
82
  * New Feature - Custom Product Input Fields - Fields to fill before adding product to cart. Idea by Mangesh.
83
- * New Feature - Smart Reports - Various reports based on products prices, sales, stock, customers.
 
84
  * New Feature - Add second currency to the price.
85
-
86
- = 1.X.X - XX/11/2014 =
87
-
88
  * New Feature - Products per Page - Add "products per page" option for customers (i.e. front end).
89
  * Upgrade Feature - Shipping - Add "Custom Shipping Method".
90
  * Upgrade Feature - PDF Invoices - Separate numbering for invoices option, then can add `add_order_number_to_invoice` option.
@@ -92,7 +92,6 @@ If you wish that some task would go up the queue to make it faster, please conta
92
  * Upgrade Feature - Product Info - Add widget.
93
  * Upgrade Feature - Product Info - Today's deal.
94
  * Upgrade Feature - Product Info - Images for variations.
95
- * Upgrade Feature - Product Info - Add `%time_since_last_sale%`.
96
  * Upgrade Feature - Orders - Custom Order Statuses - Add options for selecting icons and color.
97
  * Upgrade Feature - Smart Reports - Export to CSV file.
98
  * Upgrade Feature - Call for Price - Call for price for variable products (all variations or only some).
@@ -103,47 +102,40 @@ If you wish that some task would go up the queue to make it faster, please conta
103
  * Upgrade Feature - Checkout - Custom checkout fields.
104
  * Upgrade Feature - Orders - Maximum weight - "Contact us" to place order with products total weight over some amount.
105
  * Upgrade Feature - Sorting - Add sorting by popularity in e.g. 90 days (not by `total_sales` as it is by default in WooCommerce).
106
- * New Feature - Integrating Amazon FBA inventory into WooCommerce.
107
- Program that feeds the product information and pictures from Amazon to WooCommerce.
108
- Also something that updates inventory between the two.
109
- Programs like SellerActive and BigCommerce come close, but don't do everything.
110
- Idea by Dave.
111
-
112
- = 2.0.0 - 30/11/2014 =
113
- * Dev - Move all to `WooCommerce > Jetpack` menu.
114
- * Dev - Major source code, documentation, locking mechanism etc. recheck.
115
- Maybe rename "Features" to "Modules".
116
- * Dev - Add "Restore Defaults" option (will also need to delete/reset some meta data (e.g. price labels) for all posts).
117
-
118
- = More Ideas =
119
- * Different prices for different countries (WPML?). Suggested by Daniele.
120
- * Ideas by Jean-Marc:
121
- - PDF invoice: Sequential invoice numbers: different than the order number. could use woocomerce santard order number and special invoice number,
122
- - Choose starting point for invoice numbers,
123
- - Proforma invoicing (change title to proforma invoice),
124
- - Add additional company information with html tags like `<strong>`...,
125
- - Add refunds policies, conditions...,
126
- - Customizable invoice template.
127
- - More: Packing Slip Option (without prices because Packing Slip is not Invoice),
128
- - Customizable Packing Slip template.
129
- - Orders: Customer VAT Number field (very useful in Europa).
130
- * Add pdf packing slips (also be attached to the admin new order email). Idea by Ron.
131
 
132
  == Changelog ==
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  = 1.8.1 - 24/10/2014 =
135
  * Fix - PDF Invoices - Variation(s) name was not showing in invoice, fixed.
136
- Reported by https://wordpress.org/support/topic/item-description?replies=4
137
  * Feature Upgraded - PDF Invoices - Now shortcodes are displayed in invoice's additional header and footer.
138
- Idea by https://wordpress.org/support/topic/displaying-short-codes?replies=3
139
  * Feature Upgraded - PDF Invoices - Additional header option added.
140
  * Feature Upgraded - PDF Invoices - *Item Name Additional Info* (e.g. SKU) option added to invoice.
141
- Idea by https://wordpress.org/support/topic/item-description?replies=4
142
 
143
  = 1.8.0 - 17/10/2014 =
144
  * New Feature - Product Tabs - **Custom product tabs** - global or per product.
145
  Related *product tabs* options were also moved to this feature from *Product Info*.
146
- * Dev - `date` function changed to `date_i18n`. Suggested in https://wordpress.org/support/topic/pdf-invoices-date-bug.
147
  Changes affected the *Orders* and *PDF Invoices* features (this covers request from Jean-Marc for international date formats in *PDF Invoices*).
148
 
149
  = 1.7.9 - 16/10/2014 =
@@ -190,7 +182,7 @@ If you wish that some task would go up the queue to make it faster, please conta
190
  = 1.7.1 - 02/10/2014 =
191
  * Fix - Product Info - `%total_sales%` is temporary disabled.
192
  This was causing "PHP Parse error" on some servers (PHP 5.3), now fixed. Reported by Xavier.
193
- Also reported in https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-expecting-2.
194
 
195
  = 1.7.0 - 02/10/2014 =
196
  * Fix - Payment Gateways - Instructions were not showing (suggested by Jen), fixed.
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,email pdf invoice,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,auto-complete all orders,custom order statuses,custom order status,remove text from price,custom css,hide categories count,hide subcategories count,hide category count,hide subcategory count,display total sales,custom product tabs,remove product tab,
5
  Requires at least: 3.9.1
6
  Tested up to: 4.0
7
+ Stable tag: 1.8.2
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
27
  * Shipping - Hide shipping when free is available.
28
  * Emails - Add another email recipient(s) to all WooCommerce emails.
29
  * Product Listings - Change display options for shop and category pages: show/hide categories count, exclude categories, show/hide empty categories.
30
+ * Product Info - Add more info to product on category or single pages. Change related products number.
31
  * Product Tabs - Add custom product tabs - globally or per product. Customize or completely remove WooCommerce default product tabs.
32
  * Cart - Add "Empty Cart" button to cart page, automatically add product to cart on visit.
33
  * Add to Cart - Change text for add to cart buttons for each product type. Display "Product already in cart" instead of "Add to cart" button. Redirect add to cart button to any url (e.g. checkout page).
69
 
70
  If you wish that some task would go up the queue to make it faster, please contact us by <a href="http://woojetpack.com/contact-us/">filling this form</a>. We are listening carefully to our users!
71
 
72
+ = The list =
73
+
74
  * Upgrade Feature - PDF Invoices - Make emailing PDF as attachment option available for certain payment methods only (user selection). Idea by Jen.
75
  * Upgrade Feature - PDF Invoices - Sending invoice on customer's request. Idea by Jen.
76
  * Upgrade Feature - PDF Invoices - Bilingual invoice. Idea by Tudor Mateescu.
80
  * Upgrade Feature - Checkout - Extra fee (e.g. for PayPal). Idea by Daniele.
81
  * Product Info on Archive Pages option within WooJetpack to list the different colour variations of a product on the category sections. Idea by Tony.
82
  * New Feature - Custom Product Input Fields - Fields to fill before adding product to cart. Idea by Mangesh.
83
+ * Upgrade Feature - PDF Invoices - Shipping labels. Suggested by Glenda.
84
+ * New Feature - Different prices for different countries. Suggested by Illona.
85
  * New Feature - Add second currency to the price.
86
+ * New Feature - Smart Reports - Various reports based on products prices, sales, stock, customers.
87
+ * New Feature - Set SKUs as product IDs.
 
88
  * New Feature - Products per Page - Add "products per page" option for customers (i.e. front end).
89
  * Upgrade Feature - Shipping - Add "Custom Shipping Method".
90
  * Upgrade Feature - PDF Invoices - Separate numbering for invoices option, then can add `add_order_number_to_invoice` option.
92
  * Upgrade Feature - Product Info - Add widget.
93
  * Upgrade Feature - Product Info - Today's deal.
94
  * Upgrade Feature - Product Info - Images for variations.
 
95
  * Upgrade Feature - Orders - Custom Order Statuses - Add options for selecting icons and color.
96
  * Upgrade Feature - Smart Reports - Export to CSV file.
97
  * Upgrade Feature - Call for Price - Call for price for variable products (all variations or only some).
102
  * Upgrade Feature - Checkout - Custom checkout fields.
103
  * Upgrade Feature - Orders - Maximum weight - "Contact us" to place order with products total weight over some amount.
104
  * Upgrade Feature - Sorting - Add sorting by popularity in e.g. 90 days (not by `total_sales` as it is by default in WooCommerce).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
  == Changelog ==
107
 
108
+ = 1.8.2 - 01/11/2014 =
109
+ * Fix - Orders - Custom Order Statuses - Bug causing fail on changing status with slug more that 17 characters, fixed. Reported by Patryk.
110
+ * Fix - Product Tabs - Priority was not working in custom local tabs, fixed.
111
+ Also added default priority in custom local product tabs.
112
+ * Fix - *Settings* link in *WooCommerce > Jetpack Settings* was wrong, fixed.
113
+ This caused bug, where on non-root WordPress instalations *Settings* link gave 404 error. Reported by Brian.
114
+ * Fix - Product Tabs - Wrong default priority for WooCommerce Standard Product Tabs, fixed.
115
+ *Reviews Tab* priority was 20 (wrong), changed to 30 (good), *Additional Information Tab* 30 and 20 accordingly. Reported by Patryk.
116
+ * Feature Upgraded - Product Info - Major upgrade: added new info options with separate lines.
117
+ Also added about 20 new short codes, including:
118
+ %price%, %price_excluding_tax% (suggested by Josh),
119
+ %stock_availability% (by https://wordpress.org/support/topic/custom-tabs-1),
120
+ %time_since_last_sale%, %weight%, %list_attributes% etc.
121
+ For full list of short codes, please visit http://woojetpack.com/features/product-info/
122
+ * Feature Upgraded - Product Listings - Option to change default WooCommece behavior on displaying all products if none categories are dispalyed.
123
+ Now it's possible to disable displaying the products. Suggested by Xavier.
124
+ * Feature Upgraded - PDF Invoices - Order date and time added. Suggested by https://wordpress.org/support/topic/order-time
125
+
126
  = 1.8.1 - 24/10/2014 =
127
  * Fix - PDF Invoices - Variation(s) name was not showing in invoice, fixed.
128
+ Reported by https://wordpress.org/support/topic/item-description
129
  * Feature Upgraded - PDF Invoices - Now shortcodes are displayed in invoice's additional header and footer.
130
+ Idea by https://wordpress.org/support/topic/displaying-short-codes
131
  * Feature Upgraded - PDF Invoices - Additional header option added.
132
  * Feature Upgraded - PDF Invoices - *Item Name Additional Info* (e.g. SKU) option added to invoice.
133
+ Idea by https://wordpress.org/support/topic/item-description
134
 
135
  = 1.8.0 - 17/10/2014 =
136
  * New Feature - Product Tabs - **Custom product tabs** - global or per product.
137
  Related *product tabs* options were also moved to this feature from *Product Info*.
138
+ * Dev - `date` function changed to `date_i18n`. Suggested in https://wordpress.org/support/topic/pdf-invoices-date-bug
139
  Changes affected the *Orders* and *PDF Invoices* features (this covers request from Jean-Marc for international date formats in *PDF Invoices*).
140
 
141
  = 1.7.9 - 16/10/2014 =
182
  = 1.7.1 - 02/10/2014 =
183
  * Fix - Product Info - `%total_sales%` is temporary disabled.
184
  This was causing "PHP Parse error" on some servers (PHP 5.3), now fixed. Reported by Xavier.
185
+ Also reported in https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-expecting-2
186
 
187
  = 1.7.0 - 02/10/2014 =
188
  * Fix - Payment Gateways - Instructions were not showing (suggested by Jen), fixed.
woocommerce-jetpack.php CHANGED
@@ -3,7 +3,7 @@
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.8.1
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2014 Algoritmika Ltd.
@@ -198,26 +198,19 @@ final class WC_Jetpack {
198
  /**
199
  * Add Jetpack settings tab to WooCommerce settings.
200
  */
201
- public function add_wcj_settings_tab( $settings ) {
202
-
203
- $settings[] = include( 'includes/admin/settings/class-wc-settings-jetpack.php' );
204
-
205
  return $settings;
206
  }
207
 
208
-
209
  /**
210
  * Init WC_Jetpack when WordPress initialises.
211
  */
212
  public function init() {
213
-
214
  // Before init action
215
- do_action( 'before_wcj_init' );
216
-
217
  // Set up localisation
218
- //$this->load_plugin_textdomain();
219
- load_plugin_textdomain( 'woocommerce-jetpack', false, dirname( plugin_basename( __FILE__ ) ) . '/langs/' );
220
-
221
  // Init action
222
  do_action( 'wcj_init' );
223
  }
@@ -231,7 +224,6 @@ endif;
231
  * @return WC_Jetpack
232
  */
233
  function WCJ() {
234
-
235
  return WC_Jetpack::instance();
236
  }
237
 
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.8.2
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2014 Algoritmika Ltd.
198
  /**
199
  * Add Jetpack settings tab to WooCommerce settings.
200
  */
201
+ public function add_wcj_settings_tab( $settings ) {
202
+ $settings[] = include( 'includes/admin/settings/class-wc-settings-jetpack.php' );
 
 
203
  return $settings;
204
  }
205
 
 
206
  /**
207
  * Init WC_Jetpack when WordPress initialises.
208
  */
209
  public function init() {
 
210
  // Before init action
211
+ do_action( 'before_wcj_init' );
 
212
  // Set up localisation
213
+ load_plugin_textdomain( 'woocommerce-jetpack', false, dirname( plugin_basename( __FILE__ ) ) . '/langs/' );
 
 
214
  // Init action
215
  do_action( 'wcj_init' );
216
  }
224
  * @return WC_Jetpack
225
  */
226
  function WCJ() {
 
227
  return WC_Jetpack::instance();
228
  }
229