Version Description
- 01/08/2015 =
- Dev - Plugin renamed from "WooCommerce Jetpack" to "Booster for WooCommerce" (
name_changed_notice
added). - Dev - PRODUCTS - Sorting - "Sort SKUs as numbers instead of as texts" option added.
- Fix - PRODUCTS - Sorting - meta_value to meta_value_num in sort by quantity.
- Dev - PRODUCTS - Sorting - Code refactoring.
- Dev - PRODUCTS - Product Cost Price - Profit column added.
- Dev - CART & CHECKOUT - Custom Payment Gateways - Short description changed.
- Fix - CART & CHECKOUT - Checkout Core Fields -
fix_required_by_default
added. - Dev - EMAILS & MISC. - Admin Tools - Short description changed.
- Dev - EMAILS & MISC. - Reports - Ranges by month added.
- Dev - EMAILS & MISC. - WPML - Short description changed.
Download this release
Release Info
Developer | algoritmika |
Plugin | Booster for WooCommerce |
Version | 2.2.4 |
Comparing to | |
See all releases |
Code changes from version 2.2.3 to 2.2.4
- includes/admin/class-wc-settings-jetpack.php +11 -6
- includes/admin/class-wcj-tools.php +20 -6
- includes/class-wcj-admin-tools.php +3 -3
- includes/class-wcj-call-for-price.php +100 -91
- includes/class-wcj-checkout-core-fields.php +43 -10
- includes/class-wcj-payment-gateways.php +4 -2
- includes/class-wcj-price-labels.php +66 -61
- includes/class-wcj-purchase-data.php +80 -9
- includes/class-wcj-reports.php +40 -1
- includes/class-wcj-sorting.php +136 -154
- includes/class-wcj-wpml.php +2 -2
- readme.txt +17 -5
- woocommerce-jetpack.php +56 -15
includes/admin/class-wc-settings-jetpack.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Settings class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @since 1.0.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
@@ -17,11 +17,13 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
|
|
17 |
|
18 |
/**
|
19 |
* Constructor.
|
|
|
|
|
20 |
*/
|
21 |
function __construct() {
|
22 |
|
23 |
$this->id = 'jetpack';
|
24 |
-
$this->label = __( '
|
25 |
|
26 |
$this->cats = include( 'wcj-modules-cats.php' );
|
27 |
|
@@ -199,6 +201,8 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
|
|
199 |
|
200 |
/**
|
201 |
* Output the settings.
|
|
|
|
|
202 |
*/
|
203 |
function output() {
|
204 |
|
@@ -216,7 +220,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
|
|
216 |
$breadcrumbs_html .= ' > ';
|
217 |
$breadcrumbs_html .= __( 'Settings', 'woocommerce-jetpack' );
|
218 |
$breadcrumbs_html .= ' > ';
|
219 |
-
$breadcrumbs_html .= __( '
|
220 |
$breadcrumbs_html .= ' > ';
|
221 |
foreach ( $this->cats as $id => $label_info ) {
|
222 |
if ( $this->get_cat_by_section( $current_section ) === $id ) {
|
@@ -372,7 +376,8 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
|
|
372 |
/**
|
373 |
* Get settings array
|
374 |
*
|
375 |
-
* @
|
|
|
376 |
*/
|
377 |
function get_settings( $current_section = '' ) {
|
378 |
if ( '' != $current_section && 'alphabetically' != $current_section && 'by_category' != $current_section && 'active' != $current_section ) {
|
@@ -380,9 +385,9 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
|
|
380 |
}
|
381 |
else {
|
382 |
$settings[] = array(
|
383 |
-
'title' => __( 'WooCommerce
|
384 |
'type' => 'title',
|
385 |
-
'desc' => __( 'This dashboard lets you enable/disable any
|
386 |
'id' => 'wcj_options'
|
387 |
);
|
388 |
//$settings = apply_filters( 'wcj_features_status', $settings );
|
4 |
*
|
5 |
* The WooCommerce Jetpack Settings class.
|
6 |
*
|
7 |
+
* @version 2.2.4
|
8 |
* @since 1.0.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
17 |
|
18 |
/**
|
19 |
* Constructor.
|
20 |
+
*
|
21 |
+
* @version 2.2.4
|
22 |
*/
|
23 |
function __construct() {
|
24 |
|
25 |
$this->id = 'jetpack';
|
26 |
+
$this->label = __( 'Booster', 'woocommerce-jetpack' );
|
27 |
|
28 |
$this->cats = include( 'wcj-modules-cats.php' );
|
29 |
|
201 |
|
202 |
/**
|
203 |
* Output the settings.
|
204 |
+
*
|
205 |
+
* @version 2.2.4
|
206 |
*/
|
207 |
function output() {
|
208 |
|
220 |
$breadcrumbs_html .= ' > ';
|
221 |
$breadcrumbs_html .= __( 'Settings', 'woocommerce-jetpack' );
|
222 |
$breadcrumbs_html .= ' > ';
|
223 |
+
$breadcrumbs_html .= __( 'Booster', 'woocommerce-jetpack' );
|
224 |
$breadcrumbs_html .= ' > ';
|
225 |
foreach ( $this->cats as $id => $label_info ) {
|
226 |
if ( $this->get_cat_by_section( $current_section ) === $id ) {
|
376 |
/**
|
377 |
* Get settings array
|
378 |
*
|
379 |
+
* @version 2.2.4
|
380 |
+
* @return array
|
381 |
*/
|
382 |
function get_settings( $current_section = '' ) {
|
383 |
if ( '' != $current_section && 'alphabetically' != $current_section && 'by_category' != $current_section && 'active' != $current_section ) {
|
385 |
}
|
386 |
else {
|
387 |
$settings[] = array(
|
388 |
+
'title' => __( 'Booster for WooCommerce - Dashboard', 'woocommerce-jetpack' ),
|
389 |
'type' => 'title',
|
390 |
+
'desc' => __( 'This dashboard lets you enable/disable any Booster\'s module. Each checkbox comes with short module\'s description. Please visit <a href="http://BoostWooCommerce.com" target="_blank">BoostWooCommerce.com</a> for detailed info on each feature.', 'woocommerce-jetpack' ),
|
391 |
'id' => 'wcj_options'
|
392 |
);
|
393 |
//$settings = apply_filters( 'wcj_features_status', $settings );
|
includes/admin/class-wcj-tools.php
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Tools class.
|
6 |
*
|
|
|
7 |
* @author Algoritmika Ltd.
|
8 |
*/
|
9 |
|
@@ -13,17 +14,30 @@ if ( ! class_exists( 'WCJ_Tools' ) ) :
|
|
13 |
|
14 |
class WCJ_Tools {
|
15 |
|
16 |
-
|
|
|
|
|
|
|
17 |
if ( is_admin() ) {
|
18 |
add_action( 'admin_menu', array($this, 'add_wcj_tools'), 100 );
|
19 |
}
|
20 |
}
|
21 |
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
$tabs = array(
|
29 |
array(
|
@@ -57,8 +71,8 @@ class WCJ_Tools {
|
|
57 |
echo $html;
|
58 |
|
59 |
if ( 'dashboard' === $active_tab ) {
|
60 |
-
echo '<h3>' . __( 'WooCommerce
|
61 |
-
echo '<p>' . __( 'This dashboard lets you check statuses and short descriptions of all available WooCommerce
|
62 |
echo '<table class="widefat" style="width:90%;">';
|
63 |
echo '<tr>';
|
64 |
echo '<th style="width:25%;">' . __( 'Tool', 'woocommerce-jetpack' ) . '</th>';
|
4 |
*
|
5 |
* The WooCommerce Jetpack Tools class.
|
6 |
*
|
7 |
+
* @version 2.2.4
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
14 |
|
15 |
class WCJ_Tools {
|
16 |
|
17 |
+
/**
|
18 |
+
* __construct.
|
19 |
+
*/
|
20 |
+
function __construct() {
|
21 |
if ( is_admin() ) {
|
22 |
add_action( 'admin_menu', array($this, 'add_wcj_tools'), 100 );
|
23 |
}
|
24 |
}
|
25 |
|
26 |
+
/**
|
27 |
+
* add_wcj_tools.
|
28 |
+
*
|
29 |
+
* @version 2.2.4
|
30 |
+
*/
|
31 |
+
function add_wcj_tools() {
|
32 |
+
add_submenu_page( 'woocommerce', __( 'Booster for WooCommerce Tools', 'woocommerce-jetpack' ), __( 'Booster Tools', 'woocommerce-jetpack' ), 'manage_options', 'wcj-tools', array( $this, 'create_tools_page' ) );
|
33 |
}
|
34 |
|
35 |
+
/**
|
36 |
+
* create_tools_page.
|
37 |
+
*
|
38 |
+
* @version 2.2.4
|
39 |
+
*/
|
40 |
+
function create_tools_page() {
|
41 |
|
42 |
$tabs = array(
|
43 |
array(
|
71 |
echo $html;
|
72 |
|
73 |
if ( 'dashboard' === $active_tab ) {
|
74 |
+
echo '<h3>' . __( 'Booster for WooCommerce Tools - Dashboard', 'woocommerce-jetpack' ) . '</h3>';
|
75 |
+
echo '<p>' . __( 'This dashboard lets you check statuses and short descriptions of all available Booster for WooCommerce tools. Tools can be enabled through WooCommerce > Settings > Booster. Enabled tools will appear in the tabs menu above.', 'woocommerce-jetpack' ) . '</p>';
|
76 |
echo '<table class="widefat" style="width:90%;">';
|
77 |
echo '<tr>';
|
78 |
echo '<th style="width:25%;">' . __( 'Tool', 'woocommerce-jetpack' ) . '</th>';
|
includes/class-wcj-admin-tools.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Admin Tools class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -17,13 +17,13 @@ class WCJ_Admin_Tools extends WCJ_Module {
|
|
17 |
/**
|
18 |
* Constructor.
|
19 |
*
|
20 |
-
* @version 2.2.
|
21 |
*/
|
22 |
public function __construct() {
|
23 |
|
24 |
$this->id = 'admin_tools';
|
25 |
$this->short_desc = __( 'Admin Tools', 'woocommerce-jetpack' );
|
26 |
-
$this->desc = __( '
|
27 |
parent::__construct();
|
28 |
|
29 |
$this->add_tools( array( 'admin_tools' => __( 'Admin Tools', 'woocommerce-jetpack' ), ) );
|
4 |
*
|
5 |
* The WooCommerce Jetpack Admin Tools class.
|
6 |
*
|
7 |
+
* @version 2.2.4
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
17 |
/**
|
18 |
* Constructor.
|
19 |
*
|
20 |
+
* @version 2.2.4
|
21 |
*/
|
22 |
public function __construct() {
|
23 |
|
24 |
$this->id = 'admin_tools';
|
25 |
$this->short_desc = __( 'Admin Tools', 'woocommerce-jetpack' );
|
26 |
+
$this->desc = __( 'Booster for WooCommerce debug and log tools.', 'woocommerce-jetpack' );
|
27 |
parent::__construct();
|
28 |
|
29 |
$this->add_tools( array( 'admin_tools' => __( 'Admin Tools', 'woocommerce-jetpack' ), ) );
|
includes/class-wcj-call-for-price.php
CHANGED
@@ -8,164 +8,173 @@
|
|
8 |
* @category Class
|
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_action( 'init', array( $this, 'add_hook' ), PHP_INT_MAX );
|
29 |
//add_filter( 'woocommerce_empty_price_html', array( $this, 'on_empty_price' ), PHP_INT_MAX );
|
30 |
add_filter( 'woocommerce_sale_flash', array( $this, 'hide_sales_flash' ), 100, 3 );
|
31 |
-
}
|
32 |
-
|
33 |
// Settings hooks
|
34 |
add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
|
35 |
add_filter( 'wcj_settings_call_for_price', array( $this, 'get_settings' ), 100 );
|
36 |
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
37 |
}
|
38 |
-
|
39 |
/**
|
40 |
* some.
|
41 |
*/
|
42 |
-
public function add_hook() {
|
43 |
add_filter( 'woocommerce_empty_price_html', array( $this, 'on_empty_price' ), PHP_INT_MAX );
|
44 |
-
}
|
45 |
-
|
46 |
/**
|
47 |
* Hide "sales" icon for empty price products.
|
48 |
*/
|
49 |
-
public function hide_sales_flash( $onsale_html, $post, $product ) {
|
50 |
-
if ( get_option('wcj_call_for_price_hide_sale_sign') === 'yes' )
|
51 |
if ( $product->get_price() === '' )
|
52 |
return '';
|
53 |
return $onsale_html;
|
54 |
}
|
55 |
-
|
56 |
/**
|
57 |
* On empty price filter - return the label.
|
58 |
-
*/
|
59 |
-
public function on_empty_price( $price ) {
|
60 |
-
if ( ( get_option('wcj_call_for_price_text') !== '' ) && is_single( get_the_ID() ) )
|
61 |
return do_shortcode( apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text') ) );
|
62 |
-
if ( ( get_option('wcj_call_for_price_text_on_related') !== '' ) && ( is_single() ) && ( ! is_single( get_the_ID() ) ) )
|
63 |
return do_shortcode( apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text_on_related') ) );
|
64 |
-
if ( ( get_option('wcj_call_for_price_text_on_archive') !== '' ) && is_archive() )
|
65 |
return do_shortcode( apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text_on_archive') ) );
|
66 |
-
if ( ( get_option('wcj_call_for_price_text_on_home') !== '' ) && is_front_page() )
|
67 |
-
return do_shortcode( apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text_on_home') ) );
|
68 |
-
|
69 |
// No changes
|
70 |
return $price;
|
71 |
-
}
|
72 |
-
|
73 |
/**
|
74 |
* Get settings array.
|
75 |
-
*/
|
76 |
function get_settings() {
|
77 |
|
78 |
$settings = array(
|
79 |
|
80 |
-
array( 'title' => __( 'Call for Price Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'Leave price empty when adding or editing products. Then set the options here.', 'woocommerce-jetpack' ), 'id' => 'wcj_call_for_price_options' ),
|
81 |
-
|
82 |
array(
|
83 |
-
'title'
|
84 |
-
'
|
85 |
-
'
|
86 |
-
'id'
|
87 |
-
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
),
|
90 |
-
|
91 |
array(
|
92 |
-
'title'
|
93 |
-
'desc_tip'
|
94 |
-
'desc'
|
95 |
-
'id'
|
96 |
-
'default'
|
97 |
-
'type'
|
98 |
-
'css'
|
99 |
-
'custom_attributes'
|
100 |
-
|
101 |
),
|
102 |
-
|
103 |
array(
|
104 |
-
'title'
|
105 |
-
'desc_tip'
|
106 |
-
'desc'
|
107 |
-
'id'
|
108 |
-
'default'
|
109 |
-
'type'
|
110 |
-
'css'
|
111 |
-
'custom_attributes'
|
112 |
-
|
113 |
),
|
114 |
|
115 |
array(
|
116 |
-
'title'
|
117 |
-
'desc_tip'
|
118 |
-
'desc'
|
119 |
-
'id'
|
120 |
-
'default'
|
121 |
-
'type'
|
122 |
-
'css'
|
123 |
-
'custom_attributes'
|
124 |
-
|
125 |
),
|
126 |
|
127 |
array(
|
128 |
-
'title'
|
129 |
-
'
|
130 |
-
'
|
131 |
-
'
|
132 |
-
'
|
133 |
-
|
134 |
-
|
135 |
-
'custom_attributes'
|
136 |
-
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
137 |
-
),
|
138 |
-
|
139 |
array(
|
140 |
-
'
|
141 |
-
'
|
142 |
-
'id' => 'wcj_call_for_price_hide_sale_sign',
|
143 |
-
'default' => 'yes',
|
144 |
-
'type' => 'checkbox',
|
145 |
),
|
146 |
-
|
147 |
-
array( 'type' => 'sectionend', 'id' => 'wcj_call_for_price_options' ),
|
148 |
);
|
149 |
-
|
150 |
return $settings;
|
151 |
}
|
152 |
-
|
153 |
/**
|
154 |
* Get "enabled" setting from settings array.
|
155 |
*/
|
156 |
-
public function add_enabled_option( $settings ) {
|
157 |
$all_settings = $this->get_settings();
|
158 |
-
$settings[] = $all_settings[1];
|
159 |
return $settings;
|
160 |
-
}
|
161 |
-
|
162 |
/**
|
163 |
* Add section to WooCommerce > Settings > Jetpack.
|
164 |
-
*/
|
165 |
-
function settings_section( $sections ) {
|
166 |
-
$sections['call_for_price'] = __( 'Call for Price', 'woocommerce-jetpack' );
|
167 |
return $sections;
|
168 |
-
}
|
169 |
}
|
170 |
|
171 |
endif;
|
8 |
* @category Class
|
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_action( 'init', array( $this, 'add_hook' ), PHP_INT_MAX );
|
29 |
//add_filter( 'woocommerce_empty_price_html', array( $this, 'on_empty_price' ), PHP_INT_MAX );
|
30 |
add_filter( 'woocommerce_sale_flash', array( $this, 'hide_sales_flash' ), 100, 3 );
|
31 |
+
}
|
32 |
+
|
33 |
// Settings hooks
|
34 |
add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
|
35 |
add_filter( 'wcj_settings_call_for_price', array( $this, 'get_settings' ), 100 );
|
36 |
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
37 |
}
|
38 |
+
|
39 |
/**
|
40 |
* some.
|
41 |
*/
|
42 |
+
public function add_hook() {
|
43 |
add_filter( 'woocommerce_empty_price_html', array( $this, 'on_empty_price' ), PHP_INT_MAX );
|
44 |
+
}
|
45 |
+
|
46 |
/**
|
47 |
* Hide "sales" icon for empty price products.
|
48 |
*/
|
49 |
+
public function hide_sales_flash( $onsale_html, $post, $product ) {
|
50 |
+
if ( get_option('wcj_call_for_price_hide_sale_sign') === 'yes' )
|
51 |
if ( $product->get_price() === '' )
|
52 |
return '';
|
53 |
return $onsale_html;
|
54 |
}
|
55 |
+
|
56 |
/**
|
57 |
* On empty price filter - return the label.
|
58 |
+
*/
|
59 |
+
public function on_empty_price( $price ) {
|
60 |
+
if ( ( get_option('wcj_call_for_price_text') !== '' ) && is_single( get_the_ID() ) )
|
61 |
return do_shortcode( apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text') ) );
|
62 |
+
if ( ( get_option('wcj_call_for_price_text_on_related') !== '' ) && ( is_single() ) && ( ! is_single( get_the_ID() ) ) )
|
63 |
return do_shortcode( apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text_on_related') ) );
|
64 |
+
if ( ( get_option('wcj_call_for_price_text_on_archive') !== '' ) && is_archive() )
|
65 |
return do_shortcode( apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text_on_archive') ) );
|
66 |
+
if ( ( get_option('wcj_call_for_price_text_on_home') !== '' ) && is_front_page() )
|
67 |
+
return do_shortcode( apply_filters( 'wcj_get_option_filter', $this->default_empty_price_text, get_option('wcj_call_for_price_text_on_home') ) );
|
68 |
+
|
69 |
// No changes
|
70 |
return $price;
|
71 |
+
}
|
72 |
+
|
73 |
/**
|
74 |
* Get settings array.
|
75 |
+
*/
|
76 |
function get_settings() {
|
77 |
|
78 |
$settings = array(
|
79 |
|
|
|
|
|
80 |
array(
|
81 |
+
'title' => __( 'Call for Price Options', 'woocommerce-jetpack' ),
|
82 |
+
'type' => 'title',
|
83 |
+
'desc' => __( 'Leave price empty when adding or editing products. Then set the options here.', 'woocommerce-jetpack' ),
|
84 |
+
'id' => 'wcj_call_for_price_options',
|
85 |
+
),
|
86 |
+
|
87 |
+
array(
|
88 |
+
'title' => __( 'Call for Price', 'woocommerce-jetpack' ),
|
89 |
+
'desc' => '<strong>' . __( 'Enable Module', 'woocommerce-jetpack' ) . '</strong>',
|
90 |
+
'desc_tip' => __( 'Create any custom price label for all WooCommerce products with empty price.', 'woocommerce-jetpack' ),
|
91 |
+
'id' => 'wcj_call_for_price_enabled',
|
92 |
+
'default' => 'no',
|
93 |
+
'type' => 'checkbox',
|
94 |
+
),
|
95 |
+
|
96 |
+
array(
|
97 |
+
'title' => __( 'Label to Show on Single', 'woocommerce-jetpack' ),
|
98 |
+
'desc_tip' => __( 'This sets the html to output on empty price. Leave blank to disable.', 'woocommerce-jetpack' ),
|
99 |
+
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
100 |
+
'id' => 'wcj_call_for_price_text',
|
101 |
+
'default' => $this->default_empty_price_text,
|
102 |
+
'type' => 'textarea',
|
103 |
+
'css' => 'width:50%;min-width:300px;',
|
104 |
+
'custom_attributes'
|
105 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
106 |
),
|
107 |
+
|
108 |
array(
|
109 |
+
'title' => __( 'Label to Show on Archives', 'woocommerce-jetpack' ),
|
110 |
+
'desc_tip' => __( 'This sets the html to output on empty price. Leave blank to disable.', 'woocommerce-jetpack' ),
|
111 |
+
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
112 |
+
'id' => 'wcj_call_for_price_text_on_archive',
|
113 |
+
'default' => $this->default_empty_price_text,
|
114 |
+
'type' => 'textarea',
|
115 |
+
'css' => 'width:50%;min-width:300px;',
|
116 |
+
'custom_attributes'
|
117 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
118 |
),
|
119 |
+
|
120 |
array(
|
121 |
+
'title' => __( 'Label to Show on Homepage', 'woocommerce-jetpack' ),
|
122 |
+
'desc_tip' => __( 'This sets the html to output on empty price. Leave blank to disable.', 'woocommerce-jetpack' ),
|
123 |
+
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
124 |
+
'id' => 'wcj_call_for_price_text_on_home',
|
125 |
+
'default' => $this->default_empty_price_text,
|
126 |
+
'type' => 'textarea',
|
127 |
+
'css' => 'width:50%;min-width:300px;',
|
128 |
+
'custom_attributes'
|
129 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
130 |
),
|
131 |
|
132 |
array(
|
133 |
+
'title' => __( 'Label to Show on Related', 'woocommerce-jetpack' ),
|
134 |
+
'desc_tip' => __( 'This sets the html to output on empty price. Leave blank to disable.', 'woocommerce-jetpack' ),
|
135 |
+
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
136 |
+
'id' => 'wcj_call_for_price_text_on_related',
|
137 |
+
'default' => $this->default_empty_price_text,
|
138 |
+
'type' => 'textarea',
|
139 |
+
'css' => 'width:50%;min-width:300px;',
|
140 |
+
'custom_attributes'
|
141 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
142 |
),
|
143 |
|
144 |
array(
|
145 |
+
'title' => __( 'Hide Sale! Tag', 'woocommerce-jetpack' ),
|
146 |
+
'desc' => __( 'Hide the tag', 'woocommerce-jetpack' ),
|
147 |
+
'id' => 'wcj_call_for_price_hide_sale_sign',
|
148 |
+
'default' => 'yes',
|
149 |
+
'type' => 'checkbox',
|
150 |
+
),
|
151 |
+
|
|
|
|
|
|
|
|
|
152 |
array(
|
153 |
+
'type' => 'sectionend',
|
154 |
+
'id' => 'wcj_call_for_price_options',
|
|
|
|
|
|
|
155 |
),
|
156 |
+
|
|
|
157 |
);
|
158 |
+
|
159 |
return $settings;
|
160 |
}
|
161 |
+
|
162 |
/**
|
163 |
* Get "enabled" setting from settings array.
|
164 |
*/
|
165 |
+
public function add_enabled_option( $settings ) {
|
166 |
$all_settings = $this->get_settings();
|
167 |
+
$settings[] = $all_settings[1];
|
168 |
return $settings;
|
169 |
+
}
|
170 |
+
|
171 |
/**
|
172 |
* Add section to WooCommerce > Settings > Jetpack.
|
173 |
+
*/
|
174 |
+
function settings_section( $sections ) {
|
175 |
+
$sections['call_for_price'] = __( 'Call for Price', 'woocommerce-jetpack' );
|
176 |
return $sections;
|
177 |
+
}
|
178 |
}
|
179 |
|
180 |
endif;
|
includes/class-wcj-checkout-core-fields.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Checkout Core Fields class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -54,6 +54,8 @@ class WCJ_Checkout_Core_Fields {
|
|
54 |
|
55 |
/**
|
56 |
* Constructor.
|
|
|
|
|
57 |
*/
|
58 |
public function __construct() {
|
59 |
|
@@ -62,6 +64,7 @@ class WCJ_Checkout_Core_Fields {
|
|
62 |
// Main hooks
|
63 |
if ( 'yes' === get_option( 'wcj_checkout_core_fields_enabled' ) ) {
|
64 |
add_filter( 'woocommerce_checkout_fields' , array( $this, 'custom_override_checkout_fields' ) );
|
|
|
65 |
}
|
66 |
|
67 |
// Settings hooks
|
@@ -70,14 +73,39 @@ class WCJ_Checkout_Core_Fields {
|
|
70 |
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
71 |
}
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
function custom_override_checkout_fields( $checkout_fields ) {
|
83 |
|
@@ -104,7 +132,12 @@ class WCJ_Checkout_Core_Fields {
|
|
104 |
if ( $sub_item_key == 'required' ) {
|
105 |
|
106 |
if ( $the_option == 'yes' ) $the_option = true;
|
107 |
-
else
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
|
110 |
$checkout_fields[$field_parts[0]][$item_key][$sub_item_key] = $the_option;
|
4 |
*
|
5 |
* The WooCommerce Jetpack Checkout Core Fields class.
|
6 |
*
|
7 |
+
* @version 2.2.4
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
54 |
|
55 |
/**
|
56 |
* Constructor.
|
57 |
+
*
|
58 |
+
* @version 2.2.4
|
59 |
*/
|
60 |
public function __construct() {
|
61 |
|
64 |
// Main hooks
|
65 |
if ( 'yes' === get_option( 'wcj_checkout_core_fields_enabled' ) ) {
|
66 |
add_filter( 'woocommerce_checkout_fields' , array( $this, 'custom_override_checkout_fields' ) );
|
67 |
+
add_filter( 'woocommerce_default_address_fields', array( $this, 'fix_required_by_default' ) );
|
68 |
}
|
69 |
|
70 |
// Settings hooks
|
73 |
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
74 |
}
|
75 |
|
76 |
+
/**
|
77 |
+
* add_enabled_option.
|
78 |
+
*/
|
79 |
+
public function add_enabled_option( $settings ) {
|
80 |
+
$all_settings = $this->get_settings();
|
81 |
+
$settings[] = $all_settings[1];
|
82 |
+
return $settings;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* fix_required_by_default.
|
87 |
+
*
|
88 |
+
* @since 2.2.4
|
89 |
+
*/
|
90 |
+
function fix_required_by_default( $address_fields ) {
|
91 |
+
$fields_required_by_default = array(
|
92 |
+
'country',
|
93 |
+
'first_name',
|
94 |
+
'last_name',
|
95 |
+
'address_1',
|
96 |
+
'city',
|
97 |
+
'state',
|
98 |
+
'postcode',
|
99 |
+
);
|
100 |
+
foreach ( $fields_required_by_default as $field ) {
|
101 |
+
$billing_value = get_option( 'wcj_checkout_fields_' . 'billing_' . $field . '_required' );
|
102 |
+
$shipping_value = get_option( 'wcj_checkout_fields_' . 'shipping_' . $field . '_required' );
|
103 |
+
if ( 'no' === $billing_value && 'no' === $shipping_value ) {
|
104 |
+
$address_fields[ $field ]['required'] = false;
|
105 |
+
}
|
106 |
+
}
|
107 |
+
return $address_fields;
|
108 |
+
}
|
109 |
|
110 |
function custom_override_checkout_fields( $checkout_fields ) {
|
111 |
|
132 |
if ( $sub_item_key == 'required' ) {
|
133 |
|
134 |
if ( $the_option == 'yes' ) $the_option = true;
|
135 |
+
else {
|
136 |
+
$the_option = false;
|
137 |
+
/* $checkout_fields[$field_parts[0]][$item_key]['validate'] = array();
|
138 |
+
$checkout_fields[$field_parts[0]][$item_key]['class'] = array( 'woocommerce-validated' );
|
139 |
+
$checkout_fields[$field_parts[0]][$item_key]['custom_attributes'] = array(); */
|
140 |
+
}
|
141 |
}
|
142 |
|
143 |
$checkout_fields[$field_parts[0]][$item_key][$sub_item_key] = $the_option;
|
includes/class-wcj-payment-gateways.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Payment Gateways class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -16,12 +16,14 @@ class WCJ_Payment_Gateways extends WCJ_Module {
|
|
16 |
|
17 |
/**
|
18 |
* Constructor.
|
|
|
|
|
19 |
*/
|
20 |
public function __construct() {
|
21 |
|
22 |
$this->id = 'payment_gateways';
|
23 |
$this->short_desc = __( 'Custom Payment Gateways', 'woocommerce-jetpack' );
|
24 |
-
$this->desc = __( 'Add
|
25 |
parent::__construct();
|
26 |
|
27 |
if ( $this->is_enabled() ) {
|
4 |
*
|
5 |
* The WooCommerce Jetpack Payment Gateways class.
|
6 |
*
|
7 |
+
* @version 2.2.4
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
16 |
|
17 |
/**
|
18 |
* Constructor.
|
19 |
+
*
|
20 |
+
* @version 2.2.4
|
21 |
*/
|
22 |
public function __construct() {
|
23 |
|
24 |
$this->id = 'payment_gateways';
|
25 |
$this->short_desc = __( 'Custom Payment Gateways', 'woocommerce-jetpack' );
|
26 |
+
$this->desc = __( 'Add multiple custom payment gateways to WooCommerce.', 'woocommerce-jetpack' );
|
27 |
parent::__construct();
|
28 |
|
29 |
if ( $this->is_enabled() ) {
|
includes/class-wcj-price-labels.php
CHANGED
@@ -531,103 +531,108 @@ class WCJ_Price_Labels {
|
|
531 |
array( 'title' => __( 'Custom Price Labels Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_price_labels_options' ),
|
532 |
|
533 |
array(
|
534 |
-
'title'
|
535 |
'desc' => '<strong>' . __( 'Enable Module', 'woocommerce-jetpack' ) . '</strong>',
|
536 |
'desc_tip' => __( 'Create any custom price label for any WooCommerce product.', 'woocommerce-jetpack' ),
|
537 |
-
'id'
|
538 |
'default' => 'no',
|
539 |
-
'type'
|
540 |
),
|
541 |
|
542 |
array( 'type' => 'sectionend', 'id' => 'wcj_price_labels_options' ),
|
543 |
|
544 |
-
array(
|
|
|
|
|
|
|
|
|
|
|
545 |
|
546 |
array(
|
547 |
-
'title'
|
548 |
-
'desc_tip'
|
549 |
-
'id'
|
550 |
-
'default'
|
551 |
-
'type'
|
552 |
-
'desc'
|
553 |
'custom_attributes'
|
554 |
-
|
555 |
-
'css'
|
556 |
),
|
557 |
|
558 |
array(
|
559 |
-
'title'
|
560 |
-
'desc_tip'
|
561 |
-
'id'
|
562 |
-
'default'
|
563 |
-
'type'
|
564 |
-
|
565 |
'custom_attributes'
|
566 |
-
|
567 |
-
'css'
|
568 |
),
|
569 |
|
570 |
array(
|
571 |
-
'title'
|
572 |
-
'desc_tip'
|
573 |
-
'id'
|
574 |
-
'default'
|
575 |
-
'type'
|
576 |
-
'desc'
|
577 |
'custom_attributes'
|
578 |
-
|
579 |
-
'css'
|
580 |
),
|
581 |
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
array(
|
586 |
-
'title'
|
587 |
-
|
588 |
-
'desc_tip'
|
589 |
-
'id'
|
590 |
-
'default'
|
591 |
-
'type'
|
592 |
-
'desc'
|
593 |
'custom_attributes'
|
594 |
-
|
595 |
-
'css'
|
596 |
),
|
597 |
|
598 |
array(
|
599 |
-
'title'
|
600 |
-
'desc_tip'
|
601 |
-
'id'
|
602 |
-
'default'
|
603 |
-
'type'
|
604 |
-
'desc'
|
605 |
'custom_attributes'
|
606 |
-
|
607 |
-
'css'
|
608 |
),
|
609 |
|
610 |
array(
|
611 |
-
'title'
|
612 |
-
'desc_tip'
|
613 |
-
'id'
|
614 |
-
'default'
|
615 |
-
'type'
|
616 |
-
'desc'
|
617 |
'custom_attributes'
|
618 |
-
|
619 |
-
'css'
|
620 |
),
|
621 |
|
622 |
-
array(
|
|
|
|
|
|
|
623 |
|
624 |
array( 'title' => __( 'Migrate from Custom Price Labels (Pro) Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you enable "Migrate from Custom Price Labels (Pro)" tool.', 'woocommerce-jetpack' ), 'id' => 'wcj_migrate_from_custom_price_labels_options' ),
|
625 |
|
626 |
array(
|
627 |
-
'title'
|
628 |
-
'id'
|
629 |
-
'default'
|
630 |
-
'type'
|
631 |
),
|
632 |
|
633 |
array( 'type' => 'sectionend', 'id' => 'wcj_migrate_from_custom_price_labels_options' ),
|
531 |
array( 'title' => __( 'Custom Price Labels Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_price_labels_options' ),
|
532 |
|
533 |
array(
|
534 |
+
'title' => __( 'Custom Price Labels', 'woocommerce-jetpack' ),
|
535 |
'desc' => '<strong>' . __( 'Enable Module', 'woocommerce-jetpack' ) . '</strong>',
|
536 |
'desc_tip' => __( 'Create any custom price label for any WooCommerce product.', 'woocommerce-jetpack' ),
|
537 |
+
'id' => 'wcj_price_labels_enabled',
|
538 |
'default' => 'no',
|
539 |
+
'type' => 'checkbox',
|
540 |
),
|
541 |
|
542 |
array( 'type' => 'sectionend', 'id' => 'wcj_price_labels_options' ),
|
543 |
|
544 |
+
array(
|
545 |
+
'title' => __( 'Global Custom Price Labels', 'woocommerce-jetpack' ),
|
546 |
+
'type' => 'title',
|
547 |
+
'desc' => __( 'This section lets you set price labels for all products globally.', 'woocommerce-jetpack' ),
|
548 |
+
'id' => 'wcj_global_price_labels_options',
|
549 |
+
),
|
550 |
|
551 |
array(
|
552 |
+
'title' => __( 'Add before the price', 'woocommerce-jetpack' ),
|
553 |
+
'desc_tip' => __( 'Enter text to add before all products prices. Leave blank to disable.', 'woocommerce-jetpack' ),
|
554 |
+
'id' => 'wcj_global_price_labels_add_before_text',
|
555 |
+
'default' => '',
|
556 |
+
'type' => 'textarea',
|
557 |
+
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
558 |
'custom_attributes'
|
559 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
560 |
+
'css' => 'width:30%;min-width:300px;',
|
561 |
),
|
562 |
|
563 |
array(
|
564 |
+
'title' => __( 'Add after the price', 'woocommerce-jetpack' ),
|
565 |
+
'desc_tip' => __( 'Enter text to add after all products prices. Leave blank to disable.', 'woocommerce-jetpack' ),
|
566 |
+
'id' => 'wcj_global_price_labels_add_after_text',
|
567 |
+
'default' => '',
|
568 |
+
'type' => 'textarea',
|
569 |
+
/* 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
570 |
'custom_attributes'
|
571 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),*/
|
572 |
+
'css' => 'width:30%;min-width:300px;',
|
573 |
),
|
574 |
|
575 |
array(
|
576 |
+
'title' => __( 'Add between regular and sale prices', 'woocommerce-jetpack' ),
|
577 |
+
'desc_tip' => __( 'Enter text to add between regular and sale prices. Leave blank to disable.', 'woocommerce-jetpack' ),
|
578 |
+
'id' => 'wcj_global_price_labels_between_regular_and_sale_text',
|
579 |
+
'default' => '',
|
580 |
+
'type' => 'textarea',
|
581 |
+
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
582 |
'custom_attributes'
|
583 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
584 |
+
'css' => 'width:30%;min-width:300px;',
|
585 |
),
|
586 |
|
|
|
|
|
|
|
587 |
array(
|
588 |
+
'title' => __( 'Remove from price', 'woocommerce-jetpack' ),
|
589 |
+
// 'desc' => __( 'Enable the Custom Price Labels feature', 'woocommerce-jetpack' ),
|
590 |
+
'desc_tip' => __( 'Enter text to remove from all products prices. Leave blank to disable.', 'woocommerce-jetpack' ),
|
591 |
+
'id' => 'wcj_global_price_labels_remove_text',
|
592 |
+
'default' => '',
|
593 |
+
'type' => 'textarea',
|
594 |
+
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
595 |
'custom_attributes'
|
596 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
597 |
+
'css' => 'width:30%;min-width:300px;',
|
598 |
),
|
599 |
|
600 |
array(
|
601 |
+
'title' => __( 'Replace in price', 'woocommerce-jetpack' ),
|
602 |
+
'desc_tip' => __( 'Enter text to replace in all products prices. Leave blank to disable.', 'woocommerce-jetpack' ),
|
603 |
+
'id' => 'wcj_global_price_labels_replace_text',
|
604 |
+
'default' => '',
|
605 |
+
'type' => 'textarea',
|
606 |
+
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
607 |
'custom_attributes'
|
608 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
609 |
+
'css' => 'width:30%;min-width:300px;',
|
610 |
),
|
611 |
|
612 |
array(
|
613 |
+
'title' => '',
|
614 |
+
'desc_tip' => __( 'Enter text to replace with. Leave blank to disable.', 'woocommerce-jetpack' ),
|
615 |
+
'id' => 'wcj_global_price_labels_replace_with_text',
|
616 |
+
'default' => '',
|
617 |
+
'type' => 'textarea',
|
618 |
+
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
619 |
'custom_attributes'
|
620 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
621 |
+
'css' => 'width:30%;min-width:300px;',
|
622 |
),
|
623 |
|
624 |
+
array(
|
625 |
+
'type' => 'sectionend',
|
626 |
+
'id' => 'wcj_global_price_labels_options',
|
627 |
+
),
|
628 |
|
629 |
array( 'title' => __( 'Migrate from Custom Price Labels (Pro) Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you enable "Migrate from Custom Price Labels (Pro)" tool.', 'woocommerce-jetpack' ), 'id' => 'wcj_migrate_from_custom_price_labels_options' ),
|
630 |
|
631 |
array(
|
632 |
+
'title' => __( 'Enable', 'woocommerce-jetpack' ),
|
633 |
+
'id' => 'wcj_migrate_from_custom_price_labels_enabled',
|
634 |
+
'default' => 'no',
|
635 |
+
'type' => 'checkbox',
|
636 |
),
|
637 |
|
638 |
array( 'type' => 'sectionend', 'id' => 'wcj_migrate_from_custom_price_labels_options' ),
|
includes/class-wcj-purchase-data.php
CHANGED
@@ -4,9 +4,9 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Purchase Data class.
|
6 |
*
|
7 |
-
* @version
|
8 |
-
* @since
|
9 |
-
* @author
|
10 |
*/
|
11 |
|
12 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
@@ -17,6 +17,8 @@ class WCJ_Purchase_Data extends WCJ_Module {
|
|
17 |
|
18 |
/**
|
19 |
* Constructor.
|
|
|
|
|
20 |
*/
|
21 |
public function __construct() {
|
22 |
|
@@ -33,9 +35,58 @@ class WCJ_Purchase_Data extends WCJ_Module {
|
|
33 |
//}
|
34 |
|
35 |
//add_action( 'init', array( $this, 'calculate_all_products_profit' ) );
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
/**
|
40 |
* get_options.
|
41 |
*/
|
@@ -252,13 +303,33 @@ class WCJ_Purchase_Data extends WCJ_Module {
|
|
252 |
//die();
|
253 |
}
|
254 |
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
return $this->add_enable_module_setting( $settings );
|
261 |
-
|
262 |
}
|
263 |
|
264 |
endif;
|
4 |
*
|
5 |
* The WooCommerce Jetpack Purchase Data class.
|
6 |
*
|
7 |
+
* @version 2.2.4
|
8 |
+
* @since 2.2.0
|
9 |
+
* @author Algoritmika Ltd.
|
10 |
*/
|
11 |
|
12 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
17 |
|
18 |
/**
|
19 |
* Constructor.
|
20 |
+
*
|
21 |
+
* @version 2.2.4
|
22 |
*/
|
23 |
public function __construct() {
|
24 |
|
35 |
//}
|
36 |
|
37 |
//add_action( 'init', array( $this, 'calculate_all_products_profit' ) );
|
38 |
+
|
39 |
+
if ( 'yes' === get_option( 'wcj_purchase_data_custom_columns_profit', 'no' ) ) {
|
40 |
+
add_filter( 'manage_edit-shop_order_columns', array( $this, 'add_order_columns' ), PHP_INT_MAX );
|
41 |
+
add_action( 'manage_shop_order_posts_custom_column', array( $this, 'render_order_columns' ), PHP_INT_MAX );
|
42 |
+
}
|
43 |
}
|
44 |
}
|
45 |
|
46 |
+
/**
|
47 |
+
* add_order_columns.
|
48 |
+
*
|
49 |
+
* @since 2.2.4
|
50 |
+
*/
|
51 |
+
function add_order_columns( $columns ) {
|
52 |
+
$columns['profit'] = __( 'Profit', 'woocommerce-jetpack' );
|
53 |
+
return $columns;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Output custom columns for orders
|
58 |
+
* @param string $column
|
59 |
+
*
|
60 |
+
* @since 2.2.4
|
61 |
+
*/
|
62 |
+
public function render_order_columns( $column ) {
|
63 |
+
|
64 |
+
if ( 'profit' === $column ) {
|
65 |
+
$total_profit = 0;
|
66 |
+
$the_order = wc_get_order( get_the_ID() );
|
67 |
+
if ( 'completed' === $the_order->get_status() ) {
|
68 |
+
$is_forecasted = false;
|
69 |
+
foreach ( $the_order->get_items() as $item_id => $item ) {
|
70 |
+
// $product = $this->get_product_from_item( $item );
|
71 |
+
if ( 0 != ( $purchase_price = wc_get_product_purchase_price( $item['product_id'] ) ) ) {
|
72 |
+
$the_profit = ( $item['line_total'] + $item['line_tax'] ) - $purchase_price * $item['qty'];
|
73 |
+
// $total_profit += $the_profit;
|
74 |
+
// echo $item['line_total'] . ' ~ ' . $purchase_price . ' ~ ' . $item['qty'];
|
75 |
+
} else {
|
76 |
+
//$the_profit = ( $item['line_total'] + $item['line_tax'] ) * 0.2;
|
77 |
+
$is_forecasted = true;
|
78 |
+
}
|
79 |
+
$total_profit += $the_profit;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
if ( 0 != $total_profit ) {
|
83 |
+
if ( ! $is_forecasted ) echo '<span style="color:green;">';
|
84 |
+
echo wc_price( $total_profit );
|
85 |
+
if ( ! $is_forecasted ) echo '</span>';
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
/**
|
91 |
* get_options.
|
92 |
*/
|
303 |
//die();
|
304 |
}
|
305 |
|
306 |
+
/**
|
307 |
+
* get_settings.
|
308 |
+
*
|
309 |
+
* @version 2.2.4
|
310 |
+
*/
|
311 |
+
function get_settings() {
|
312 |
+
$settings = array(
|
313 |
+
array(
|
314 |
+
'title' => __( 'Orders List Custom Columns', 'woocommerce-jetpack' ),
|
315 |
+
'type' => 'title',
|
316 |
+
'desc' => __( 'This section lets you add custom columns to WooCommerce orders list.', 'woocommerce-jetpack' ),
|
317 |
+
'id' => 'wcj_purchase_data_custom_columns_options',
|
318 |
+
),
|
319 |
+
array(
|
320 |
+
'title' => __( 'Profit', 'woocommerce-jetpack' ),
|
321 |
+
'desc' => __( 'Add', 'woocommerce-jetpack' ),
|
322 |
+
'id' => 'wcj_purchase_data_custom_columns_profit',
|
323 |
+
'default' => 'yes',
|
324 |
+
'type' => 'checkbox',
|
325 |
+
),
|
326 |
+
array(
|
327 |
+
'type' => 'sectionend',
|
328 |
+
'id' => 'wcj_purchase_data_custom_columns_options',
|
329 |
+
),
|
330 |
+
);
|
331 |
return $this->add_enable_module_setting( $settings );
|
332 |
+
}
|
333 |
}
|
334 |
|
335 |
endif;
|
includes/class-wcj-reports.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Reports class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -39,6 +39,7 @@ class WCJ_Reports {
|
|
39 |
include_once( 'reports/wcj-class-reports-stock.php' );
|
40 |
|
41 |
add_action( 'admin_bar_menu', array( $this, 'add_custom_order_reports_ranges_to_admin_bar' ), PHP_INT_MAX );
|
|
|
42 |
}
|
43 |
}
|
44 |
|
@@ -48,6 +49,44 @@ class WCJ_Reports {
|
|
48 |
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 ); // Add Enable option to Jetpack Settings Dashboard
|
49 |
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
/**
|
52 |
* add_custom_order_reports_ranges_to_admin_bar.
|
53 |
*/
|
4 |
*
|
5 |
* The WooCommerce Jetpack Reports class.
|
6 |
*
|
7 |
+
* @version 2.2.4
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
39 |
include_once( 'reports/wcj-class-reports-stock.php' );
|
40 |
|
41 |
add_action( 'admin_bar_menu', array( $this, 'add_custom_order_reports_ranges_to_admin_bar' ), PHP_INT_MAX );
|
42 |
+
add_action( 'admin_bar_menu', array( $this, 'add_custom_order_reports_ranges_by_month_to_admin_bar' ), PHP_INT_MAX );
|
43 |
}
|
44 |
}
|
45 |
|
49 |
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 ); // Add Enable option to Jetpack Settings Dashboard
|
50 |
}
|
51 |
|
52 |
+
/**
|
53 |
+
* add_custom_order_reports_ranges_by_month_to_admin_bar.
|
54 |
+
*
|
55 |
+
* @version 2.2.4
|
56 |
+
* @since 2.2.4
|
57 |
+
*/
|
58 |
+
public function add_custom_order_reports_ranges_by_month_to_admin_bar( $wp_admin_bar ) {
|
59 |
+
$is_reports = ( isset( $_GET['page'] ) && 'wc-reports' === $_GET['page'] ) ? true : false;
|
60 |
+
$is_orders_reports = ( isset( $_GET['tab'] ) && 'orders' === $_GET['tab'] || ! isset( $_GET['tab'] ) ) ? true : false;
|
61 |
+
if ( $is_reports && $is_orders_reports ) {
|
62 |
+
|
63 |
+
$parent = 'reports_orders_more_ranges_months';
|
64 |
+
$args = array(
|
65 |
+
'parent' => false,
|
66 |
+
'id' => $parent,
|
67 |
+
'title' => __( 'WooJetpack: More Ranges - Months', 'woocommerce-jetpack' ),
|
68 |
+
'href' => false,
|
69 |
+
'meta' => array( 'title' => __( 'Select Range', 'woocommerce-jetpack' ), ),
|
70 |
+
);
|
71 |
+
$wp_admin_bar->add_node( $args );
|
72 |
+
|
73 |
+
for ( $i = 1; $i <= 12; $i++ ) {
|
74 |
+
$month_start_date = date( 'Y-m-01' ) . "-$i months";
|
75 |
+
$month_num = date( 'm', strtotime( $month_start_date ) );
|
76 |
+
$month_name = date( 'Y F', strtotime( $month_start_date ) );
|
77 |
+
$start_date = date( 'Y-m-01', strtotime( $month_start_date ) );
|
78 |
+
$end_date = date( 'Y-m-t', strtotime( $month_start_date ) );
|
79 |
+
$node = array(
|
80 |
+
'parent' => $parent,
|
81 |
+
'id' => $parent . '_' . $month_num,
|
82 |
+
'title' => $month_name,
|
83 |
+
'href' => add_query_arg( array( 'range' => 'custom', 'start_date' => $start_date, 'end_date' => $end_date ) ),
|
84 |
+
'meta' => array( 'title' => $month_name ),
|
85 |
+
);
|
86 |
+
$wp_admin_bar->add_node( $node );
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
/**
|
91 |
* add_custom_order_reports_ranges_to_admin_bar.
|
92 |
*/
|
includes/class-wcj-sorting.php
CHANGED
@@ -4,10 +4,8 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Sorting class.
|
6 |
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @category Class
|
10 |
-
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
@@ -15,60 +13,42 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
15 |
|
16 |
if ( ! class_exists( 'WCJ_Sorting' ) ) :
|
17 |
|
18 |
-
class WCJ_Sorting {
|
19 |
|
20 |
/**
|
21 |
* WCJ_Sorting Constructor.
|
22 |
-
*
|
|
|
|
|
23 |
*/
|
24 |
public function __construct() {
|
25 |
|
26 |
-
|
|
|
|
|
|
|
27 |
|
28 |
-
|
29 |
-
if ( 'yes' === get_option( 'wcj_sorting_enabled' ) ) {
|
30 |
|
31 |
if ( 'yes' === get_option( 'wcj_more_sorting_enabled' ) ) {
|
32 |
-
|
33 |
-
add_filter( '
|
34 |
-
|
35 |
-
add_filter( 'woocommerce_catalog_orderby', array( $this, 'custom_woocommerce_catalog_orderby' ), 100 );
|
36 |
-
// Back end (default sorting)
|
37 |
-
add_filter( 'woocommerce_default_catalog_orderby_options', array( $this, 'custom_woocommerce_catalog_orderby' ), 100 );
|
38 |
}
|
39 |
|
40 |
if ( 'yes' === get_option( 'wcj_sorting_remove_all_enabled' ) ) {
|
41 |
// Remove sorting
|
42 |
add_action( apply_filters( 'wcj_get_option_filter', 'wcj_empty_action', 'init' ), array( $this, 'remove_sorting' ), 100 );
|
43 |
}
|
44 |
-
|
45 |
-
// Add 'Remove All Sorting' checkbox to WooCommerce > Settings > Products
|
46 |
add_filter( 'woocommerce_product_settings', array( $this, 'add_remove_sorting_checkbox' ), 100 );
|
47 |
}
|
48 |
-
|
49 |
-
// Settings hooks
|
50 |
-
// Add section to WooCommerce > Settings > Jetpack
|
51 |
-
add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
|
52 |
-
// Add the settings
|
53 |
-
add_filter( 'wcj_settings_sorting', array( $this, 'get_settings' ), 100 );
|
54 |
-
// Add Enable option to Jetpack Settings Dashboard
|
55 |
-
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
56 |
}
|
57 |
|
58 |
/**
|
59 |
-
*
|
60 |
*/
|
61 |
-
public function add_enabled_option( $settings ) {
|
62 |
-
|
63 |
-
$all_settings = $this->get_settings();
|
64 |
-
$settings[] = $all_settings[1];
|
65 |
-
|
66 |
-
return $settings;
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Unlocks - Sorting - remove_sorting.
|
71 |
-
*/
|
72 |
public function remove_sorting() {
|
73 |
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
|
74 |
}
|
@@ -77,27 +57,21 @@ class WCJ_Sorting {
|
|
77 |
* Add Remove All Sorting checkbox to WooCommerce > Settings > Products.
|
78 |
*/
|
79 |
function add_remove_sorting_checkbox( $settings ) {
|
80 |
-
|
81 |
$updated_settings = array();
|
82 |
-
|
83 |
foreach ( $settings as $section ) {
|
84 |
-
|
85 |
if ( isset( $section['id'] ) && 'woocommerce_cart_redirect_after_add' == $section['id'] ) {
|
86 |
-
|
87 |
$updated_settings[] = array(
|
88 |
-
'title'
|
89 |
-
'id'
|
90 |
-
'type'
|
91 |
-
'default'
|
92 |
-
'desc'
|
93 |
-
'custom_attributes'
|
94 |
-
'desc_tip'
|
95 |
);
|
96 |
}
|
97 |
-
|
98 |
$updated_settings[] = $section;
|
99 |
}
|
100 |
-
|
101 |
return $updated_settings;
|
102 |
}
|
103 |
|
@@ -110,38 +84,37 @@ class WCJ_Sorting {
|
|
110 |
do_action( 'wcj_sorting_remove_action' );
|
111 |
}
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
/*
|
114 |
* Add new sorting options to Front End and to Back End (in WooCommerce > Settings > Products > Default Product Sorting).
|
|
|
|
|
115 |
*/
|
116 |
function custom_woocommerce_catalog_orderby( $sortby ) {
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
if ( '' != get_option( 'wcj_sorting_by_name_desc_text' ) )
|
124 |
-
$sortby['title_desc'] = get_option( 'wcj_sorting_by_name_desc_text' );
|
125 |
-
|
126 |
-
//if ( get_option( 'wcj_sorting_by_sku_asc_enabled' ) == 'yes' )
|
127 |
-
if ( '' != get_option( 'wcj_sorting_by_sku_asc_text' ) )
|
128 |
-
$sortby['sku_asc'] = get_option( 'wcj_sorting_by_sku_asc_text' );
|
129 |
-
|
130 |
-
//if ( 'yes' == get_option( 'wcj_sorting_by_sku_desc_enabled' ) )
|
131 |
-
if ( '' != get_option( 'wcj_sorting_by_sku_desc_text' ) )
|
132 |
-
$sortby['sku_desc'] = get_option( 'wcj_sorting_by_sku_desc_text' );
|
133 |
-
|
134 |
-
if ( '' != get_option( 'wcj_sorting_by_stock_quantity_asc_text' ) )
|
135 |
-
$sortby['stock_quantity_asc'] = get_option( 'wcj_sorting_by_stock_quantity_asc_text' );
|
136 |
-
|
137 |
-
if ( '' != get_option( 'wcj_sorting_by_stock_quantity_desc_text' ) )
|
138 |
-
$sortby['stock_quantity_desc'] = get_option( 'wcj_sorting_by_stock_quantity_desc_text' );
|
139 |
-
|
140 |
return $sortby;
|
141 |
}
|
142 |
|
143 |
/*
|
144 |
* Add new sorting options to WooCommerce sorting.
|
|
|
|
|
145 |
*/
|
146 |
function custom_woocommerce_get_catalog_ordering_args( $args ) {
|
147 |
|
@@ -164,22 +137,22 @@ class WCJ_Sorting {
|
|
164 |
$args['meta_key'] = '';
|
165 |
break;
|
166 |
case 'sku_asc':
|
167 |
-
$args['orderby'] = 'meta_value';
|
168 |
$args['order'] = 'asc';
|
169 |
$args['meta_key'] = '_sku';
|
170 |
break;
|
171 |
case 'sku_desc':
|
172 |
-
$args['orderby'] = 'meta_value';
|
173 |
$args['order'] = 'desc';
|
174 |
$args['meta_key'] = '_sku';
|
175 |
break;
|
176 |
case 'stock_quantity_asc':
|
177 |
-
$args['orderby'] = '
|
178 |
$args['order'] = 'asc';
|
179 |
$args['meta_key'] = '_stock';
|
180 |
break;
|
181 |
case 'stock_quantity_desc':
|
182 |
-
$args['orderby'] = '
|
183 |
$args['order'] = 'desc';
|
184 |
$args['meta_key'] = '_stock';
|
185 |
break;
|
@@ -190,122 +163,131 @@ class WCJ_Sorting {
|
|
190 |
|
191 |
/*
|
192 |
* Add the settings.
|
|
|
|
|
193 |
*/
|
194 |
function get_settings() {
|
195 |
|
196 |
$settings = array(
|
197 |
|
198 |
-
array( 'title' => __( 'Sorting Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_sorting_options' ),
|
199 |
-
|
200 |
array(
|
201 |
-
'title'
|
202 |
-
'
|
203 |
-
'
|
204 |
-
'id'
|
205 |
-
'default' => 'no',
|
206 |
-
'type' => 'checkbox'
|
207 |
),
|
208 |
|
209 |
-
array( 'type' => 'sectionend', 'id' => 'wcj_sorting_options' ),
|
210 |
-
|
211 |
-
array( 'title' => __( 'Remove All Sorting', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_remove_all_sorting_options' ),
|
212 |
-
|
213 |
array(
|
214 |
-
'title'
|
215 |
-
'desc'
|
216 |
-
'desc_tip'
|
217 |
-
'id'
|
218 |
-
'default'
|
219 |
-
'type'
|
220 |
'custom_attributes'
|
221 |
-
|
222 |
),
|
223 |
|
224 |
-
array(
|
|
|
|
|
|
|
225 |
|
226 |
-
array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
|
228 |
array(
|
229 |
-
'title'
|
230 |
-
'desc'
|
231 |
-
'
|
232 |
-
'
|
233 |
-
'
|
|
|
|
|
234 |
),
|
235 |
|
236 |
array(
|
237 |
-
'title'
|
238 |
-
'desc'
|
239 |
-
'desc_tip'
|
240 |
-
'id'
|
241 |
-
'default'
|
242 |
-
'type'
|
243 |
-
'css'
|
244 |
),
|
245 |
|
246 |
array(
|
247 |
-
'title'
|
248 |
-
'desc'
|
249 |
-
'desc_tip'
|
250 |
-
'id'
|
251 |
-
'default'
|
252 |
-
'type'
|
253 |
-
'css'
|
254 |
),
|
255 |
|
256 |
array(
|
257 |
-
'title'
|
258 |
-
'desc'
|
259 |
-
'desc_tip'
|
260 |
-
'id'
|
261 |
-
'default'
|
262 |
-
'type'
|
263 |
-
'css'
|
264 |
),
|
265 |
|
266 |
array(
|
267 |
-
'title'
|
268 |
-
'desc'
|
269 |
-
'
|
270 |
-
'
|
271 |
-
'
|
272 |
-
'
|
273 |
-
'
|
|
|
274 |
),
|
275 |
|
276 |
array(
|
277 |
-
'title'
|
278 |
-
'desc'
|
279 |
-
'desc_tip'
|
280 |
-
'id'
|
281 |
-
'default'
|
282 |
-
'type'
|
283 |
-
'css'
|
284 |
),
|
285 |
|
286 |
array(
|
287 |
-
'title'
|
288 |
-
'desc'
|
289 |
-
'desc_tip'
|
290 |
-
'id'
|
291 |
-
'default'
|
292 |
-
'type'
|
293 |
-
'css'
|
294 |
),
|
295 |
|
296 |
-
array(
|
|
|
|
|
|
|
297 |
);
|
298 |
|
299 |
-
return $settings;
|
300 |
}
|
301 |
|
302 |
-
/*
|
303 |
-
* Add settings section to WooCommerce > Settings > Jetpack.
|
304 |
-
*/
|
305 |
-
function settings_section( $sections ) {
|
306 |
-
$sections['sorting'] = __( 'Sorting', 'woocommerce-jetpack' );
|
307 |
-
return $sections;
|
308 |
-
}
|
309 |
}
|
310 |
|
311 |
endif;
|
4 |
*
|
5 |
* The WooCommerce Jetpack Sorting class.
|
6 |
*
|
7 |
+
* @version 2.2.4
|
8 |
+
* @author Algoritmika Ltd.
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
13 |
|
14 |
if ( ! class_exists( 'WCJ_Sorting' ) ) :
|
15 |
|
16 |
+
class WCJ_Sorting extends WCJ_Module {
|
17 |
|
18 |
/**
|
19 |
* WCJ_Sorting Constructor.
|
20 |
+
*
|
21 |
+
* @access public
|
22 |
+
* @version 2.2.4
|
23 |
*/
|
24 |
public function __construct() {
|
25 |
|
26 |
+
$this->id = 'sorting';
|
27 |
+
$this->short_desc = __( 'Sorting', 'woocommerce-jetpack' );
|
28 |
+
$this->desc = __( 'Add more WooCommerce sorting options or remove all sorting including default.', 'woocommerce-jetpack' );
|
29 |
+
parent::__construct();
|
30 |
|
31 |
+
if ( $this->is_enabled() ) {
|
|
|
32 |
|
33 |
if ( 'yes' === get_option( 'wcj_more_sorting_enabled' ) ) {
|
34 |
+
add_filter( 'woocommerce_get_catalog_ordering_args', array( $this, 'custom_woocommerce_get_catalog_ordering_args' ), 100 );// Sorting
|
35 |
+
add_filter( 'woocommerce_catalog_orderby', array( $this, 'custom_woocommerce_catalog_orderby' ), 100 );// Front end
|
36 |
+
add_filter( 'woocommerce_default_catalog_orderby_options', array( $this, 'custom_woocommerce_catalog_orderby' ), 100 );// Back end (default sorting)
|
|
|
|
|
|
|
37 |
}
|
38 |
|
39 |
if ( 'yes' === get_option( 'wcj_sorting_remove_all_enabled' ) ) {
|
40 |
// Remove sorting
|
41 |
add_action( apply_filters( 'wcj_get_option_filter', 'wcj_empty_action', 'init' ), array( $this, 'remove_sorting' ), 100 );
|
42 |
}
|
43 |
+
|
44 |
+
// Settings: Add 'Remove All Sorting' checkbox to WooCommerce > Settings > Products
|
45 |
add_filter( 'woocommerce_product_settings', array( $this, 'add_remove_sorting_checkbox' ), 100 );
|
46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
+
* Unlocks - Sorting - remove_sorting.
|
51 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
public function remove_sorting() {
|
53 |
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
|
54 |
}
|
57 |
* Add Remove All Sorting checkbox to WooCommerce > Settings > Products.
|
58 |
*/
|
59 |
function add_remove_sorting_checkbox( $settings ) {
|
|
|
60 |
$updated_settings = array();
|
|
|
61 |
foreach ( $settings as $section ) {
|
|
|
62 |
if ( isset( $section['id'] ) && 'woocommerce_cart_redirect_after_add' == $section['id'] ) {
|
|
|
63 |
$updated_settings[] = array(
|
64 |
+
'title' => __( 'WooJetpack: Remove All Sorting', 'woocommerce-jetpack' ),
|
65 |
+
'id' => 'wcj_sorting_remove_all_enabled',
|
66 |
+
'type' => 'checkbox',
|
67 |
+
'default' => 'no',
|
68 |
+
'desc' => __( 'Completely remove sorting from the shop front end', 'woocommerce-jetpack' ),
|
69 |
+
'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
70 |
+
'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
71 |
);
|
72 |
}
|
|
|
73 |
$updated_settings[] = $section;
|
74 |
}
|
|
|
75 |
return $updated_settings;
|
76 |
}
|
77 |
|
84 |
do_action( 'wcj_sorting_remove_action' );
|
85 |
}
|
86 |
|
87 |
+
/*
|
88 |
+
* maybe_add_sorting.
|
89 |
+
*
|
90 |
+
* @since 2.2.4
|
91 |
+
*/
|
92 |
+
private function maybe_add_sorting( $sortby, $option_name, $key ) {
|
93 |
+
if ( '' != get_option( $option_name ) ) {
|
94 |
+
$sortby[ $key ] = get_option( $option_name );
|
95 |
+
}
|
96 |
+
return $sortby;
|
97 |
+
}
|
98 |
+
|
99 |
/*
|
100 |
* Add new sorting options to Front End and to Back End (in WooCommerce > Settings > Products > Default Product Sorting).
|
101 |
+
*
|
102 |
+
* @version 2.2.4
|
103 |
*/
|
104 |
function custom_woocommerce_catalog_orderby( $sortby ) {
|
105 |
+
$sortby = $this->maybe_add_sorting( $sortby, 'wcj_sorting_by_name_asc_text', 'title_asc' );
|
106 |
+
$sortby = $this->maybe_add_sorting( $sortby, 'wcj_sorting_by_name_desc_text', 'title_desc' );
|
107 |
+
$sortby = $this->maybe_add_sorting( $sortby, 'wcj_sorting_by_sku_asc_text', 'sku_asc' );
|
108 |
+
$sortby = $this->maybe_add_sorting( $sortby, 'wcj_sorting_by_sku_desc_text', 'sku_desc' );
|
109 |
+
$sortby = $this->maybe_add_sorting( $sortby, 'wcj_sorting_by_stock_quantity_asc_text', 'stock_quantity_asc' );
|
110 |
+
$sortby = $this->maybe_add_sorting( $sortby, 'wcj_sorting_by_stock_quantity_desc_text', 'stock_quantity_desc' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
return $sortby;
|
112 |
}
|
113 |
|
114 |
/*
|
115 |
* Add new sorting options to WooCommerce sorting.
|
116 |
+
*
|
117 |
+
* @version 2.2.4
|
118 |
*/
|
119 |
function custom_woocommerce_get_catalog_ordering_args( $args ) {
|
120 |
|
137 |
$args['meta_key'] = '';
|
138 |
break;
|
139 |
case 'sku_asc':
|
140 |
+
$args['orderby'] = ( 'no' === apply_filters( 'wcj_get_option_filter', 'no', get_option( 'wcj_sorting_by_sku_num_enabled', 'no' ) ) ) ? 'meta_value' : 'meta_value_num';
|
141 |
$args['order'] = 'asc';
|
142 |
$args['meta_key'] = '_sku';
|
143 |
break;
|
144 |
case 'sku_desc':
|
145 |
+
$args['orderby'] = ( 'no' === apply_filters( 'wcj_get_option_filter', 'no', get_option( 'wcj_sorting_by_sku_num_enabled', 'no' ) ) ) ? 'meta_value' : 'meta_value_num';
|
146 |
$args['order'] = 'desc';
|
147 |
$args['meta_key'] = '_sku';
|
148 |
break;
|
149 |
case 'stock_quantity_asc':
|
150 |
+
$args['orderby'] = 'meta_value_num';
|
151 |
$args['order'] = 'asc';
|
152 |
$args['meta_key'] = '_stock';
|
153 |
break;
|
154 |
case 'stock_quantity_desc':
|
155 |
+
$args['orderby'] = 'meta_value_num';
|
156 |
$args['order'] = 'desc';
|
157 |
$args['meta_key'] = '_stock';
|
158 |
break;
|
163 |
|
164 |
/*
|
165 |
* Add the settings.
|
166 |
+
*
|
167 |
+
* @version 2.2.4
|
168 |
*/
|
169 |
function get_settings() {
|
170 |
|
171 |
$settings = array(
|
172 |
|
|
|
|
|
173 |
array(
|
174 |
+
'title' => __( 'Remove All Sorting', 'woocommerce-jetpack' ),
|
175 |
+
'type' => 'title',
|
176 |
+
'desc' => '',
|
177 |
+
'id' => 'wcj_remove_all_sorting_options'
|
|
|
|
|
178 |
),
|
179 |
|
|
|
|
|
|
|
|
|
180 |
array(
|
181 |
+
'title' => __( 'Remove All Sorting', 'woocommerce-jetpack' ),
|
182 |
+
'desc' => __( 'Remove all sorting (including WooCommerce default)', 'woocommerce-jetpack' ),
|
183 |
+
'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
184 |
+
'id' => 'wcj_sorting_remove_all_enabled',
|
185 |
+
'default' => 'no',
|
186 |
+
'type' => 'checkbox',
|
187 |
'custom_attributes'
|
188 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
189 |
),
|
190 |
|
191 |
+
array(
|
192 |
+
'type' => 'sectionend',
|
193 |
+
'id' => 'wcj_remove_all_sorting_options'
|
194 |
+
),
|
195 |
|
196 |
+
array(
|
197 |
+
'title' => __( 'Add More Sorting', 'woocommerce-jetpack' ),
|
198 |
+
'type' => 'title',
|
199 |
+
'desc' => '',
|
200 |
+
'id' => 'wcj_more_sorting_options'
|
201 |
+
),
|
202 |
+
|
203 |
+
array(
|
204 |
+
'title' => __( 'Add More Sorting', 'woocommerce-jetpack' ),
|
205 |
+
'desc' => __( 'Enable', 'woocommerce-jetpack' ),
|
206 |
+
'id' => 'wcj_more_sorting_enabled',
|
207 |
+
'default' => 'yes',
|
208 |
+
'type' => 'checkbox'
|
209 |
+
),
|
210 |
|
211 |
array(
|
212 |
+
'title' => __( 'Sort by Name', 'woocommerce-jetpack' ),
|
213 |
+
'desc' => __( 'Default: ', 'woocommerce-jetpack' ) . __( 'Sort by title: A to Z', 'woocommerce-jetpack' ),
|
214 |
+
'desc_tip' => __( 'Text to show on frontend. Leave blank to disable.', 'woocommerce-jetpack' ),
|
215 |
+
'id' => 'wcj_sorting_by_name_asc_text',
|
216 |
+
'default' => __( 'Sort by title: A to Z', 'woocommerce-jetpack' ),
|
217 |
+
'type' => 'text',
|
218 |
+
'css' => 'min-width:300px;',
|
219 |
),
|
220 |
|
221 |
array(
|
222 |
+
'title' => '',//__( 'Sort by Name - Desc', 'woocommerce-jetpack' ),
|
223 |
+
'desc' => __( 'Default: ', 'woocommerce-jetpack' ) . __( 'Sort by title: Z to A', 'woocommerce-jetpack' ),
|
224 |
+
'desc_tip' => __( 'Text to show on frontend. Leave blank to disable.', 'woocommerce-jetpack' ),
|
225 |
+
'id' => 'wcj_sorting_by_name_desc_text',
|
226 |
+
'default' => __( 'Sort by title: Z to A', 'woocommerce-jetpack' ),
|
227 |
+
'type' => 'text',
|
228 |
+
'css' => 'min-width:300px;',
|
229 |
),
|
230 |
|
231 |
array(
|
232 |
+
'title' => __( 'Sort by SKU', 'woocommerce-jetpack' ),
|
233 |
+
'desc' => __( 'Default: ', 'woocommerce-jetpack' ) . __( 'Sort by SKU: low to high', 'woocommerce-jetpack' ),
|
234 |
+
'desc_tip' => __( 'Text to show on frontend. Leave blank to disable.', 'woocommerce-jetpack' ),
|
235 |
+
'id' => 'wcj_sorting_by_sku_asc_text',
|
236 |
+
'default' => __( 'Sort by SKU: low to high', 'woocommerce-jetpack' ),
|
237 |
+
'type' => 'text',
|
238 |
+
'css' => 'min-width:300px;',
|
239 |
),
|
240 |
|
241 |
array(
|
242 |
+
'title' => '',//__( 'Sort by SKU - Desc', 'woocommerce-jetpack' ),
|
243 |
+
'desc' => __( 'Default: ', 'woocommerce-jetpack' ) . __( 'Sort by SKU: high to low', 'woocommerce-jetpack' ),
|
244 |
+
'desc_tip' => __( 'Text to show on frontend. Leave blank to disable.', 'woocommerce-jetpack' ),
|
245 |
+
'id' => 'wcj_sorting_by_sku_desc_text',
|
246 |
+
'default' => __( 'Sort by SKU: high to low', 'woocommerce-jetpack' ),
|
247 |
+
'type' => 'text',
|
248 |
+
'css' => 'min-width:300px;',
|
249 |
),
|
250 |
|
251 |
array(
|
252 |
+
'title' => '',
|
253 |
+
'desc' => __( 'Sort SKUs as numbers instead of as texts', 'woocommerce-jetpack' ),
|
254 |
+
'id' => 'wcj_sorting_by_sku_num_enabled',
|
255 |
+
'default' => 'no',
|
256 |
+
'type' => 'checkbox',
|
257 |
+
'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
258 |
+
'custom_attributes'
|
259 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
260 |
),
|
261 |
|
262 |
array(
|
263 |
+
'title' => __( 'Sort by stock quantity', 'woocommerce-jetpack' ),
|
264 |
+
'desc' => __( 'Default: ', 'woocommerce-jetpack' ) . __( 'Sort by stock quantity: low to high', 'woocommerce-jetpack' ),
|
265 |
+
'desc_tip' => __( 'Text to show on frontend. Leave blank to disable.', 'woocommerce-jetpack' ),
|
266 |
+
'id' => 'wcj_sorting_by_stock_quantity_asc_text',
|
267 |
+
'default' => __( 'Sort by stock quantity: low to high', 'woocommerce-jetpack' ),
|
268 |
+
'type' => 'text',
|
269 |
+
'css' => 'min-width:300px;',
|
270 |
),
|
271 |
|
272 |
array(
|
273 |
+
'title' => '',//__( 'Sort by stock quantity - Desc', 'woocommerce-jetpack' ),
|
274 |
+
'desc' => __( 'Default: ', 'woocommerce-jetpack' ) . __( 'Sort by stock quantity: high to low', 'woocommerce-jetpack' ),
|
275 |
+
'desc_tip' => __( 'Text to show on frontend. Leave blank to disable.', 'woocommerce-jetpack' ),
|
276 |
+
'id' => 'wcj_sorting_by_stock_quantity_desc_text',
|
277 |
+
'default' => __( 'Sort by stock quantity: high to low', 'woocommerce-jetpack' ),
|
278 |
+
'type' => 'text',
|
279 |
+
'css' => 'min-width:300px;',
|
280 |
),
|
281 |
|
282 |
+
array(
|
283 |
+
'type' => 'sectionend',
|
284 |
+
'id' => 'wcj_more_sorting_options'
|
285 |
+
),
|
286 |
);
|
287 |
|
288 |
+
return $this->add_enable_module_setting( $settings );
|
289 |
}
|
290 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
}
|
292 |
|
293 |
endif;
|
includes/class-wcj-wpml.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack WPML class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @since 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
@@ -22,7 +22,7 @@ class WCJ_WPML extends WCJ_Module {
|
|
22 |
|
23 |
$this->id = 'wpml';
|
24 |
$this->short_desc = __( 'WPML', 'woocommerce-jetpack' );
|
25 |
-
$this->desc = __( '
|
26 |
parent::__construct();
|
27 |
|
28 |
if ( $this->is_enabled() ) {
|
4 |
*
|
5 |
* The WooCommerce Jetpack WPML class.
|
6 |
*
|
7 |
+
* @version 2.2.4
|
8 |
* @since 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
22 |
|
23 |
$this->id = 'wpml';
|
24 |
$this->short_desc = __( 'WPML', 'woocommerce-jetpack' );
|
25 |
+
$this->desc = __( 'Booster for WooCommerce basic WPML support.', 'woocommerce-jetpack' );
|
26 |
parent::__construct();
|
27 |
|
28 |
if ( $this->is_enabled() ) {
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
=== WooCommerce
|
2 |
Contributors: algoritmika
|
3 |
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,payment gateway fee,
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.2
|
7 |
-
Stable tag: 2.2.
|
8 |
License: GNU General Public License v3.0
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -12,7 +12,7 @@ Supercharge your WordPress WooCommerce site with these awesome powerful features
|
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
WooCommerce
|
16 |
|
17 |
= Features =
|
18 |
|
@@ -50,7 +50,7 @@ WooCommerce Jetpack is a WordPress plugin that supercharges your site with aweso
|
|
50 |
* *Checkout Core Fields* - Customize WooCommerce core checkout fields. Disable/enable fields, set required, change labels and/or placeholders.
|
51 |
* *Checkout Custom Fields* - Add custom fields to WooCommerce checkout page.
|
52 |
* *Checkout Custom Info* - Add custom info to WooCommerce checkout page.
|
53 |
-
* *Custom Payment Gateways* - Add
|
54 |
* *Empty Cart Button* - Add and customize "Empty Cart" button to cart page.
|
55 |
* *Mini Cart* - Customize WooCommerce mini cart widget.
|
56 |
* *Payment Gateways Fees* - Enable extra fees for WooCommerce payment gateways.
|
@@ -108,8 +108,20 @@ To unlock all WooCommerce Jetpack features, please install additional <a href="h
|
|
108 |
|
109 |
== Changelog ==
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
= 2.2.3 - 27/07/2015 =
|
112 |
-
* Fix - https://wordpress.org/support/topic/custom-payment-gateway-settings-disappeared-after-last-update
|
113 |
* Fix - CART & CHECKOUT - Payment Gateways Fees - Fee removed if current payment gateway is not available for user selected shipping method.
|
114 |
* Fix - CART & CHECKOUT - Payment Gateways Fees - "Tax class" (and "Is taxable") bug fixed.
|
115 |
* Dev - Tools (SKU and Admin) moved to each module's settings.
|
1 |
+
=== Booster for WooCommerce ===
|
2 |
Contributors: algoritmika
|
3 |
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,payment gateway fee,
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.2
|
7 |
+
Stable tag: 2.2.4
|
8 |
License: GNU General Public License v3.0
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
Booster for WooCommerce is a WordPress plugin that supercharges your site with awesome powerful features. Features are absolutely required for anyone using excellent WooCommerce platform.
|
16 |
|
17 |
= Features =
|
18 |
|
50 |
* *Checkout Core Fields* - Customize WooCommerce core checkout fields. Disable/enable fields, set required, change labels and/or placeholders.
|
51 |
* *Checkout Custom Fields* - Add custom fields to WooCommerce checkout page.
|
52 |
* *Checkout Custom Info* - Add custom info to WooCommerce checkout page.
|
53 |
+
* *Custom Payment Gateways* - Add multiple custom payment gateways to WooCommerce.
|
54 |
* *Empty Cart Button* - Add and customize "Empty Cart" button to cart page.
|
55 |
* *Mini Cart* - Customize WooCommerce mini cart widget.
|
56 |
* *Payment Gateways Fees* - Enable extra fees for WooCommerce payment gateways.
|
108 |
|
109 |
== Changelog ==
|
110 |
|
111 |
+
= 2.2.4 - 01/08/2015 =
|
112 |
+
* Dev - Plugin renamed from "WooCommerce Jetpack" to "Booster for WooCommerce" (`name_changed_notice` added).
|
113 |
+
* Dev - PRODUCTS - Sorting - "Sort SKUs as numbers instead of as texts" option added.
|
114 |
+
* Fix - PRODUCTS - Sorting - meta_value to meta_value_num in sort by quantity.
|
115 |
+
* Dev - PRODUCTS - Sorting - Code refactoring.
|
116 |
+
* Dev - PRODUCTS - Product Cost Price - *Profit* column added.
|
117 |
+
* Dev - CART & CHECKOUT - Custom Payment Gateways - Short description changed.
|
118 |
+
* Fix - CART & CHECKOUT - Checkout Core Fields - `fix_required_by_default` added.
|
119 |
+
* Dev - EMAILS & MISC. - Admin Tools - Short description changed.
|
120 |
+
* Dev - EMAILS & MISC. - Reports - Ranges by month added.
|
121 |
+
* Dev - EMAILS & MISC. - WPML - Short description changed.
|
122 |
+
|
123 |
= 2.2.3 - 27/07/2015 =
|
124 |
+
* Fix - CART & CHECKOUT - Custom Payment Gateways - https://wordpress.org/support/topic/custom-payment-gateway-settings-disappeared-after-last-update.
|
125 |
* Fix - CART & CHECKOUT - Payment Gateways Fees - Fee removed if current payment gateway is not available for user selected shipping method.
|
126 |
* Fix - CART & CHECKOUT - Payment Gateways Fees - "Tax class" (and "Is taxable") bug fixed.
|
127 |
* Dev - Tools (SKU and Admin) moved to each module's settings.
|
woocommerce-jetpack.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Plugin Name: WooCommerce
|
4 |
-
Plugin URI: http://
|
5 |
Description: Supercharge your WooCommerce site with these awesome powerful features.
|
6 |
-
Version: 2.2.
|
7 |
Author: Algoritmika Ltd
|
8 |
Author URI: http://www.algoritmika.com
|
9 |
Copyright: © 2015 Algoritmika Ltd.
|
@@ -77,18 +77,19 @@ final class WC_Jetpack {
|
|
77 |
|
78 |
// Settings
|
79 |
if ( is_admin() ) {
|
80 |
-
add_filter( 'woocommerce_get_settings_pages', array( $this, 'add_wcj_settings_tab' ) );
|
81 |
add_filter( 'get_wc_jetpack_plus_message', array( $this, 'get_wcj_plus_message' ), 100, 2 );
|
82 |
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'action_links' ) );
|
83 |
add_action( 'admin_menu', array( $this, 'jetpack_menu' ), 100 );
|
84 |
// add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 2 );
|
|
|
85 |
}
|
86 |
|
87 |
// Scripts
|
88 |
if ( is_admin() ) {
|
89 |
if ( 'yes' === get_option( 'wcj_purchase_data_enabled' ) || 'yes' === get_option( 'wcj_pdf_invoicing_enabled' ) ) {
|
90 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
91 |
-
add_action( 'admin_head',
|
92 |
}
|
93 |
}
|
94 |
|
@@ -99,6 +100,44 @@ final class WC_Jetpack {
|
|
99 |
echo 'Constructor End: memory_get_usage( true )' . number_format( memory_get_usage( true ), 0, '.', ',' ); */
|
100 |
}
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
/**
|
103 |
* enqueue_scripts.
|
104 |
*/
|
@@ -135,9 +174,11 @@ final class WC_Jetpack {
|
|
135 |
|
136 |
/**
|
137 |
* Add menu item
|
|
|
|
|
138 |
*/
|
139 |
public function jetpack_menu() {
|
140 |
-
add_submenu_page( 'woocommerce', __( 'WooCommerce
|
141 |
}
|
142 |
|
143 |
/**
|
@@ -149,8 +190,8 @@ final class WC_Jetpack {
|
|
149 |
public function action_links( $links ) {
|
150 |
return array_merge( array(
|
151 |
'<a href="' . admin_url( 'admin.php?page=wc-settings&tab=jetpack' ) . '">' . __( 'Settings', 'woocommerce' ) . '</a>',
|
152 |
-
'<a href="' . esc_url( apply_filters( 'woocommerce_docs_url', 'http://
|
153 |
-
'<a href="' . esc_url( apply_filters( 'woocommerce_support_url', 'http://
|
154 |
), $links );
|
155 |
}
|
156 |
|
@@ -163,22 +204,22 @@ final class WC_Jetpack {
|
|
163 |
|
164 |
case 'global':
|
165 |
return '<div class="updated">
|
166 |
-
<p class="main"><strong>' . __( 'Install WooCommerce
|
167 |
-
<span>' . sprintf( __('Some settings fields are locked and you will need %s to modify all locked fields.', 'woocommerce-jetpack'), '<a href="http://
|
168 |
-
<p><a href="http://
|
169 |
</div>';
|
170 |
|
171 |
case 'desc':
|
172 |
-
return __( 'Get <a href="http://
|
173 |
|
174 |
case 'desc_below':
|
175 |
-
return __( 'Get <a href="http://
|
176 |
|
177 |
case 'desc_above':
|
178 |
-
return __( 'Get <a href="http://
|
179 |
|
180 |
case 'desc_no_link':
|
181 |
-
return __( 'Get WooCommerce
|
182 |
|
183 |
case 'readonly':
|
184 |
return array( 'readonly' => 'readonly' );
|
1 |
<?php
|
2 |
/*
|
3 |
+
Plugin Name: Booster for WooCommerce
|
4 |
+
Plugin URI: http://BoostWoo.com
|
5 |
Description: Supercharge your WooCommerce site with these awesome powerful features.
|
6 |
+
Version: 2.2.4
|
7 |
Author: Algoritmika Ltd
|
8 |
Author URI: http://www.algoritmika.com
|
9 |
Copyright: © 2015 Algoritmika Ltd.
|
77 |
|
78 |
// Settings
|
79 |
if ( is_admin() ) {
|
80 |
+
add_filter( 'woocommerce_get_settings_pages', array( $this, 'add_wcj_settings_tab' ), PHP_INT_MAX );
|
81 |
add_filter( 'get_wc_jetpack_plus_message', array( $this, 'get_wcj_plus_message' ), 100, 2 );
|
82 |
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'action_links' ) );
|
83 |
add_action( 'admin_menu', array( $this, 'jetpack_menu' ), 100 );
|
84 |
// add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 2 );
|
85 |
+
add_action( 'admin_notices', array( $this, 'name_changed_notice' ) );
|
86 |
}
|
87 |
|
88 |
// Scripts
|
89 |
if ( is_admin() ) {
|
90 |
if ( 'yes' === get_option( 'wcj_purchase_data_enabled' ) || 'yes' === get_option( 'wcj_pdf_invoicing_enabled' ) ) {
|
91 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
92 |
+
add_action( 'admin_head', array( $this, 'add_datepicker_script' ) );
|
93 |
}
|
94 |
}
|
95 |
|
100 |
echo 'Constructor End: memory_get_usage( true )' . number_format( memory_get_usage( true ), 0, '.', ',' ); */
|
101 |
}
|
102 |
|
103 |
+
/**
|
104 |
+
* name_changed_notice.
|
105 |
+
*
|
106 |
+
* @version 2.2.4
|
107 |
+
* @since 2.2.4
|
108 |
+
*/
|
109 |
+
public function name_changed_notice() {
|
110 |
+
|
111 |
+
if ( ! is_admin() ) return;
|
112 |
+
|
113 |
+
//require_once( ABSPATH . 'wp-includes/pluggable.php' );
|
114 |
+
if ( ! is_super_admin() ) return;
|
115 |
+
|
116 |
+
$user_id = get_current_user_id();
|
117 |
+
|
118 |
+
// Reset
|
119 |
+
// update_option( 'wcj_rename_message_hidden', 'no' );
|
120 |
+
// update_user_meta( $user_id, 'wcj_rename_message_hidden', 'no' );
|
121 |
+
|
122 |
+
if ( isset( $_GET['wcj_rename_message_hide'] ) ) {
|
123 |
+
// Hide message for current user
|
124 |
+
update_user_meta( $user_id, 'wcj_rename_message_hidden', 'yes' );
|
125 |
+
// update_option( 'wcj_rename_message_hidden', 'yes' );
|
126 |
+
} else {
|
127 |
+
$is_message_hidden = get_user_meta( $user_id, 'wcj_rename_message_hidden', true );
|
128 |
+
// $is_message_hidden = get_option( 'wcj_rename_message_hidden', 'no' );
|
129 |
+
if ( 'yes' != $is_message_hidden ) {
|
130 |
+
// Show message
|
131 |
+
$class = 'update-nag';
|
132 |
+
$message = __( '<strong>WooCommerce Jetpack</strong> plugin changed its name to <strong>Booster for WooCommerce</strong>.', 'woocommerce-jetpack' );
|
133 |
+
$button = '<a href="' . add_query_arg( 'wcj_rename_message_hide', '1' ) . '">'
|
134 |
+
. '<button>' . __( 'Got it! Hide this message', 'woocommerce-jetpack' ) . '</button>'
|
135 |
+
. '</a>';
|
136 |
+
echo '<div class="' . $class . '"><p>' . $message . '</p><p>' . $button . '</p></div>';
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
/**
|
142 |
* enqueue_scripts.
|
143 |
*/
|
174 |
|
175 |
/**
|
176 |
* Add menu item
|
177 |
+
*
|
178 |
+
* @version 2.2.4
|
179 |
*/
|
180 |
public function jetpack_menu() {
|
181 |
+
add_submenu_page( 'woocommerce', __( 'Booster for WooCommerce', 'woocommerce' ), __( 'Booster Settings', 'woocommerce' ) , 'manage_woocommerce', 'admin.php?page=wc-settings&tab=jetpack' );
|
182 |
}
|
183 |
|
184 |
/**
|
190 |
public function action_links( $links ) {
|
191 |
return array_merge( array(
|
192 |
'<a href="' . admin_url( 'admin.php?page=wc-settings&tab=jetpack' ) . '">' . __( 'Settings', 'woocommerce' ) . '</a>',
|
193 |
+
'<a href="' . esc_url( apply_filters( 'woocommerce_docs_url', 'http://BoostWoo.com/', 'woocommerce' ) ) . '">' . __( 'Docs', 'woocommerce' ) . '</a>',
|
194 |
+
'<a href="' . esc_url( apply_filters( 'woocommerce_support_url', 'http://BoostWoo.com/plus/' ) ) . '">' . __( 'Unlock all', 'woocommerce' ) . '</a>',
|
195 |
), $links );
|
196 |
}
|
197 |
|
204 |
|
205 |
case 'global':
|
206 |
return '<div class="updated">
|
207 |
+
<p class="main"><strong>' . __( 'Install Booster for WooCommerce Plus to unlock all features', 'woocommerce-jetpack' ) . '</strong></p>
|
208 |
+
<span>' . sprintf( __('Some settings fields are locked and you will need %s to modify all locked fields.', 'woocommerce-jetpack'), '<a href="http://BoostWoo.com/plus/">Booster for WooCommerce Plus</a>' ) . '</span>
|
209 |
+
<p><a href="http://BoostWoo.com/plus/" target="_blank" class="button button-primary">' . __( 'Buy now', 'woocommerce-jetpack' ) . '</a> <a href="http://BoostWoo.com" target="_blank" class="button">'. sprintf( __( 'Visit %s', 'woocommerce-jetpack' ), 'BoostWoo.com' ) . '</a></p>
|
210 |
</div>';
|
211 |
|
212 |
case 'desc':
|
213 |
+
return __( 'Get <a href="http://BoostWoo.com/plus/" target="_blank">Booster for WooCommerce Plus</a> to change value.', 'woocommerce-jetpack' );
|
214 |
|
215 |
case 'desc_below':
|
216 |
+
return __( 'Get <a href="http://BoostWoo.com/plus/" target="_blank">Booster for WooCommerce Plus</a> to change values below.', 'woocommerce-jetpack' );
|
217 |
|
218 |
case 'desc_above':
|
219 |
+
return __( 'Get <a href="http://BoostWoo.com/plus/" target="_blank">Booster for WooCommerce Plus</a> to change values above.', 'woocommerce-jetpack' );
|
220 |
|
221 |
case 'desc_no_link':
|
222 |
+
return __( 'Get Booster for WooCommerce Plus to change value.', 'woocommerce-jetpack' );
|
223 |
|
224 |
case 'readonly':
|
225 |
return array( 'readonly' => 'readonly' );
|