Version Description
- 02/10/2014 =
- Fix -
%total_sales%
is temporary disabled. This was causing "PHP Parse error" on some servers. Reported by Xavier.
Download this release
Release Info
Developer | algoritmika |
Plugin | Booster for WooCommerce |
Version | 1.7.1 |
Comparing to | |
See all releases |
Code changes from version 1.6.2 to 1.7.1
- includes/class-wcj-add-to-cart.php +4 -0
- includes/class-wcj-checkout.php +9 -18
- includes/class-wcj-general.php +8 -14
- includes/class-wcj-orders.php +22 -2
- includes/class-wcj-payment-gateways.php +6 -2
- includes/class-wcj-product-info.php +141 -12
- includes/class-wcj-product-listings.php +242 -0
- includes/class-wcj-reports.php +38 -20
- includes/class-wcj-shipping.php +5 -1
- includes/class-wcj-sorting.php +5 -7
- includes/gateways/class-wc-gateway-wcj-custom.php +33 -13
- readme.txt +38 -25
- woocommerce-jetpack.php +3 -9
includes/class-wcj-add-to-cart.php
CHANGED
@@ -5,7 +5,11 @@
|
|
5 |
* The WooCommerce Jetpack Add to cart class.
|
6 |
*
|
7 |
* @class WCJ_Add_to_cart
|
|
|
|
|
|
|
8 |
*/
|
|
|
9 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
10 |
|
11 |
if ( ! class_exists( 'WCJ_Add_to_cart' ) ) :
|
5 |
* The WooCommerce Jetpack Add to cart class.
|
6 |
*
|
7 |
* @class WCJ_Add_to_cart
|
8 |
+
* @version 1.0.0
|
9 |
+
* @category Class
|
10 |
+
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
+
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
14 |
|
15 |
if ( ! class_exists( 'WCJ_Add_to_cart' ) ) :
|
includes/class-wcj-checkout.php
CHANGED
@@ -4,8 +4,12 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Checkout class.
|
6 |
*
|
7 |
-
* @class
|
|
|
|
|
|
|
8 |
*/
|
|
|
9 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
10 |
|
11 |
if ( ! class_exists( 'WCJ_Checkout' ) ) :
|
@@ -17,11 +21,9 @@ class WCJ_Checkout {
|
|
17 |
*/
|
18 |
public $sub_items = array(
|
19 |
'enabled' => 'checkbox',
|
20 |
-
////'type',
|
21 |
'required' => 'checkbox',
|
22 |
'label' => 'text',
|
23 |
'placeholder' => 'text',
|
24 |
-
//'clear',
|
25 |
);
|
26 |
|
27 |
/**
|
@@ -58,24 +60,15 @@ class WCJ_Checkout {
|
|
58 |
public function __construct() {
|
59 |
|
60 |
// Main hooks
|
61 |
-
if ( get_option( 'wcj_checkout_enabled' )
|
62 |
-
|
63 |
add_filter( 'woocommerce_checkout_fields' , array( $this, 'custom_override_checkout_fields' ) );
|
64 |
-
|
65 |
-
//if ( is_super_admin() )
|
66 |
-
//global $woocommerce;
|
67 |
-
// print_r( $woocommerce );
|
68 |
-
|
69 |
add_filter( 'woocommerce_order_button_text', array( $this, 'set_order_button_text' ) );
|
70 |
}
|
71 |
|
72 |
// Settings hooks
|
73 |
add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
|
74 |
add_filter( 'wcj_settings_checkout', array( $this, 'get_settings' ), 100 );
|
75 |
-
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
}
|
80 |
|
81 |
/**
|
@@ -276,10 +269,8 @@ class WCJ_Checkout {
|
|
276 |
/**
|
277 |
* settings_section.
|
278 |
*/
|
279 |
-
function settings_section( $sections ) {
|
280 |
-
|
281 |
-
$sections['checkout'] = 'Checkout';
|
282 |
-
|
283 |
return $sections;
|
284 |
}
|
285 |
}
|
4 |
*
|
5 |
* The WooCommerce Jetpack Checkout class.
|
6 |
*
|
7 |
+
* @class WCJ_Checkout
|
8 |
+
* @version 1.1.0
|
9 |
+
* @category Class
|
10 |
+
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
+
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
14 |
|
15 |
if ( ! class_exists( 'WCJ_Checkout' ) ) :
|
21 |
*/
|
22 |
public $sub_items = array(
|
23 |
'enabled' => 'checkbox',
|
|
|
24 |
'required' => 'checkbox',
|
25 |
'label' => 'text',
|
26 |
'placeholder' => 'text',
|
|
|
27 |
);
|
28 |
|
29 |
/**
|
60 |
public function __construct() {
|
61 |
|
62 |
// Main hooks
|
63 |
+
if ( 'yes' === get_option( 'wcj_checkout_enabled' ) ) {
|
|
|
64 |
add_filter( 'woocommerce_checkout_fields' , array( $this, 'custom_override_checkout_fields' ) );
|
|
|
|
|
|
|
|
|
|
|
65 |
add_filter( 'woocommerce_order_button_text', array( $this, 'set_order_button_text' ) );
|
66 |
}
|
67 |
|
68 |
// Settings hooks
|
69 |
add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
|
70 |
add_filter( 'wcj_settings_checkout', array( $this, 'get_settings' ), 100 );
|
71 |
+
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
|
|
|
|
|
|
72 |
}
|
73 |
|
74 |
/**
|
269 |
/**
|
270 |
* settings_section.
|
271 |
*/
|
272 |
+
function settings_section( $sections ) {
|
273 |
+
$sections['checkout'] = __( 'Checkout', 'woocommerce-jetpack' );
|
|
|
|
|
274 |
return $sections;
|
275 |
}
|
276 |
}
|
includes/class-wcj-general.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The WooCommerce Jetpack General class.
|
6 |
*
|
7 |
* @class WCJ_General
|
8 |
-
* @version 1.
|
9 |
* @category Class
|
10 |
* @author Algoritmika Ltd.
|
11 |
*/
|
@@ -19,18 +19,14 @@ class WCJ_General {
|
|
19 |
/**
|
20 |
* Constructor.
|
21 |
*/
|
22 |
-
public function __construct() {
|
23 |
-
|
24 |
// Main hooks
|
25 |
if ( 'yes' === get_option( 'wcj_general_enabled' ) ) {
|
26 |
-
if ( '' != get_option( 'wcj_general_custom_css' ) )
|
27 |
add_action( 'wp_head', array( $this, 'hook_custom_css' ) );
|
28 |
-
|
29 |
-
if ( '' != get_option( 'wcj_general_custom_admin_css' ) ) {
|
30 |
add_action( 'admin_head', array( $this, 'hook_custom_admin_css' ) );
|
31 |
-
|
32 |
-
}
|
33 |
-
|
34 |
// Settings hooks
|
35 |
add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
|
36 |
add_filter( 'wcj_settings_general', array( $this, 'get_settings' ), 100 );
|
@@ -102,7 +98,7 @@ class WCJ_General {
|
|
102 |
'css' => 'width:66%;min-width:300px;min-height:300px;',
|
103 |
),
|
104 |
|
105 |
-
array( 'type' => 'sectionend', 'id' => 'wcj_general_custom_css_options' ),
|
106 |
);
|
107 |
|
108 |
return $settings;
|
@@ -111,10 +107,8 @@ class WCJ_General {
|
|
111 |
/**
|
112 |
* settings_section.
|
113 |
*/
|
114 |
-
function settings_section( $sections ) {
|
115 |
-
|
116 |
-
$sections['general'] = __( 'General', 'woocommerce-jetpack' );
|
117 |
-
|
118 |
return $sections;
|
119 |
}
|
120 |
}
|
5 |
* The WooCommerce Jetpack General class.
|
6 |
*
|
7 |
* @class WCJ_General
|
8 |
+
* @version 1.1.0
|
9 |
* @category Class
|
10 |
* @author Algoritmika Ltd.
|
11 |
*/
|
19 |
/**
|
20 |
* Constructor.
|
21 |
*/
|
22 |
+
public function __construct() {
|
|
|
23 |
// Main hooks
|
24 |
if ( 'yes' === get_option( 'wcj_general_enabled' ) ) {
|
25 |
+
if ( '' != get_option( 'wcj_general_custom_css' ) )
|
26 |
add_action( 'wp_head', array( $this, 'hook_custom_css' ) );
|
27 |
+
if ( '' != get_option( 'wcj_general_custom_admin_css' ) )
|
|
|
28 |
add_action( 'admin_head', array( $this, 'hook_custom_admin_css' ) );
|
29 |
+
}
|
|
|
|
|
30 |
// Settings hooks
|
31 |
add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
|
32 |
add_filter( 'wcj_settings_general', array( $this, 'get_settings' ), 100 );
|
98 |
'css' => 'width:66%;min-width:300px;min-height:300px;',
|
99 |
),
|
100 |
|
101 |
+
array( 'type' => 'sectionend', 'id' => 'wcj_general_custom_css_options' ),
|
102 |
);
|
103 |
|
104 |
return $settings;
|
107 |
/**
|
108 |
* settings_section.
|
109 |
*/
|
110 |
+
function settings_section( $sections ) {
|
111 |
+
$sections['general'] = __( 'General', 'woocommerce-jetpack' );
|
|
|
|
|
112 |
return $sections;
|
113 |
}
|
114 |
}
|
includes/class-wcj-orders.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The WooCommerce Jetpack Orders class.
|
6 |
*
|
7 |
* @class WCJ_Orders
|
8 |
-
* @version 1.
|
9 |
* @category Class
|
10 |
* @author Algoritmika Ltd.
|
11 |
*/
|
@@ -46,6 +46,9 @@ class WCJ_Orders {
|
|
46 |
if ( get_option( 'wcj_order_minimum_amount' ) > 0 ) {
|
47 |
add_action( 'woocommerce_checkout_process', array( $this, 'order_minimum_amount' ) );
|
48 |
add_action( 'woocommerce_before_cart', array( $this, 'order_minimum_amount' ) );
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
if ( 'yes' === get_option( 'wcj_orders_custom_statuses_enabled' ) ) {
|
@@ -66,7 +69,7 @@ class WCJ_Orders {
|
|
66 |
add_filter( 'wcj_settings_orders', array( $this, 'get_settings' ), 100 );
|
67 |
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
68 |
}
|
69 |
-
|
70 |
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
71 |
// CUSTOM STATUSES //
|
72 |
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
@@ -362,6 +365,15 @@ class WCJ_Orders {
|
|
362 |
}
|
363 |
}
|
364 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
|
366 |
|
367 |
/**
|
@@ -491,6 +503,14 @@ class WCJ_Orders {
|
|
491 |
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
492 |
'css' => 'width:50%;min-width:300px;',
|
493 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
494 |
|
495 |
array( 'type' => 'sectionend', 'id' => 'wcj_order_minimum_amount_options' ),
|
496 |
|
5 |
* The WooCommerce Jetpack Orders class.
|
6 |
*
|
7 |
* @class WCJ_Orders
|
8 |
+
* @version 1.4.0
|
9 |
* @category Class
|
10 |
* @author Algoritmika Ltd.
|
11 |
*/
|
46 |
if ( get_option( 'wcj_order_minimum_amount' ) > 0 ) {
|
47 |
add_action( 'woocommerce_checkout_process', array( $this, 'order_minimum_amount' ) );
|
48 |
add_action( 'woocommerce_before_cart', array( $this, 'order_minimum_amount' ) );
|
49 |
+
if ( 'yes' === get_option( 'wcj_order_minimum_amount_stop_from_seeing_checkout' ) )
|
50 |
+
add_action( 'wp', array( $this, 'stop_from_seeing_checkout' ) );
|
51 |
+
|
52 |
}
|
53 |
|
54 |
if ( 'yes' === get_option( 'wcj_orders_custom_statuses_enabled' ) ) {
|
69 |
add_filter( 'wcj_settings_orders', array( $this, 'get_settings' ), 100 );
|
70 |
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
71 |
}
|
72 |
+
|
73 |
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
74 |
// CUSTOM STATUSES //
|
75 |
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
365 |
}
|
366 |
}
|
367 |
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* stop_from_seeing_checkout.
|
371 |
+
*/
|
372 |
+
public function stop_from_seeing_checkout() {
|
373 |
+
global $woocommerce;
|
374 |
+
if ( $woocommerce->cart->total < get_option( 'wcj_order_minimum_amount' ) && is_checkout() )
|
375 |
+
wp_safe_redirect( $woocommerce->cart->get_cart_url() );
|
376 |
+
}
|
377 |
|
378 |
|
379 |
/**
|
503 |
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
504 |
'css' => 'width:50%;min-width:300px;',
|
505 |
),
|
506 |
+
|
507 |
+
array(
|
508 |
+
'title' => __( 'Stop customer from seeing the Checkout page if minimum amount not reached.', 'woocommerce-jetpack' ),
|
509 |
+
'desc' => __( 'Redirect back to Cart page', 'woocommerce-jetpack' ),
|
510 |
+
'id' => 'wcj_order_minimum_amount_stop_from_seeing_checkout',
|
511 |
+
'default' => 'no',
|
512 |
+
'type' => 'checkbox',
|
513 |
+
),
|
514 |
|
515 |
array( 'type' => 'sectionend', 'id' => 'wcj_order_minimum_amount_options' ),
|
516 |
|
includes/class-wcj-payment-gateways.php
CHANGED
@@ -4,8 +4,12 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Payment Gateways class.
|
6 |
*
|
7 |
-
* @class
|
|
|
|
|
|
|
8 |
*/
|
|
|
9 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
10 |
|
11 |
if ( ! class_exists( 'WCJ_Payment_Gateways' ) ) :
|
@@ -16,7 +20,7 @@ class WCJ_Payment_Gateways {
|
|
16 |
'woocommerce_cod_icon' => 'COD',
|
17 |
'woocommerce_cheque_icon' => 'Cheque',
|
18 |
'woocommerce_bacs_icon' => 'BACS',
|
19 |
-
'woocommerce_mijireh_checkout_icon' => 'Mijireh Checkout',
|
20 |
'woocommerce_paypal_icon' => 'PayPal',
|
21 |
//'woocommerce_wcj_custom_icon' => 'WooJetpack Custom',
|
22 |
);
|
4 |
*
|
5 |
* The WooCommerce Jetpack Payment Gateways class.
|
6 |
*
|
7 |
+
* @class WCJ_Payment_Gateways
|
8 |
+
* @version 1.0.1
|
9 |
+
* @category Class
|
10 |
+
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
+
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
14 |
|
15 |
if ( ! class_exists( 'WCJ_Payment_Gateways' ) ) :
|
20 |
'woocommerce_cod_icon' => 'COD',
|
21 |
'woocommerce_cheque_icon' => 'Cheque',
|
22 |
'woocommerce_bacs_icon' => 'BACS',
|
23 |
+
'woocommerce_mijireh_checkout_icon' => 'Mijireh Checkout', //depreciated?
|
24 |
'woocommerce_paypal_icon' => 'PayPal',
|
25 |
//'woocommerce_wcj_custom_icon' => 'WooJetpack Custom',
|
26 |
);
|
includes/class-wcj-product-info.php
CHANGED
@@ -5,11 +5,12 @@
|
|
5 |
* The WooCommerce Jetpack Product Info class.
|
6 |
*
|
7 |
* @class WCJ_Product_Info
|
8 |
-
* @version 1.
|
9 |
* @package WC_Jetpack/Classes
|
10 |
* @category Class
|
11 |
* @author Algoritmika Ltd.
|
12 |
*/
|
|
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
14 |
|
15 |
if ( ! class_exists( 'WCJ_Product_Info' ) ) :
|
@@ -21,15 +22,44 @@ class WCJ_Product_Info {
|
|
21 |
*/
|
22 |
public function __construct() {
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
// Main hooks
|
25 |
-
if ( 'yes'
|
26 |
|
27 |
add_filter( 'woocommerce_product_tabs', array( $this, 'customize_product_tabs' ), 98 );
|
28 |
|
29 |
-
if ( get_option( 'wcj_product_info_related_products_enable' )
|
30 |
add_filter( 'woocommerce_related_products_args', array( $this, 'related_products_limit' ), 100 );
|
31 |
add_filter( 'woocommerce_output_related_products_args', array( $this, 'related_products_limit_args' ), 100 );
|
32 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
|
35 |
// Settings hooks
|
@@ -49,6 +79,26 @@ class WCJ_Product_Info {
|
|
49 |
return $settings;
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
/**
|
53 |
* Change number of related products on product page.
|
54 |
*/
|
@@ -122,10 +172,91 @@ class WCJ_Product_Info {
|
|
122 |
'desc_tip' => __( 'Customize single product tabs, change related products number.', 'woocommerce-jetpack' ),
|
123 |
'id' => 'wcj_product_info_enabled',
|
124 |
'default' => 'yes',
|
125 |
-
'type' => 'checkbox'
|
126 |
),
|
127 |
|
128 |
array( 'type' => 'sectionend', 'id' => 'wcj_product_info_options' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
|
130 |
// Product Tabs Options
|
131 |
array( 'title' => __( 'Product Tabs Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => 'This section lets you customize single product tabs.', 'id' => 'wcj_product_info_product_tabs_options' ),
|
@@ -135,7 +266,7 @@ class WCJ_Product_Info {
|
|
135 |
'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
|
136 |
'id' => 'wcj_product_info_product_tabs_description_disable',
|
137 |
'default' => 'no',
|
138 |
-
'type' => 'checkbox'
|
139 |
),
|
140 |
|
141 |
array(
|
@@ -161,7 +292,7 @@ class WCJ_Product_Info {
|
|
161 |
'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
|
162 |
'id' => 'wcj_product_info_product_tabs_reviews_disable',
|
163 |
'default' => 'no',
|
164 |
-
'type' => 'checkbox'
|
165 |
),
|
166 |
|
167 |
array(
|
@@ -187,7 +318,7 @@ class WCJ_Product_Info {
|
|
187 |
'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
|
188 |
'id' => 'wcj_product_info_product_tabs_additional_information_disable',
|
189 |
'default' => 'no',
|
190 |
-
'type' => 'checkbox'
|
191 |
),
|
192 |
|
193 |
array(
|
@@ -217,7 +348,7 @@ class WCJ_Product_Info {
|
|
217 |
'title' => __( 'Enable', 'woocommerce-jetpack' ),
|
218 |
'id' => 'wcj_product_info_related_products_enable',
|
219 |
'default' => 'no',
|
220 |
-
'type' => 'checkbox'
|
221 |
),
|
222 |
|
223 |
array(
|
@@ -268,10 +399,8 @@ class WCJ_Product_Info {
|
|
268 |
/**
|
269 |
* Add settings section.
|
270 |
*/
|
271 |
-
function settings_section( $sections ) {
|
272 |
-
|
273 |
-
$sections['product_info'] = __( 'Product Info', 'woocommerce-jetpack' );
|
274 |
-
|
275 |
return $sections;
|
276 |
}
|
277 |
}
|
5 |
* The WooCommerce Jetpack Product Info class.
|
6 |
*
|
7 |
* @class WCJ_Product_Info
|
8 |
+
* @version 1.1.1
|
9 |
* @package WC_Jetpack/Classes
|
10 |
* @category Class
|
11 |
* @author Algoritmika Ltd.
|
12 |
*/
|
13 |
+
|
14 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
15 |
|
16 |
if ( ! class_exists( 'WCJ_Product_Info' ) ) :
|
22 |
*/
|
23 |
public function __construct() {
|
24 |
|
25 |
+
// Product archives filters array
|
26 |
+
$this->product_info_on_archive_filters_array = array(
|
27 |
+
'woocommerce_before_shop_loop_item' => __( 'Before product', 'woocommerce-jetpack' ),
|
28 |
+
'woocommerce_before_shop_loop_item_title' => __( 'Before product title', 'woocommerce-jetpack' ),
|
29 |
+
'woocommerce_after_shop_loop_item' => __( 'After product', 'woocommerce-jetpack' ),
|
30 |
+
'woocommerce_after_shop_loop_item_title' => __( 'After product title', 'woocommerce-jetpack' ),
|
31 |
+
);
|
32 |
+
|
33 |
+
// Single product filters array
|
34 |
+
$this->product_info_on_single_filters_array = array(
|
35 |
+
'woocommerce_single_product_summary' => __( 'Inside single product summary', 'woocommerce-jetpack' ),
|
36 |
+
'woocommerce_before_single_product_summary' => __( 'Before single product summary', 'woocommerce-jetpack' ),
|
37 |
+
'woocommerce_after_single_product_summary' => __( 'After single product summary', 'woocommerce-jetpack' ),
|
38 |
+
);
|
39 |
+
|
40 |
// Main hooks
|
41 |
+
if ( 'yes' === get_option( 'wcj_product_info_enabled' ) ) {
|
42 |
|
43 |
add_filter( 'woocommerce_product_tabs', array( $this, 'customize_product_tabs' ), 98 );
|
44 |
|
45 |
+
if ( get_option( 'wcj_product_info_related_products_enable' ) === 'yes' ) {
|
46 |
add_filter( 'woocommerce_related_products_args', array( $this, 'related_products_limit' ), 100 );
|
47 |
add_filter( 'woocommerce_output_related_products_args', array( $this, 'related_products_limit_args' ), 100 );
|
48 |
}
|
49 |
+
|
50 |
+
if ( ( 'yes' === get_option( 'wcj_product_info_on_archive_enabled' ) ) &&
|
51 |
+
( '' != get_option( 'wcj_product_info_on_archive' ) ) &&
|
52 |
+
( '' != get_option( 'wcj_product_info_on_archive_filter' ) ) &&
|
53 |
+
( '' != get_option( 'wcj_product_info_on_archive_filter_priority' ) ) &&
|
54 |
+
( array_key_exists( get_option( 'wcj_product_info_on_archive_filter' ), $this->product_info_on_archive_filters_array ) ) )
|
55 |
+
add_action( get_option( 'wcj_product_info_on_archive_filter' ), array( $this, 'product_info' ), get_option( 'wcj_product_info_on_archive_filter_priority' ) );
|
56 |
+
|
57 |
+
if ( ( 'yes' === get_option( 'wcj_product_info_on_single_enabled' ) ) &&
|
58 |
+
( '' != get_option( 'wcj_product_info_on_single' ) ) &&
|
59 |
+
( '' != get_option( 'wcj_product_info_on_single_filter' ) ) &&
|
60 |
+
( '' != get_option( 'wcj_product_info_on_single_filter_priority' ) ) &&
|
61 |
+
( array_key_exists( get_option( 'wcj_product_info_on_single_filter' ), $this->product_info_on_single_filters_array ) ) )
|
62 |
+
add_action( get_option( 'wcj_product_info_on_single_filter' ), array( $this, 'product_info' ), get_option( 'wcj_product_info_on_single_filter_priority' ) );
|
63 |
}
|
64 |
|
65 |
// Settings hooks
|
79 |
return $settings;
|
80 |
}
|
81 |
|
82 |
+
/**
|
83 |
+
* product_info.
|
84 |
+
*/
|
85 |
+
public function product_info() {
|
86 |
+
|
87 |
+
$the_action_name = current_filter();
|
88 |
+
if ( array_key_exists( $the_action_name, $this->product_info_on_archive_filters_array ) )
|
89 |
+
$the_product_info = get_option( 'wcj_product_info_on_archive' );
|
90 |
+
else if ( array_key_exists( $the_action_name, $this->product_info_on_single_filters_array ) )
|
91 |
+
$the_product_info = apply_filters( 'wcj_get_option_filter', 'Total sales: %total_sales%', get_option( 'wcj_product_info_on_single' ) );
|
92 |
+
global $product;
|
93 |
+
$product_info_shortcodes_array = array(
|
94 |
+
'%sku%' => $product->get_sku(),
|
95 |
+
/*'%total_sales%' => get_post_custom( $product->id )['total_sales'][0],*/
|
96 |
+
);
|
97 |
+
foreach ( $product_info_shortcodes_array as $search_for_phrase => $replace_with_phrase )
|
98 |
+
$the_product_info = str_replace( $search_for_phrase, $replace_with_phrase, $the_product_info );
|
99 |
+
echo $the_product_info;
|
100 |
+
}
|
101 |
+
|
102 |
/**
|
103 |
* Change number of related products on product page.
|
104 |
*/
|
172 |
'desc_tip' => __( 'Customize single product tabs, change related products number.', 'woocommerce-jetpack' ),
|
173 |
'id' => 'wcj_product_info_enabled',
|
174 |
'default' => 'yes',
|
175 |
+
'type' => 'checkbox',
|
176 |
),
|
177 |
|
178 |
array( 'type' => 'sectionend', 'id' => 'wcj_product_info_options' ),
|
179 |
+
|
180 |
+
// Product Info Additional Options
|
181 |
+
array( 'title' => __( 'More Products Info', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_product_info_additional_options' ),
|
182 |
+
|
183 |
+
array(
|
184 |
+
'title' => __( 'Product Info on Archive Pages', 'woocommerce-jetpack' ),
|
185 |
+
'desc' => __( 'Enable', 'woocommerce-jetpack' ),
|
186 |
+
'id' => 'wcj_product_info_on_archive_enabled',
|
187 |
+
'default' => 'no',
|
188 |
+
'type' => 'checkbox',
|
189 |
+
),
|
190 |
+
|
191 |
+
array(
|
192 |
+
'title' => '',
|
193 |
+
'desc_tip' => __( 'HTML info. Predefined: %total_sales%, %sku%', 'woocommerce-jetpack' ),
|
194 |
+
'id' => 'wcj_product_info_on_archive',
|
195 |
+
'default' => 'SKU: %sku%',
|
196 |
+
'type' => 'textarea',
|
197 |
+
'css' => 'width:50%;min-width:300px;height:100px;',
|
198 |
+
),
|
199 |
+
|
200 |
+
array(
|
201 |
+
'title' => '',
|
202 |
+
'desc' => __( 'Position', 'woocommerce-jetpack' ),
|
203 |
+
'id' => 'wcj_product_info_on_archive_filter',
|
204 |
+
'css' => 'min-width:350px;',
|
205 |
+
'class' => 'chosen_select',
|
206 |
+
'default' => 'woocommerce_after_shop_loop_item_title',
|
207 |
+
'type' => 'select',
|
208 |
+
'options' => $this->product_info_on_archive_filters_array,
|
209 |
+
'desc_tip' => true,
|
210 |
+
),
|
211 |
+
|
212 |
+
array(
|
213 |
+
'title' => '',
|
214 |
+
'desc_tip' => __( 'Priority (i.e. Order)', 'woocommerce-jetpack' ),
|
215 |
+
'id' => 'wcj_product_info_on_archive_filter_priority',
|
216 |
+
'default' => 10,
|
217 |
+
'type' => 'number',
|
218 |
+
),
|
219 |
+
|
220 |
+
array(
|
221 |
+
'title' => __( 'Product Info on Single Product Pages', 'woocommerce-jetpack' ),
|
222 |
+
'desc' => __( 'Enable', 'woocommerce-jetpack' ),
|
223 |
+
'id' => 'wcj_product_info_on_single_enabled',
|
224 |
+
'default' => 'no',
|
225 |
+
'type' => 'checkbox',
|
226 |
+
),
|
227 |
+
|
228 |
+
array(
|
229 |
+
'title' => '',
|
230 |
+
'desc_tip' => __( 'HTML info. Predefined: %total_sales%, %sku%', 'woocommerce-jetpack' ),
|
231 |
+
'id' => 'wcj_product_info_on_single',
|
232 |
+
'default' => 'Total sales: %total_sales%',
|
233 |
+
'type' => 'textarea',
|
234 |
+
'custom_attributes'
|
235 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
236 |
+
'css' => 'width:50%;min-width:300px;height:100px;',
|
237 |
+
),
|
238 |
+
|
239 |
+
array(
|
240 |
+
'title' => '',
|
241 |
+
'desc' => __( 'Position', 'woocommerce-jetpack' ),
|
242 |
+
'id' => 'wcj_product_info_on_single_filter',
|
243 |
+
'css' => 'min-width:350px;',
|
244 |
+
'class' => 'chosen_select',
|
245 |
+
'default' => 'woocommerce_after_single_product_summary',
|
246 |
+
'type' => 'select',
|
247 |
+
'options' => $this->product_info_on_single_filters_array,
|
248 |
+
'desc_tip' => true,
|
249 |
+
),
|
250 |
+
|
251 |
+
array(
|
252 |
+
'title' => '',
|
253 |
+
'desc_tip' => __( 'Priority (i.e. Order)', 'woocommerce-jetpack' ),
|
254 |
+
'id' => 'wcj_product_info_on_single_filter_priority',
|
255 |
+
'default' => 10,
|
256 |
+
'type' => 'number',
|
257 |
+
),
|
258 |
+
|
259 |
+
array( 'type' => 'sectionend', 'id' => 'wcj_product_info_additional_options' ),
|
260 |
|
261 |
// Product Tabs Options
|
262 |
array( 'title' => __( 'Product Tabs Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => 'This section lets you customize single product tabs.', 'id' => 'wcj_product_info_product_tabs_options' ),
|
266 |
'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
|
267 |
'id' => 'wcj_product_info_product_tabs_description_disable',
|
268 |
'default' => 'no',
|
269 |
+
'type' => 'checkbox',
|
270 |
),
|
271 |
|
272 |
array(
|
292 |
'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
|
293 |
'id' => 'wcj_product_info_product_tabs_reviews_disable',
|
294 |
'default' => 'no',
|
295 |
+
'type' => 'checkbox',
|
296 |
),
|
297 |
|
298 |
array(
|
318 |
'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
|
319 |
'id' => 'wcj_product_info_product_tabs_additional_information_disable',
|
320 |
'default' => 'no',
|
321 |
+
'type' => 'checkbox',
|
322 |
),
|
323 |
|
324 |
array(
|
348 |
'title' => __( 'Enable', 'woocommerce-jetpack' ),
|
349 |
'id' => 'wcj_product_info_related_products_enable',
|
350 |
'default' => 'no',
|
351 |
+
'type' => 'checkbox',
|
352 |
),
|
353 |
|
354 |
array(
|
399 |
/**
|
400 |
* Add settings section.
|
401 |
*/
|
402 |
+
function settings_section( $sections ) {
|
403 |
+
$sections['product_info'] = __( 'Product Info', 'woocommerce-jetpack' );
|
|
|
|
|
404 |
return $sections;
|
405 |
}
|
406 |
}
|
includes/class-wcj-product-listings.php
ADDED
@@ -0,0 +1,242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Jetpack Product Listings
|
4 |
+
*
|
5 |
+
* The WooCommerce Jetpack Product Listings class.
|
6 |
+
*
|
7 |
+
* @class WCJ_Product_Listings
|
8 |
+
* @version 1.0.0
|
9 |
+
* @category Class
|
10 |
+
* @author Algoritmika Ltd.
|
11 |
+
*/
|
12 |
+
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
14 |
+
|
15 |
+
if ( ! class_exists( 'WCJ_Product_Listings' ) ) :
|
16 |
+
|
17 |
+
class WCJ_Product_Listings {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Constructor.
|
21 |
+
*/
|
22 |
+
public function __construct() {
|
23 |
+
// Main hooks
|
24 |
+
if ( 'yes' === get_option( 'wcj_product_listings_enabled' ) ) {
|
25 |
+
// Exclude and Hide Empty
|
26 |
+
add_filter( 'woocommerce_product_subcategories_args', array( $this, 'filter_subcategories' ), 100 );
|
27 |
+
// Hide Count
|
28 |
+
if ( 'yes' === get_option( 'wcj_product_listings_hide_cats_count_on_shop' ) || 'yes' === get_option( 'wcj_product_listings_hide_cats_count_on_archive' ) )
|
29 |
+
add_filter( 'woocommerce_subcategory_count_html', array( $this, 'remove_subcategory_count' ), 100 );
|
30 |
+
// Settings to "WooCommerce > Settings > Products > Product Listings"
|
31 |
+
add_filter( 'woocommerce_product_settings', array( $this, 'add_fields_to_woocommerce_settings' ), 100 );
|
32 |
+
}
|
33 |
+
// Settings hooks
|
34 |
+
add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
|
35 |
+
add_filter( 'wcj_settings_product_listings', array( $this, 'get_settings' ), 100 );
|
36 |
+
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* add_enabled_option.
|
41 |
+
*/
|
42 |
+
public function add_enabled_option( $settings ) {
|
43 |
+
$all_settings = $this->get_settings();
|
44 |
+
$settings[] = $all_settings[1];
|
45 |
+
return $settings;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* get_settings.
|
50 |
+
*/
|
51 |
+
function get_settings() {
|
52 |
+
|
53 |
+
$settings = array(
|
54 |
+
|
55 |
+
array( 'title' => __( 'Product Listings Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( '', 'woocommerce-jetpack' ), 'id' => 'wcj_product_listings_options' ),
|
56 |
+
|
57 |
+
array(
|
58 |
+
'title' => __( 'Product Listings', 'woocommerce-jetpack' ),
|
59 |
+
'desc' => __( 'Enable the Product Listings feature', 'woocommerce-jetpack' ),
|
60 |
+
'desc_tip' => __( 'Change display options for shop and category pages: show/hide categories count, exclude categories, show/hide empty categories.', 'woocommerce-jetpack' ),
|
61 |
+
'id' => 'wcj_product_listings_enabled',
|
62 |
+
'default' => 'yes',
|
63 |
+
'type' => 'checkbox',
|
64 |
+
),
|
65 |
+
|
66 |
+
array( 'type' => 'sectionend', 'id' => 'wcj_product_listings_options' ),
|
67 |
+
|
68 |
+
array( 'title' => __( 'Shop Page Display Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This will work only when "Shop Page Display" in "WooCommerce > Settings > Products > Product Listings" is set to "Show subcategories" or "Show both".', 'woocommerce-jetpack' ), 'id' => 'wcj_product_listings_shop_page_options' ),
|
69 |
+
|
70 |
+
array(
|
71 |
+
'title' => __( 'Categories Count', 'woocommerce-jetpack' ),
|
72 |
+
'desc' => __( 'Hide categories count on shop page', 'woocommerce-jetpack' ),
|
73 |
+
'id' => 'wcj_product_listings_hide_cats_count_on_shop',
|
74 |
+
'default' => 'no',
|
75 |
+
'type' => 'checkbox',
|
76 |
+
),
|
77 |
+
|
78 |
+
array(
|
79 |
+
'title' => __( 'Exclude Categories', 'woocommerce-jetpack' ),
|
80 |
+
'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' ),
|
81 |
+
'id' => 'wcj_product_listings_exclude_cats_on_shop',
|
82 |
+
'default' => '',
|
83 |
+
'type' => 'text',
|
84 |
+
'css' => 'width:50%;min-width:300px;',
|
85 |
+
),
|
86 |
+
|
87 |
+
array(
|
88 |
+
'title' => __( 'Hide Empty', 'woocommerce-jetpack' ),
|
89 |
+
'desc' => __( 'Hide empty categories on shop page', 'woocommerce-jetpack' ),
|
90 |
+
'id' => 'wcj_product_listings_hide_empty_cats_on_shop',
|
91 |
+
'default' => 'yes',
|
92 |
+
'type' => 'checkbox',
|
93 |
+
),
|
94 |
+
|
95 |
+
array( 'type' => 'sectionend', 'id' => 'wcj_product_listings_shop_page_options' ),
|
96 |
+
|
97 |
+
array( 'title' => __( 'Category Display Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This will work only when "Default Category Display" in "WooCommerce > Settings > Products > Product Listings" is set to "Show subcategories" or "Show both".', 'woocommerce-jetpack' ), 'id' => 'wcj_product_listings_archive_pages_options' ),
|
98 |
+
|
99 |
+
array(
|
100 |
+
'title' => __( 'Subcategories Count', 'woocommerce-jetpack' ),
|
101 |
+
'desc' => __( 'Hide subcategories count on category pages', 'woocommerce-jetpack' ),
|
102 |
+
'id' => 'wcj_product_listings_hide_cats_count_on_archive',
|
103 |
+
'default' => 'no',
|
104 |
+
'type' => 'checkbox',
|
105 |
+
'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
106 |
+
'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
107 |
+
),
|
108 |
+
|
109 |
+
array(
|
110 |
+
'title' => __( 'Exclude Subcategories', 'woocommerce-jetpack' ),
|
111 |
+
'desc_tip' => __(' Excludes one or more categories from the category (archive) pages. This parameter takes a comma-separated list of categories by unique ID, in ascending order. Leave blank to disable.', 'woocommerce-jetpack' ),
|
112 |
+
'id' => 'wcj_product_listings_exclude_cats_on_archives',
|
113 |
+
'default' => '',
|
114 |
+
'type' => 'text',
|
115 |
+
'css' => 'width:50%;min-width:300px;',
|
116 |
+
),
|
117 |
+
|
118 |
+
array(
|
119 |
+
'title' => __( 'Hide Empty', 'woocommerce-jetpack' ),
|
120 |
+
'desc' => __( 'Hide empty subcategories on category pages', 'woocommerce-jetpack' ),
|
121 |
+
'id' => 'wcj_product_listings_hide_empty_cats_on_archives',
|
122 |
+
'default' => 'yes',
|
123 |
+
'type' => 'checkbox',
|
124 |
+
),
|
125 |
+
|
126 |
+
array( 'type' => 'sectionend', 'id' => 'wcj_product_listings_archive_pages_options' ),
|
127 |
+
);
|
128 |
+
|
129 |
+
return $settings;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* settings_section.
|
134 |
+
*/
|
135 |
+
function settings_section( $sections ) {
|
136 |
+
$sections['product_listings'] = __( 'Product Listings', 'woocommerce-jetpack' );
|
137 |
+
return $sections;
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* add_fields_to_woocommerce_settings.
|
142 |
+
*/
|
143 |
+
function add_fields_to_woocommerce_settings( $settings ) {
|
144 |
+
|
145 |
+
$updated_settings = array();
|
146 |
+
|
147 |
+
foreach ( $settings as $section ) {
|
148 |
+
|
149 |
+
$updated_settings[] = $section;
|
150 |
+
|
151 |
+
if ( isset( $section['id'] ) && 'woocommerce_shop_page_display' == $section['id'] ) {
|
152 |
+
|
153 |
+
$updated_settings[] = array(
|
154 |
+
'title' => __( 'WooJetpack: Categories Count', 'woocommerce-jetpack' ),
|
155 |
+
'desc' => __( 'Hide categories count on shop page', 'woocommerce-jetpack' ),
|
156 |
+
'id' => 'wcj_product_listings_hide_cats_count_on_shop',
|
157 |
+
'default' => 'no',
|
158 |
+
'type' => 'checkbox',
|
159 |
+
);
|
160 |
+
|
161 |
+
$updated_settings[] = array(
|
162 |
+
'title' => __( 'WooJetpack: Exclude Categories on Shop Page', 'woocommerce-jetpack' ),
|
163 |
+
'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' ),
|
164 |
+
'id' => 'wcj_product_listings_exclude_cats_on_shop',
|
165 |
+
'default' => '',
|
166 |
+
'type' => 'text',
|
167 |
+
'css' => 'width:50%;min-width:300px;',
|
168 |
+
);
|
169 |
+
|
170 |
+
$updated_settings[] = array(
|
171 |
+
'title' => __( 'WooJetpack: Hide Empty', 'woocommerce-jetpack' ),
|
172 |
+
'desc' => __( 'Hide empty categories on shop page', 'woocommerce-jetpack' ),
|
173 |
+
'id' => 'wcj_product_listings_hide_empty_cats_on_shop',
|
174 |
+
'default' => 'yes',
|
175 |
+
'type' => 'checkbox',
|
176 |
+
);
|
177 |
+
|
178 |
+
}
|
179 |
+
|
180 |
+
if ( isset( $section['id'] ) && 'woocommerce_category_archive_display' == $section['id'] ) {
|
181 |
+
|
182 |
+
$updated_settings[] = array(
|
183 |
+
'title' => __( 'WooJetpack: Subcategories Count', 'woocommerce-jetpack' ),
|
184 |
+
'desc' => __( 'Hide subcategories count on category pages', 'woocommerce-jetpack' ),
|
185 |
+
'id' => 'wcj_product_listings_hide_cats_count_on_archive',
|
186 |
+
'default' => 'no',
|
187 |
+
'type' => 'checkbox',
|
188 |
+
'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
189 |
+
'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
190 |
+
);
|
191 |
+
|
192 |
+
$updated_settings[] = array(
|
193 |
+
'title' => __( 'WooJetpack: Exclude Subcategories on Category Pages', 'woocommerce-jetpack' ),
|
194 |
+
'desc_tip' => __(' Excludes one or more categories from the category (archive) pages. This parameter takes a comma-separated list of categories by unique ID, in ascending order. Leave blank to disable.', 'woocommerce-jetpack' ),
|
195 |
+
'id' => 'wcj_product_listings_exclude_cats_on_archives',
|
196 |
+
'default' => '',
|
197 |
+
'type' => 'text',
|
198 |
+
'css' => 'width:50%;min-width:300px;',
|
199 |
+
);
|
200 |
+
|
201 |
+
$updated_settings[] = array(
|
202 |
+
'title' => __( 'WooJetpack: Hide Empty', 'woocommerce-jetpack' ),
|
203 |
+
'desc' => __( 'Hide empty subcategories on category pages', 'woocommerce-jetpack' ),
|
204 |
+
'id' => 'wcj_product_listings_hide_empty_cats_on_archives',
|
205 |
+
'default' => 'yes',
|
206 |
+
'type' => 'checkbox',
|
207 |
+
);
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
return $updated_settings;
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* remove_subcategory_count.
|
216 |
+
*/
|
217 |
+
public function remove_subcategory_count( $count_html ) {
|
218 |
+
if ( ( is_shop() && 'yes' === get_option( 'wcj_product_listings_hide_cats_count_on_shop' ) ) ||
|
219 |
+
( ! is_shop() && 'yes' === apply_filters( 'wcj_get_option_filter', 'wcj', get_option( 'wcj_product_listings_hide_cats_count_on_archive' ) ) ) )
|
220 |
+
return '';
|
221 |
+
return $count_html;
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* filter_subcategories.
|
226 |
+
*/
|
227 |
+
public function filter_subcategories( $args ) {
|
228 |
+
if ( is_shop() ) {
|
229 |
+
$args['exclude'] = get_option( 'wcj_product_listings_exclude_cats_on_shop' );
|
230 |
+
$args['hide_empty'] = ( 'yes' === get_option( 'wcj_product_listings_hide_empty_cats_on_shop' ) ) ? 1 : 0;
|
231 |
+
}
|
232 |
+
else {
|
233 |
+
$args['exclude'] = get_option( 'wcj_product_listings_exclude_cats_on_archives' );
|
234 |
+
$args['hide_empty'] = ( 'yes' === get_option( 'wcj_product_listings_hide_empty_cats_on_archives' ) ) ? 1 : 0;
|
235 |
+
}
|
236 |
+
return $args;
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
endif;
|
241 |
+
|
242 |
+
return new WCJ_Product_Listings();
|
includes/class-wcj-reports.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The WooCommerce Jetpack Reports class.
|
6 |
*
|
7 |
* @class WCJ_Reports
|
8 |
-
* @version 1.
|
9 |
* @category Class
|
10 |
* @author Algoritmika Ltd.
|
11 |
*/
|
@@ -50,10 +50,8 @@ class WCJ_Reports {
|
|
50 |
* Add Enable option to Jetpack Settings Dashboard.
|
51 |
*/
|
52 |
public function add_enabled_option( $settings ) {
|
53 |
-
|
54 |
$all_settings = $this->get_settings();
|
55 |
$settings[] = $all_settings[1];
|
56 |
-
|
57 |
return $settings;
|
58 |
}
|
59 |
|
@@ -151,7 +149,8 @@ class WCJ_Reports {
|
|
151 |
|
152 |
$args_orders = array(
|
153 |
'post_type' => 'shop_order',
|
154 |
-
'post_status' => 'publish',
|
|
|
155 |
'posts_per_page' => -1,
|
156 |
'orderby' => 'date',
|
157 |
'order' => 'DESC',
|
@@ -218,9 +217,11 @@ class WCJ_Reports {
|
|
218 |
$info['total_stock_price'] += $product_info['stock_price'];
|
219 |
}
|
220 |
|
221 |
-
|
222 |
-
|
223 |
-
|
|
|
|
|
224 |
}
|
225 |
|
226 |
/*
|
@@ -280,7 +281,8 @@ class WCJ_Reports {
|
|
280 |
|
281 |
$html .= '<th class="wcj_report_table_sales_columns">' . __( 'Last sale', 'woocommerce-jetpack' ) . '</th>';
|
282 |
$html .= '<th class="wcj_report_table_sales_columns">' . sprintf( __( 'Sales in last %s days', 'woocommerce-jetpack' ), $this->period ) . '</th>';
|
283 |
-
$html .= '<th class="wcj_report_table_sales_columns">' . __( 'Sales in
|
|
|
284 |
$html .= '<th class="wcj_report_table_sales_columns">' . __( 'Total sales', 'woocommerce-jetpack' ) . '</th>';
|
285 |
$html .= '</tr>';
|
286 |
|
@@ -371,12 +373,22 @@ class WCJ_Reports {
|
|
371 |
$html .= '</tbody></table>';
|
372 |
|
373 |
$html_header = '<h4>' . $report_info['title'] . ': ' . $report_info['desc'] . '</h4>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
$html_header .= '<div class="updated1">' . __( 'Total current stock value: ', 'woocommerce-jetpack' ) . wc_price( $total_current_stock_price ) . '</div>';
|
375 |
$html_header .= '<div class="updated1">' . __( 'Total stock value: ', 'woocommerce-jetpack' ) . wc_price( $info['total_stock_price'] ) . '</div>';
|
376 |
//$html_header .= '<div class="updated1">' . __( 'Product sales in 90 average: ', 'woocommerce-jetpack' ) . number_format( $info['sales_in_90_days_average'], 2, '.', '' ) . '</div>';
|
377 |
$html_header .= '<div class="updated1">' . __( 'Product stock value average: ', 'woocommerce-jetpack' ) . wc_price( $info['stock_price_average'] ) . '</div>';
|
378 |
$html_header .= '<div class="updated1">' . __( 'Product stock average: ', 'woocommerce-jetpack' ) . number_format( $info['stock_average'], 2, '.', '' ) . '</div>';
|
379 |
-
|
380 |
|
381 |
// Report title and description
|
382 |
//$html_report_title = '<h4>' . $report_info['title'] . ': ' . $report_info['desc'] . '</h4>';
|
@@ -391,7 +403,7 @@ class WCJ_Reports {
|
|
391 |
public function create_reports_tool() {
|
392 |
|
393 |
$this->reports_info = array(
|
394 |
-
'bad_stock' => array(
|
395 |
'id' => 'bad_stock',
|
396 |
'title' => __( 'Low sales - big stock', 'woocommerce-jetpack' ),
|
397 |
'desc' => __( 'Report shows you products with stock bigger than <span style="color:green;">%s</span> average, but with sales in last 90 days lower than average. Sorted by total stock value.', 'woocommerce-jetpack' ),
|
@@ -421,12 +433,12 @@ class WCJ_Reports {
|
|
421 |
'id' => 'good_sales_low_stock',
|
422 |
'title' => __( 'Good sales - low stock', 'woocommerce-jetpack' ),
|
423 |
'desc' => __( 'Report shows you products with sales in last 90 days higher than average, but stock lower than products sales in 90 days. Sorted by total stock value.', 'woocommerce-jetpack' ),
|
424 |
-
)
|
425 |
'on_stock' => array(
|
426 |
'id' => 'on_stock',
|
427 |
-
'title' => __( '
|
428 |
-
'desc' => __( '
|
429 |
-
)
|
430 |
'any_sale' => array(
|
431 |
'id' => 'any_sale',
|
432 |
'title' => __( 'any_sale', 'woocommerce-jetpack' ),
|
@@ -442,10 +454,12 @@ class WCJ_Reports {
|
|
442 |
'id' => 'sales_down',
|
443 |
'title' => __( 'sales_down', 'woocommerce-jetpack' ),
|
444 |
'desc' => __( 'sales_down.', 'woocommerce-jetpack' ),
|
445 |
-
)
|
446 |
);
|
447 |
|
448 |
-
|
|
|
|
|
449 |
|
450 |
if ( isset( $_GET['report'] ) ) {
|
451 |
|
@@ -481,12 +495,16 @@ class WCJ_Reports {
|
|
481 |
}
|
482 |
else {
|
483 |
echo '<p>' . __( 'Here you can generate reports. Some reports are generated using all your orders and products, so if you have a lot of them - it may take a while.', 'woocommerce-jetpack' ) . '</p>';
|
484 |
-
echo '<p>' . __( 'Reports:', 'woocommerce-jetpack' ) . '</p>';
|
485 |
-
echo '<
|
486 |
foreach ( $this->reports_info as $report => $report_info ) {
|
487 |
-
echo '<li><a href="admin.php?page=wcj-tools&tab=reports&report=' . $report . '">' . $report_info['title'] . '</a> - ' . $report_info['desc'] . '</li>';
|
|
|
|
|
|
|
|
|
488 |
}
|
489 |
-
echo '</
|
490 |
}
|
491 |
}
|
492 |
}
|
5 |
* The WooCommerce Jetpack Reports class.
|
6 |
*
|
7 |
* @class WCJ_Reports
|
8 |
+
* @version 1.1.1
|
9 |
* @category Class
|
10 |
* @author Algoritmika Ltd.
|
11 |
*/
|
50 |
* Add Enable option to Jetpack Settings Dashboard.
|
51 |
*/
|
52 |
public function add_enabled_option( $settings ) {
|
|
|
53 |
$all_settings = $this->get_settings();
|
54 |
$settings[] = $all_settings[1];
|
|
|
55 |
return $settings;
|
56 |
}
|
57 |
|
149 |
|
150 |
$args_orders = array(
|
151 |
'post_type' => 'shop_order',
|
152 |
+
//'post_status' => 'publish',
|
153 |
+
'post_status' => 'completed',
|
154 |
'posts_per_page' => -1,
|
155 |
'orderby' => 'date',
|
156 |
'order' => 'DESC',
|
217 |
$info['total_stock_price'] += $product_info['stock_price'];
|
218 |
}
|
219 |
|
220 |
+
if ( 0 != $stock_non_zero_number ) {
|
221 |
+
$info['stock_price_average'] /= $stock_non_zero_number;
|
222 |
+
$info['stock_average'] /= $stock_non_zero_number;
|
223 |
+
$info['sales_in_period_average'][$this->period] /= $stock_non_zero_number;
|
224 |
+
}
|
225 |
}
|
226 |
|
227 |
/*
|
281 |
|
282 |
$html .= '<th class="wcj_report_table_sales_columns">' . __( 'Last sale', 'woocommerce-jetpack' ) . '</th>';
|
283 |
$html .= '<th class="wcj_report_table_sales_columns">' . sprintf( __( 'Sales in last %s days', 'woocommerce-jetpack' ), $this->period ) . '</th>';
|
284 |
+
$html .= '<th class="wcj_report_table_sales_columns">' . sprintf( __( 'Sales in last %s days', 'woocommerce-jetpack' ), $this->period * 2 ) . '</th>';
|
285 |
+
//$html .= '<th class="wcj_report_table_sales_columns">' . __( 'Sales in previous period', 'woocommerce-jetpack' ) . '</th>';
|
286 |
$html .= '<th class="wcj_report_table_sales_columns">' . __( 'Total sales', 'woocommerce-jetpack' ) . '</th>';
|
287 |
$html .= '</tr>';
|
288 |
|
373 |
$html .= '</tbody></table>';
|
374 |
|
375 |
$html_header = '<h4>' . $report_info['title'] . ': ' . $report_info['desc'] . '</h4>';
|
376 |
+
|
377 |
+
$html_header .= '<table class="widefat" style="width:30% !important;"><tbody>';
|
378 |
+
$html_header .= '<tr>' . '<th>' . __( 'Total current stock value', 'woocommerce-jetpack' ) . '</th>' . '<td>' . wc_price( $total_current_stock_price ) . '</td>' . '</tr>';
|
379 |
+
$html_header .= '<tr>' . '<th>' . __( 'Total stock value', 'woocommerce-jetpack' ) . '</th>' . '<td>' . wc_price( $info['total_stock_price'] ) . '</td>' . '</tr>';
|
380 |
+
$html_header .= '<tr>' . '<th>' . __( 'Product stock value average', 'woocommerce-jetpack' ) . '</th>' . '<td>' . wc_price( $info['stock_price_average'] ) . '</td>' . '</tr>';
|
381 |
+
$html_header .= '<tr>' . '<th>' . __( 'Product stock average', 'woocommerce-jetpack' ) . '</th>' . '<td>' . number_format( $info['stock_average'], 2, '.', '' ) . '</td>' . '</tr>';
|
382 |
+
$html_header .= '</tbody></table>';
|
383 |
+
$html_header .= '<br class="clear">';
|
384 |
+
|
385 |
+
/*
|
386 |
$html_header .= '<div class="updated1">' . __( 'Total current stock value: ', 'woocommerce-jetpack' ) . wc_price( $total_current_stock_price ) . '</div>';
|
387 |
$html_header .= '<div class="updated1">' . __( 'Total stock value: ', 'woocommerce-jetpack' ) . wc_price( $info['total_stock_price'] ) . '</div>';
|
388 |
//$html_header .= '<div class="updated1">' . __( 'Product sales in 90 average: ', 'woocommerce-jetpack' ) . number_format( $info['sales_in_90_days_average'], 2, '.', '' ) . '</div>';
|
389 |
$html_header .= '<div class="updated1">' . __( 'Product stock value average: ', 'woocommerce-jetpack' ) . wc_price( $info['stock_price_average'] ) . '</div>';
|
390 |
$html_header .= '<div class="updated1">' . __( 'Product stock average: ', 'woocommerce-jetpack' ) . number_format( $info['stock_average'], 2, '.', '' ) . '</div>';
|
391 |
+
*/
|
392 |
|
393 |
// Report title and description
|
394 |
//$html_report_title = '<h4>' . $report_info['title'] . ': ' . $report_info['desc'] . '</h4>';
|
403 |
public function create_reports_tool() {
|
404 |
|
405 |
$this->reports_info = array(
|
406 |
+
/*'bad_stock' => array(
|
407 |
'id' => 'bad_stock',
|
408 |
'title' => __( 'Low sales - big stock', 'woocommerce-jetpack' ),
|
409 |
'desc' => __( 'Report shows you products with stock bigger than <span style="color:green;">%s</span> average, but with sales in last 90 days lower than average. Sorted by total stock value.', 'woocommerce-jetpack' ),
|
433 |
'id' => 'good_sales_low_stock',
|
434 |
'title' => __( 'Good sales - low stock', 'woocommerce-jetpack' ),
|
435 |
'desc' => __( 'Report shows you products with sales in last 90 days higher than average, but stock lower than products sales in 90 days. Sorted by total stock value.', 'woocommerce-jetpack' ),
|
436 |
+
),*/
|
437 |
'on_stock' => array(
|
438 |
'id' => 'on_stock',
|
439 |
+
'title' => __( 'All Products on Stock', 'woocommerce-jetpack' ),
|
440 |
+
'desc' => __( 'Report shows all products that are on stock.', 'woocommerce-jetpack' ),
|
441 |
+
),/*
|
442 |
'any_sale' => array(
|
443 |
'id' => 'any_sale',
|
444 |
'title' => __( 'any_sale', 'woocommerce-jetpack' ),
|
454 |
'id' => 'sales_down',
|
455 |
'title' => __( 'sales_down', 'woocommerce-jetpack' ),
|
456 |
'desc' => __( 'sales_down.', 'woocommerce-jetpack' ),
|
457 |
+
),*/
|
458 |
);
|
459 |
|
460 |
+
echo '<h2>WooCommerce Jetpack - Smart Reports</h2>';
|
461 |
+
|
462 |
+
// $this->output_submenu();
|
463 |
|
464 |
if ( isset( $_GET['report'] ) ) {
|
465 |
|
495 |
}
|
496 |
else {
|
497 |
echo '<p>' . __( 'Here you can generate reports. Some reports are generated using all your orders and products, so if you have a lot of them - it may take a while.', 'woocommerce-jetpack' ) . '</p>';
|
498 |
+
//echo '<p>' . __( 'Reports:', 'woocommerce-jetpack' ) . '</p>';
|
499 |
+
echo '<table class="widefat"><tbody>';
|
500 |
foreach ( $this->reports_info as $report => $report_info ) {
|
501 |
+
//echo '<li><a href="admin.php?page=wcj-tools&tab=reports&report=' . $report . '">' . $report_info['title'] . '</a> - ' . $report_info['desc'] . '</li>';
|
502 |
+
echo '<tr>';
|
503 |
+
if ( ! isset( $report_info['tab'] ) || 'general' === $report_info['tab'] )
|
504 |
+
echo '<td><a href="admin.php?page=wcj-tools&tab=reports&report=' . $report . '">' . $report_info['title'] . '</a></td>' . '<td>' . $report_info['desc'] . '</td>';
|
505 |
+
echo '</tr>';
|
506 |
}
|
507 |
+
echo '</tbody></table>';
|
508 |
}
|
509 |
}
|
510 |
}
|
includes/class-wcj-shipping.php
CHANGED
@@ -4,8 +4,12 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Shipping class.
|
6 |
*
|
7 |
-
* @class
|
|
|
|
|
|
|
8 |
*/
|
|
|
9 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
10 |
|
11 |
if ( ! class_exists( 'WCJ_Shipping' ) ) :
|
4 |
*
|
5 |
* The WooCommerce Jetpack Shipping class.
|
6 |
*
|
7 |
+
* @class WCJ_Shipping
|
8 |
+
* @version 1.0.0
|
9 |
+
* @category Class
|
10 |
+
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
+
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
14 |
|
15 |
if ( ! class_exists( 'WCJ_Shipping' ) ) :
|
includes/class-wcj-sorting.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The WooCommerce Jetpack Sorting class.
|
6 |
*
|
7 |
* @class WCJ_Sorting
|
8 |
-
* @version 1.0.
|
9 |
* @category Class
|
10 |
* @author Algoritmika Ltd.
|
11 |
*/
|
@@ -72,13 +72,13 @@ class WCJ_Sorting {
|
|
72 |
if ( isset( $section['id'] ) && 'woocommerce_cart_redirect_after_add' == $section['id'] ) {
|
73 |
|
74 |
$updated_settings[] = array(
|
75 |
-
'title' => __( 'Remove All Sorting', 'woocommerce-jetpack' ),
|
76 |
-
'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
77 |
'id' => 'wcj_sorting_remove_all_enabled',
|
78 |
'type' => 'checkbox',
|
79 |
'default' => 'no',
|
80 |
'desc' => __( 'Completely remove sorting from the shop front end', 'woocommerce-jetpack' ),
|
81 |
'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
|
|
82 |
);
|
83 |
}
|
84 |
|
@@ -273,10 +273,8 @@ class WCJ_Sorting {
|
|
273 |
/*
|
274 |
* Add settings section to WooCommerce > Settings > Jetpack.
|
275 |
*/
|
276 |
-
function settings_section( $sections ) {
|
277 |
-
|
278 |
-
$sections['sorting'] = 'Sorting';
|
279 |
-
|
280 |
return $sections;
|
281 |
}
|
282 |
}
|
5 |
* The WooCommerce Jetpack Sorting class.
|
6 |
*
|
7 |
* @class WCJ_Sorting
|
8 |
+
* @version 1.0.1
|
9 |
* @category Class
|
10 |
* @author Algoritmika Ltd.
|
11 |
*/
|
72 |
if ( isset( $section['id'] ) && 'woocommerce_cart_redirect_after_add' == $section['id'] ) {
|
73 |
|
74 |
$updated_settings[] = array(
|
75 |
+
'title' => __( 'WooJetpack: Remove All Sorting', 'woocommerce-jetpack' ),
|
|
|
76 |
'id' => 'wcj_sorting_remove_all_enabled',
|
77 |
'type' => 'checkbox',
|
78 |
'default' => 'no',
|
79 |
'desc' => __( 'Completely remove sorting from the shop front end', 'woocommerce-jetpack' ),
|
80 |
'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
81 |
+
'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
82 |
);
|
83 |
}
|
84 |
|
273 |
/*
|
274 |
* Add settings section to WooCommerce > Settings > Jetpack.
|
275 |
*/
|
276 |
+
function settings_section( $sections ) {
|
277 |
+
$sections['sorting'] = __( 'Sorting', 'woocommerce-jetpack' );
|
|
|
|
|
278 |
return $sections;
|
279 |
}
|
280 |
}
|
includes/gateways/class-wc-gateway-wcj-custom.php
CHANGED
@@ -1,7 +1,15 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
*/
|
|
|
5 |
add_action( 'plugins_loaded', 'init_wc_gateway_wcj_custom_class' );
|
6 |
|
7 |
function init_wc_gateway_wcj_custom_class() {
|
@@ -24,17 +32,21 @@ function init_wc_gateway_wcj_custom_class() {
|
|
24 |
$this->init_settings();
|
25 |
|
26 |
// Define user set variables
|
27 |
-
$this->title
|
28 |
-
$this->description
|
29 |
-
$this->instructions
|
30 |
-
$this->
|
31 |
-
$this->
|
32 |
-
$this->
|
33 |
-
$this->
|
|
|
34 |
|
35 |
// Actions
|
36 |
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
|
37 |
-
|
|
|
|
|
|
|
38 |
|
39 |
// Customer Emails
|
40 |
add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
|
@@ -95,10 +107,17 @@ function init_wc_gateway_wcj_custom_class() {
|
|
95 |
'instructions' => array(
|
96 |
'title' => __( 'Instructions', 'woocommerce' ),
|
97 |
'type' => 'textarea',
|
98 |
-
'description' => __( 'Instructions that will be added to the thank you page
|
99 |
'default' => '',
|
100 |
'desc_tip' => true,
|
101 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
'icon' => array(
|
103 |
'title' => __( 'Icon', 'woocommerce-jetpack' ),
|
104 |
'type' => 'text',
|
@@ -248,8 +267,9 @@ function init_wc_gateway_wcj_custom_class() {
|
|
248 |
* @param bool $plain_text
|
249 |
*/
|
250 |
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
|
251 |
-
if ( $this->
|
252 |
-
|
|
|
253 |
}
|
254 |
}
|
255 |
|
@@ -275,7 +295,7 @@ function init_wc_gateway_wcj_custom_class() {
|
|
275 |
// Return thankyou redirect
|
276 |
return array(
|
277 |
'result' => 'success',
|
278 |
-
'redirect' => $this->get_return_url( $order )
|
279 |
);
|
280 |
}
|
281 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* WooCommerce Jetpack Custom Payment Gateway
|
4 |
+
*
|
5 |
+
* The WooCommerce Jetpack Custom Payment Gateway class.
|
6 |
+
*
|
7 |
+
* @class WC_Gateway_WCJ_Custom
|
8 |
+
* @version 1.1.0
|
9 |
+
* @category Class
|
10 |
+
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
+
|
13 |
add_action( 'plugins_loaded', 'init_wc_gateway_wcj_custom_class' );
|
14 |
|
15 |
function init_wc_gateway_wcj_custom_class() {
|
32 |
$this->init_settings();
|
33 |
|
34 |
// Define user set variables
|
35 |
+
$this->title = $this->get_option( 'title' );
|
36 |
+
$this->description = $this->get_option( 'description' );
|
37 |
+
$this->instructions = $this->get_option( 'instructions', '' );//$this->description );
|
38 |
+
$this->instructions_in_email = $this->get_option( 'instructions_in_email', '' );
|
39 |
+
$this->icon = $this->get_option( 'icon', '' );//apply_filters( 'woocommerce_wcj_custom_icon', $this->get_option( 'icon', '' ) );
|
40 |
+
$this->min_amount = $this->get_option( 'min_amount', 0 );
|
41 |
+
$this->enable_for_methods = $this->get_option( 'enable_for_methods', array() );
|
42 |
+
$this->enable_for_virtual = $this->get_option( 'enable_for_virtual', 'yes' ) === 'yes' ? true : false;
|
43 |
|
44 |
// Actions
|
45 |
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
|
46 |
+
|
47 |
+
// add_action( 'woocommerce_thankyou_jetpack_custom_gateway', array( $this, 'thankyou_page' ) );
|
48 |
+
add_action( 'woocommerce_thankyou_' . $this->id, array( $this, 'thankyou_page' ) );
|
49 |
+
|
50 |
|
51 |
// Customer Emails
|
52 |
add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
|
107 |
'instructions' => array(
|
108 |
'title' => __( 'Instructions', 'woocommerce' ),
|
109 |
'type' => 'textarea',
|
110 |
+
'description' => __( 'Instructions that will be added to the thank you page.', 'woocommerce-jetpack' ),
|
111 |
'default' => '',
|
112 |
'desc_tip' => true,
|
113 |
),
|
114 |
+
'instructions_in_email' => array(
|
115 |
+
'title' => __( 'Email Instructions', 'woocommerce' ),
|
116 |
+
'type' => 'textarea',
|
117 |
+
'description' => __( 'Instructions that will be added to the emails.', 'woocommerce-jetpack' ),
|
118 |
+
'default' => '',
|
119 |
+
'desc_tip' => true,
|
120 |
+
),
|
121 |
'icon' => array(
|
122 |
'title' => __( 'Icon', 'woocommerce-jetpack' ),
|
123 |
'type' => 'text',
|
267 |
* @param bool $plain_text
|
268 |
*/
|
269 |
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
|
270 |
+
// if ( $this->instructions_in_email && ! $sent_to_admin && 'jetpack_custom_gateway' === $order->payment_method && 'on-hold' === $order->status ) {
|
271 |
+
if ( $this->instructions_in_email && ! $sent_to_admin && $this->id === $order->payment_method && 'on-hold' === $order->status ) {
|
272 |
+
echo wpautop( wptexturize( $this->instructions_in_email ) ) . PHP_EOL;
|
273 |
}
|
274 |
}
|
275 |
|
295 |
// Return thankyou redirect
|
296 |
return array(
|
297 |
'result' => 'success',
|
298 |
+
'redirect' => $this->get_return_url( $order ),
|
299 |
);
|
300 |
}
|
301 |
}
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== WooCommerce Jetpack ===
|
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
|
5 |
Requires at least: 3.9.1
|
6 |
Tested up to: 4.0
|
7 |
-
Stable tag: 1.
|
8 |
License: GNU General Public License v3.0
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -26,6 +26,7 @@ WooCommerce Jetpack is a WordPress plugin that supercharges your site with aweso
|
|
26 |
* Checkout - Customize checkout fields: disable/enable fields, set required, change labels and/or placeholders.
|
27 |
* Shipping - Hide shipping when free is available.
|
28 |
* Emails - Add another email recipient(s) to all WooCommerce emails.
|
|
|
29 |
* Product Info - Customize single product tabs. Change related products number.
|
30 |
* Cart - Add "Empty Cart" button to cart page, automatically add product to cart on visit.
|
31 |
* 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).
|
@@ -64,36 +65,31 @@ Please let us know if you want anything added to list by <a href="http://woojetp
|
|
64 |
|
65 |
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!
|
66 |
|
67 |
-
= 1.
|
68 |
-
* Fix - Payment Gateways - Instructions are not showing. Suggested by Jen.
|
69 |
-
* New Feature - Products - Option to exclude categories on shop page (when `Shop Page Display` is set to `Show subcategories` or `Show both`). Idea by Xavier.
|
70 |
-
* Upgrade Feature - Product Info - Show SKU on archive page. Idea by Xavier.
|
71 |
-
|
72 |
-
= 1.7.0 - 01/10/2014 =
|
73 |
* New Feature - Smart Reports - Various reports based on products prices, sales, stock.
|
74 |
-
*
|
|
|
75 |
* Upgrade Feature - Shipping - Advance free shipping - Free shipping for multiple country/places. Each country/places different prices. Idea by LQTOYS.
|
76 |
-
* Upgrade Feature - Custom Price Labels - Add price countdown.
|
77 |
-
* Upgrade Feature - Orders - Minimum order amount - Stop customer from seeing the checkout page if below minimum order amount. Idea by Augen.
|
78 |
-
* Upgrade Feature - Custom Price Labels - Add "global labels".
|
79 |
-
* Upgrade Feature - Shipping - Add "Custom Shipping Method".
|
80 |
-
* Upgrade Feature - Product Info - Add "total sales" and "time since last sale" info.
|
81 |
-
* Upgrade Feature - Product Info - Add widget.
|
82 |
-
* Upgrade Feature - Orders - Custom Order Statuses - Add options for selecting icons and color.
|
83 |
* Upgrade Feature - PDF Invoices - Make emailing PDF as attachment option available for certain payment methods only (user selection). Idea by Jen.
|
84 |
* Upgrade Feature - PDF Invoices - Sending invoice on customer's request. Idea by Jen.
|
85 |
-
* Upgrade Feature - PDF Invoices - Separate numbering for invoices option, then can add `add_order_number_to_invoice` option.
|
86 |
-
* Upgrade Feature - Custom CSS - Need to add custom CSS option (problem with color of price matching the background in minimum order amount message; suggested by Augen).
|
87 |
-
* Dev - Custom Price Labels - Rearrange settings in product edit (something like `postbox`es).
|
88 |
-
* Dev - Rename "Features" to "Modules".
|
89 |
|
90 |
-
= 1.8.0 -
|
|
|
91 |
* New Feature - Products per Page - Add "products per page" option for customers (i.e. front end).
|
92 |
-
* Upgrade Feature -
|
|
|
|
|
|
|
|
|
93 |
* Upgrade Feature - Product Info - Today's deal.
|
94 |
* Upgrade Feature - Product Info - Images for variations.
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
-
= 1.9.0 -
|
97 |
* Upgrade Feature - Custom Price Labels - Add "local remove".
|
98 |
* Upgrade Feature - Orders - Bulk orders i.e. "Buy More - Pay Less". Start from global discount for all products, i.e. cart discount; later - discounts for individual products.
|
99 |
* Upgrade Feature - Custom Price Labels - Add different labels for archives, single, homepage, related. Add option to select which price hooks to use. Different labels for variable and variation.
|
@@ -105,12 +101,28 @@ If you wish that some task would go up the queue to make it faster, please conta
|
|
105 |
* Upgrade Feature - Orders - Maximum weight - "Contact us" to place order with products total weight over some amount.
|
106 |
* Upgrade Feature - Sorting - Add sorting by popularity in e.g. 90 days (not by `total_sales` as it is by default in WooCommerce).
|
107 |
|
108 |
-
= 2.0.0 -
|
109 |
* Dev - Move all to `WooCommerce > Jetpack` menu.
|
110 |
* Dev - Major source code, documentation, locking mechanism etc. recheck.
|
|
|
|
|
111 |
|
112 |
== Changelog ==
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
= 1.6.2 - 25/09/2014 =
|
115 |
* Feature Upgraded - Orders - Orders Numbers - Additional custom date prefix added. Suggested by Sergio.
|
116 |
Value is passed directly to PHP `date` function, so most of PHP date formats can be used.
|
@@ -119,7 +131,8 @@ If you wish that some task would go up the queue to make it faster, please conta
|
|
119 |
|
120 |
= 1.6.1 - 23/09/2014 =
|
121 |
* New Feature - General - Another custom CSS tool.
|
122 |
-
|
|
|
123 |
|
124 |
= 1.6.0 - 22/09/2014 =
|
125 |
* Fix - PDF Invoices - Wrong headers for PDF sent, fixed.
|
1 |
=== WooCommerce Jetpack ===
|
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
|
5 |
Requires at least: 3.9.1
|
6 |
Tested up to: 4.0
|
7 |
+
Stable tag: 1.7.1
|
8 |
License: GNU General Public License v3.0
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
26 |
* Checkout - Customize checkout fields: disable/enable fields, set required, change labels and/or placeholders.
|
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 - Customize single product tabs. Change related products number.
|
31 |
* Cart - Add "Empty Cart" button to cart page, automatically add product to cart on visit.
|
32 |
* 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).
|
65 |
|
66 |
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!
|
67 |
|
68 |
+
= 1.7.2 - 06/10/2014 =
|
|
|
|
|
|
|
|
|
|
|
69 |
* New Feature - Smart Reports - Various reports based on products prices, sales, stock.
|
70 |
+
* Upgrade Feature - Custom Statuses - Bulk change status.
|
71 |
+
* Upgrade Feature - Payment Gateways - Additional payment gateways. Idea by Kristof.
|
72 |
* Upgrade Feature - Shipping - Advance free shipping - Free shipping for multiple country/places. Each country/places different prices. Idea by LQTOYS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
* Upgrade Feature - PDF Invoices - Make emailing PDF as attachment option available for certain payment methods only (user selection). Idea by Jen.
|
74 |
* Upgrade Feature - PDF Invoices - Sending invoice on customer's request. Idea by Jen.
|
|
|
|
|
|
|
|
|
75 |
|
76 |
+
= 1.8.0 - 13/10/2014 =
|
77 |
+
* New Feature - Add second currency to the price.
|
78 |
* New Feature - Products per Page - Add "products per page" option for customers (i.e. front end).
|
79 |
+
* Upgrade Feature - Shipping - Add "Custom Shipping Method".
|
80 |
+
* Upgrade Feature - PDF Invoices - Separate numbering for invoices option, then can add `add_order_number_to_invoice` option.
|
81 |
+
* Upgrade Feature - Custom Price Labels - Add price countdown.
|
82 |
+
* Upgrade Feature - Custom Price Labels - Add "global labels".
|
83 |
+
* Upgrade Feature - Product Info - Add widget.
|
84 |
* Upgrade Feature - Product Info - Today's deal.
|
85 |
* Upgrade Feature - Product Info - Images for variations.
|
86 |
+
* Upgrade Feature - Product Info - Add "%time_since_last_sale%".
|
87 |
+
* Upgrade Feature - Orders - Custom Order Statuses - Add options for selecting icons and color.
|
88 |
+
* Upgrade Feature - Smart Reports - Export to CSV file.
|
89 |
+
* Upgrade Feature - Call for Price - Call for price for variable products (all variations or only some).
|
90 |
+
* Dev - Custom Price Labels - Rearrange settings in product edit (something like `postbox`es).
|
91 |
|
92 |
+
= 1.9.0 - 20/10/2014 =
|
93 |
* Upgrade Feature - Custom Price Labels - Add "local remove".
|
94 |
* Upgrade Feature - Orders - Bulk orders i.e. "Buy More - Pay Less". Start from global discount for all products, i.e. cart discount; later - discounts for individual products.
|
95 |
* Upgrade Feature - Custom Price Labels - Add different labels for archives, single, homepage, related. Add option to select which price hooks to use. Different labels for variable and variation.
|
101 |
* Upgrade Feature - Orders - Maximum weight - "Contact us" to place order with products total weight over some amount.
|
102 |
* Upgrade Feature - Sorting - Add sorting by popularity in e.g. 90 days (not by `total_sales` as it is by default in WooCommerce).
|
103 |
|
104 |
+
= 2.0.0 - 27/10/2014 =
|
105 |
* Dev - Move all to `WooCommerce > Jetpack` menu.
|
106 |
* Dev - Major source code, documentation, locking mechanism etc. recheck.
|
107 |
+
Maybe rename "Features" to "Modules".
|
108 |
+
* Dev - Add "Restore Defaults" option (will need to delete/reset all posts' some meta (e.g. price labels) also).
|
109 |
|
110 |
== Changelog ==
|
111 |
|
112 |
+
= 1.7.1 - 02/10/2014 =
|
113 |
+
* Fix - `%total_sales%` is temporary disabled.
|
114 |
+
This was causing "PHP Parse error" on some servers. Reported by Xavier.
|
115 |
+
|
116 |
+
= 1.7.0 - 02/10/2014 =
|
117 |
+
* Fix - Payment Gateways - Instructions were not showing (suggested by Jen), fixed.
|
118 |
+
* New Feature - Product Listings - Options added (separately for "Shop" and "Categories" pages): show/hide categories count, exclude categories (idea by Xavier), show/hide empty categories.
|
119 |
+
This will work only when "Shop Page Display" and/or "Default Category Display" in "WooCommerce > Settings > Products > Product Listings" is set to "Show subcategories" or "Show both".
|
120 |
+
All new options fields are also added (duplicated) to "WooCommerce > Settings > Products > Product Listings".
|
121 |
+
* Feature Upgraded - Payment Gateways - Instructions for emails option added (i.e. separated from instructions on thank you page).
|
122 |
+
* Feature Upgraded - Orders - Minimum order amount - Stop customer from seeing the checkout page if below minimum order amount (in this case the customer redirected to Cart page). Idea by Augen.
|
123 |
+
* Feature Upgraded - Product Info - Additional product info (separately for "Single" and "Archive" pages): text, position and priority options added.
|
124 |
+
First "Product Info Shortcodes" added: %sku% for SKU (idea by Xavier) and %total_sales% for Total Sales.
|
125 |
+
|
126 |
= 1.6.2 - 25/09/2014 =
|
127 |
* Feature Upgraded - Orders - Orders Numbers - Additional custom date prefix added. Suggested by Sergio.
|
128 |
Value is passed directly to PHP `date` function, so most of PHP date formats can be used.
|
131 |
|
132 |
= 1.6.1 - 23/09/2014 =
|
133 |
* New Feature - General - Another custom CSS tool.
|
134 |
+
This was added because of the problem with color of price matching the background in minimum order amount message (suggested by Augen), which can be fixed with custom CSS.
|
135 |
+
* Dev - Orders - Minimum order amount - `textarea` instead of `text` option type. Now it is possible to add tags (e.g. `<span class="your_class"></span>`) to customers messages.
|
136 |
|
137 |
= 1.6.0 - 22/09/2014 =
|
138 |
* Fix - PDF Invoices - Wrong headers for PDF sent, fixed.
|
woocommerce-jetpack.php
CHANGED
@@ -3,13 +3,14 @@
|
|
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.
|
7 |
Author: Algoritmika Ltd
|
8 |
Author URI: http://www.algoritmika.com
|
9 |
Copyright: © 2014 Algoritmika Ltd.
|
10 |
License: GNU General Public License v3.0
|
11 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
12 |
*/
|
|
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // exit if accessed directly
|
14 |
|
15 |
if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) return; // check if WooCommerce is active
|
@@ -106,14 +107,6 @@ final class WC_Jetpack {
|
|
106 |
), $links );
|
107 |
}
|
108 |
|
109 |
-
/**
|
110 |
-
* wcj_get_option.
|
111 |
-
*
|
112 |
-
public function wcj_get_option( $value ) {
|
113 |
-
|
114 |
-
return $value;
|
115 |
-
}
|
116 |
-
|
117 |
/**
|
118 |
* get_wcj_plus_message.
|
119 |
*/
|
@@ -168,6 +161,7 @@ final class WC_Jetpack {
|
|
168 |
$settings[] = include_once( 'includes/class-wcj-call-for-price.php' );
|
169 |
$settings[] = include_once( 'includes/class-wcj-currencies.php' );
|
170 |
$settings[] = include_once( 'includes/class-wcj-sorting.php' );
|
|
|
171 |
$settings[] = include_once( 'includes/class-wcj-product-info.php' );
|
172 |
|
173 |
$settings[] = include_once( 'includes/class-wcj-add-to-cart.php' );
|
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.7.1
|
7 |
Author: Algoritmika Ltd
|
8 |
Author URI: http://www.algoritmika.com
|
9 |
Copyright: © 2014 Algoritmika Ltd.
|
10 |
License: GNU General Public License v3.0
|
11 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
12 |
*/
|
13 |
+
|
14 |
if ( ! defined( 'ABSPATH' ) ) exit; // exit if accessed directly
|
15 |
|
16 |
if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) return; // check if WooCommerce is active
|
107 |
), $links );
|
108 |
}
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
/**
|
111 |
* get_wcj_plus_message.
|
112 |
*/
|
161 |
$settings[] = include_once( 'includes/class-wcj-call-for-price.php' );
|
162 |
$settings[] = include_once( 'includes/class-wcj-currencies.php' );
|
163 |
$settings[] = include_once( 'includes/class-wcj-sorting.php' );
|
164 |
+
$settings[] = include_once( 'includes/class-wcj-product-listings.php' );
|
165 |
$settings[] = include_once( 'includes/class-wcj-product-info.php' );
|
166 |
|
167 |
$settings[] = include_once( 'includes/class-wcj-add-to-cart.php' );
|