Version Description
- 27/07/2015 =
- Fix - https://wordpress.org/support/topic/custom-payment-gateway-settings-disappeared-after-last-update
- Fix - CART & CHECKOUT - Payment Gateways Fees - Fee removed if current payment gateway is not available for user selected shipping method.
- Fix - CART & CHECKOUT - Payment Gateways Fees - "Tax class" (and "Is taxable") bug fixed.
- Dev - Tools (SKU and Admin) moved to each module's settings.
Download this release
Release Info
Developer | algoritmika |
Plugin | Booster for WooCommerce |
Version | 2.2.3 |
Comparing to | |
See all releases |
Code changes from version 2.2.1 to 2.2.3
- includes/admin/class-wc-settings-jetpack.php +34 -7
- includes/admin/class-wcj-tools.php +22 -25
- includes/admin/wcj-modules-cats.php +4 -1
- includes/class-wcj-admin-tools.php +65 -79
- includes/class-wcj-orders.php +7 -3
- includes/class-wcj-payment-gateways-fees.php +265 -0
- includes/class-wcj-payment-gateways-icons.php +107 -0
- includes/{gateways/class-wcj-payment-gateways-per-category.php → class-wcj-payment-gateways-per-category.php} +22 -8
- includes/class-wcj-payment-gateways.php +30 -415
- includes/class-wcj-pdf-invoices.php +33 -2
- includes/class-wcj-product-input-fields.php +51 -5
- includes/class-wcj-reports.php +11 -4
- includes/class-wcj-sku.php +83 -102
- includes/class-wcj-wholesale-price.php +103 -34
- includes/classes/class-wcj-invoice.php +14 -6
- includes/classes/class-wcj-module.php +98 -5
- includes/functions/wcj-functions.php +15 -2
- includes/gateways/class-wc-gateway-wcj-custom.php +15 -5
- includes/input-fields/class-wcj-product-input-fields-abstract.php +115 -19
- includes/input-fields/class-wcj-product-input-fields-global.php +4 -5
- includes/input-fields/class-wcj-product-input-fields-per-product.php +6 -7
- includes/lib/tcpdf_min/include/tcpdf_fonts.php +4 -1
- includes/pdf-invoices/settings/class-wcj-pdf-invoicing-display.php +2 -3
- includes/pdf-invoices/settings/class-wcj-pdf-invoicing-emails.php +64 -28
- includes/pdf-invoices/settings/class-wcj-pdf-invoicing-numbering.php +25 -27
- includes/price-by-country/class-wcj-price-by-country-core.php +13 -10
- includes/reports/wcj-class-reports-stock.php +29 -13
- includes/shortcodes/class-wcj-order-items-shortcodes.php +1 -17
- includes/shortcodes/class-wcj-orders-shortcodes.php +2 -4
- includes/shortcodes/class-wcj-products-shortcodes.php +28 -24
- readme.txt +37 -6
- woocommerce-jetpack.php +24 -7
- wpml-config.xml +1 -10
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 |
*/
|
@@ -31,8 +31,10 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
|
|
31 |
add_action( 'woocommerce_sections_' . $this->id, array( $this, 'output_cats_submenu' ) );
|
32 |
add_action( 'woocommerce_sections_' . $this->id, array( $this, 'output_sections_submenu' ) );
|
33 |
|
34 |
-
|
35 |
add_action( 'woocommerce_admin_field_custom_number', array( $this, 'output_custom_number' ) );
|
|
|
|
|
36 |
}
|
37 |
|
38 |
/**
|
@@ -50,6 +52,23 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
|
|
50 |
<?php
|
51 |
}
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
/**
|
54 |
* output_custom_number.
|
55 |
*/
|
@@ -148,7 +167,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
|
|
148 |
return;
|
149 |
}
|
150 |
|
151 |
-
echo '<ul class="subsubsub" style="text-transform: uppercase !important;">';
|
152 |
|
153 |
$array_keys = array_keys( $this->cats );
|
154 |
|
@@ -362,15 +381,23 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
|
|
362 |
else {
|
363 |
$settings[] = array(
|
364 |
'title' => __( 'WooCommerce Jetpack Dashboard', 'woocommerce-jetpack' ),
|
365 |
-
'type'
|
366 |
-
'desc'
|
367 |
-
'id'
|
368 |
);
|
369 |
-
|
|
|
370 |
$settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_options', 'title' => '', 'desc' => '', );
|
371 |
return $settings;
|
372 |
}
|
373 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
}
|
375 |
|
376 |
endif;
|
4 |
*
|
5 |
* The WooCommerce Jetpack Settings class.
|
6 |
*
|
7 |
+
* @version 2.2.3
|
8 |
* @since 1.0.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
31 |
add_action( 'woocommerce_sections_' . $this->id, array( $this, 'output_cats_submenu' ) );
|
32 |
add_action( 'woocommerce_sections_' . $this->id, array( $this, 'output_sections_submenu' ) );
|
33 |
|
34 |
+
// add_action( 'woocommerce_admin_field_save_button', array( $this, 'output_save_settings_button' ) );
|
35 |
add_action( 'woocommerce_admin_field_custom_number', array( $this, 'output_custom_number' ) );
|
36 |
+
|
37 |
+
add_action( 'woocommerce_admin_field_module_tools', array( $this, 'output_module_tools' ) );
|
38 |
}
|
39 |
|
40 |
/**
|
52 |
<?php
|
53 |
}
|
54 |
|
55 |
+
/**
|
56 |
+
* output_module_tools.
|
57 |
+
*
|
58 |
+
* @version 2.2.3
|
59 |
+
* @since 2.2.3
|
60 |
+
*/
|
61 |
+
function output_module_tools( $value ) {
|
62 |
+
?><tr valign="top">
|
63 |
+
<th scope="row" class="titledesc">
|
64 |
+
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
|
65 |
+
</th>
|
66 |
+
<td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>">
|
67 |
+
<?php if ( isset( $_GET['section'] ) ) do_action( 'wcj_module_tools_' . $_GET['section'] ); ?>
|
68 |
+
</td>
|
69 |
+
</tr><?php
|
70 |
+
}
|
71 |
+
|
72 |
/**
|
73 |
* output_custom_number.
|
74 |
*/
|
167 |
return;
|
168 |
}
|
169 |
|
170 |
+
echo '<ul class="subsubsub" style="text-transform: uppercase !important; font-weight: bold;">';
|
171 |
|
172 |
$array_keys = array_keys( $this->cats );
|
173 |
|
381 |
else {
|
382 |
$settings[] = array(
|
383 |
'title' => __( 'WooCommerce Jetpack Dashboard', 'woocommerce-jetpack' ),
|
384 |
+
'type' => 'title',
|
385 |
+
'desc' => __( 'This dashboard lets you enable/disable any WooCommerce Jetpack module. Each checkbox comes with short module\'s description. Please visit <a href="http://woojetpack.com" target="_blank">WooJetpack.com</a> for detailed info on each feature.', 'woocommerce-jetpack' ),
|
386 |
+
'id' => 'wcj_options'
|
387 |
);
|
388 |
+
//$settings = apply_filters( 'wcj_features_status', $settings );
|
389 |
+
$settings = array_merge( $settings, $this->module_statuses );
|
390 |
$settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_options', 'title' => '', 'desc' => '', );
|
391 |
return $settings;
|
392 |
}
|
393 |
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* add_module_statuses
|
397 |
+
*/
|
398 |
+
function add_module_statuses( $statuses ) {
|
399 |
+
$this->module_statuses = $statuses;
|
400 |
+
}
|
401 |
}
|
402 |
|
403 |
endif;
|
includes/admin/class-wcj-tools.php
CHANGED
@@ -4,61 +4,58 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Tools class.
|
6 |
*
|
7 |
-
* @
|
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_Tools' ) ) :
|
16 |
|
17 |
class WCJ_Tools {
|
18 |
-
|
19 |
public function __construct() {
|
20 |
-
if ( is_admin() ) {
|
21 |
add_action( 'admin_menu', array($this, 'add_wcj_tools'), 100 );
|
22 |
}
|
23 |
}
|
24 |
-
|
25 |
-
public function add_wcj_tools() {
|
26 |
add_submenu_page( 'woocommerce', 'WooCommerce Jetpack Tools', 'Jetpack Tools', 'manage_options', 'wcj-tools', array( $this, 'create_tools_page' ) );
|
27 |
}
|
28 |
-
|
29 |
public function create_tools_page() {
|
30 |
-
|
31 |
$tabs = array(
|
32 |
-
array(
|
33 |
'id' => 'dashboard',
|
34 |
'title' => __( 'Tools Dashboard', 'woocommerce-jetpack' ),
|
35 |
//'desc' => __( 'WooCommerce Jetpack Tools Dashboard', 'woocommerce-jetpack' ),
|
36 |
),
|
37 |
);
|
38 |
-
|
39 |
$tabs = apply_filters( 'wcj_tools_tabs', $tabs );
|
40 |
-
|
41 |
$html = '<h2 class="nav-tab-wrapper woo-nav-tab-wrapper">';
|
42 |
-
|
43 |
$active_tab = 'dashboard';
|
44 |
if ( isset( $_GET['tab'] ) )
|
45 |
$active_tab = $_GET['tab'];
|
46 |
-
|
47 |
foreach ( $tabs as $tab ) {
|
48 |
-
|
49 |
$is_active = '';
|
50 |
if ( $active_tab === $tab['id'] )
|
51 |
$is_active = 'nav-tab-active';
|
52 |
-
|
53 |
//$html .= '<a href="' . get_admin_url() . 'admin.php?page=wcj-tools&tab=' . $tab['id'] . '" class="nav-tab ' . $is_active . '">' . $tab['title'] . '</a>';
|
54 |
//$html .= '<a href="' . add_query_arg( 'tab', $tab['id'] ) . '" class="nav-tab ' . $is_active . '">' . $tab['title'] . '</a>';
|
55 |
$html .= '<a href="admin.php?page=wcj-tools&tab=' . $tab['id'] . '" class="nav-tab ' . $is_active . '">' . $tab['title'] . '</a>';
|
56 |
-
|
57 |
-
}
|
58 |
$html .= '</h2>';
|
59 |
-
|
60 |
echo $html;
|
61 |
-
|
62 |
if ( 'dashboard' === $active_tab ) {
|
63 |
echo '<h3>' . __( 'WooCommerce Jetpack Tools Dashboard', 'woocommerce-jetpack' ) . '</h3>';
|
64 |
echo '<p>' . __( 'This dashboard lets you check statuses and short descriptions of all available WooCommerce Jetpack tools. Tools can be enabled through WooCommerce > Settings > Jetpack. Enabled tools will appear in the tabs menu above.', 'woocommerce-jetpack' ) . '</p>';
|
@@ -68,12 +65,12 @@ class WCJ_Tools {
|
|
68 |
echo '<th style="width:25%;">' . __( 'Status', 'woocommerce-jetpack' ) . '</th>';
|
69 |
echo '<th style="width:50%;">' . __( 'Description', 'woocommerce-jetpack' ) . '</th>';
|
70 |
echo '</tr>';
|
71 |
-
do_action( 'wcj_tools_' . $active_tab );
|
72 |
echo '</table>';
|
73 |
}
|
74 |
-
else
|
75 |
do_action( 'wcj_tools_' . $active_tab );
|
76 |
-
}
|
77 |
}
|
78 |
|
79 |
endif;
|
4 |
*
|
5 |
* The WooCommerce Jetpack Tools class.
|
6 |
*
|
7 |
+
* @author Algoritmika Ltd.
|
|
|
|
|
|
|
8 |
*/
|
9 |
+
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
|
12 |
if ( ! class_exists( 'WCJ_Tools' ) ) :
|
13 |
|
14 |
class WCJ_Tools {
|
15 |
+
|
16 |
public function __construct() {
|
17 |
+
if ( is_admin() ) {
|
18 |
add_action( 'admin_menu', array($this, 'add_wcj_tools'), 100 );
|
19 |
}
|
20 |
}
|
21 |
+
|
22 |
+
public function add_wcj_tools() {
|
23 |
add_submenu_page( 'woocommerce', 'WooCommerce Jetpack Tools', 'Jetpack Tools', 'manage_options', 'wcj-tools', array( $this, 'create_tools_page' ) );
|
24 |
}
|
25 |
+
|
26 |
public function create_tools_page() {
|
27 |
+
|
28 |
$tabs = array(
|
29 |
+
array(
|
30 |
'id' => 'dashboard',
|
31 |
'title' => __( 'Tools Dashboard', 'woocommerce-jetpack' ),
|
32 |
//'desc' => __( 'WooCommerce Jetpack Tools Dashboard', 'woocommerce-jetpack' ),
|
33 |
),
|
34 |
);
|
35 |
+
|
36 |
$tabs = apply_filters( 'wcj_tools_tabs', $tabs );
|
37 |
+
|
38 |
$html = '<h2 class="nav-tab-wrapper woo-nav-tab-wrapper">';
|
39 |
+
|
40 |
$active_tab = 'dashboard';
|
41 |
if ( isset( $_GET['tab'] ) )
|
42 |
$active_tab = $_GET['tab'];
|
43 |
+
|
44 |
foreach ( $tabs as $tab ) {
|
45 |
+
|
46 |
$is_active = '';
|
47 |
if ( $active_tab === $tab['id'] )
|
48 |
$is_active = 'nav-tab-active';
|
49 |
+
|
50 |
//$html .= '<a href="' . get_admin_url() . 'admin.php?page=wcj-tools&tab=' . $tab['id'] . '" class="nav-tab ' . $is_active . '">' . $tab['title'] . '</a>';
|
51 |
//$html .= '<a href="' . add_query_arg( 'tab', $tab['id'] ) . '" class="nav-tab ' . $is_active . '">' . $tab['title'] . '</a>';
|
52 |
$html .= '<a href="admin.php?page=wcj-tools&tab=' . $tab['id'] . '" class="nav-tab ' . $is_active . '">' . $tab['title'] . '</a>';
|
53 |
+
|
54 |
+
}
|
55 |
$html .= '</h2>';
|
56 |
+
|
57 |
echo $html;
|
58 |
+
|
59 |
if ( 'dashboard' === $active_tab ) {
|
60 |
echo '<h3>' . __( 'WooCommerce Jetpack Tools Dashboard', 'woocommerce-jetpack' ) . '</h3>';
|
61 |
echo '<p>' . __( 'This dashboard lets you check statuses and short descriptions of all available WooCommerce Jetpack tools. Tools can be enabled through WooCommerce > Settings > Jetpack. Enabled tools will appear in the tabs menu above.', 'woocommerce-jetpack' ) . '</p>';
|
65 |
echo '<th style="width:25%;">' . __( 'Status', 'woocommerce-jetpack' ) . '</th>';
|
66 |
echo '<th style="width:50%;">' . __( 'Description', 'woocommerce-jetpack' ) . '</th>';
|
67 |
echo '</tr>';
|
68 |
+
do_action( 'wcj_tools_' . $active_tab );
|
69 |
echo '</table>';
|
70 |
}
|
71 |
+
else
|
72 |
do_action( 'wcj_tools_' . $active_tab );
|
73 |
+
}
|
74 |
}
|
75 |
|
76 |
endif;
|
includes/admin/wcj-modules-cats.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Modules Array.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @since 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
@@ -72,6 +72,9 @@ return array(
|
|
72 |
'checkout_custom_fields',
|
73 |
'checkout_custom_info',
|
74 |
'payment_gateways',
|
|
|
|
|
|
|
75 |
),
|
76 |
),
|
77 |
|
4 |
*
|
5 |
* The WooCommerce Modules Array.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
* @since 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
72 |
'checkout_custom_fields',
|
73 |
'checkout_custom_info',
|
74 |
'payment_gateways',
|
75 |
+
'payment_gateways_icons',
|
76 |
+
'payment_gateways_fees',
|
77 |
+
'payment_gateways_per_category',
|
78 |
),
|
79 |
),
|
80 |
|
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 |
|
@@ -12,25 +12,29 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
12 |
|
13 |
if ( ! class_exists( 'WCJ_Admin_Tools' ) ) :
|
14 |
|
15 |
-
class WCJ_Admin_Tools {
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
|
|
|
24 |
add_filter( 'wcj_tools_tabs', array( $this, 'add_tool_tab' ), 100 );
|
25 |
add_action( 'wcj_tools_' . 'admin_tools', array( $this, 'create_tool' ), 100 );
|
26 |
-
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
add_filter( 'wcj_settings_admin_tools', array( $this, 'get_settings' ), 100 );
|
31 |
-
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
32 |
-
add_action( 'wcj_tools_dashboard', array( $this, 'add_tool_info_to_tools_dashboard' ), 100 );
|
33 |
-
}
|
34 |
|
35 |
/**
|
36 |
* add_tool_info_to_tools_dashboard.
|
@@ -52,15 +56,17 @@ class WCJ_Admin_Tools {
|
|
52 |
*/
|
53 |
public function add_tool_tab( $tabs ) {
|
54 |
$tabs[] = array(
|
55 |
-
'id'
|
56 |
-
'title'
|
57 |
);
|
58 |
return $tabs;
|
59 |
}
|
60 |
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
64 |
public function create_tool() {
|
65 |
|
66 |
$the_notice = '';
|
@@ -70,6 +76,8 @@ class WCJ_Admin_Tools {
|
|
70 |
}
|
71 |
|
72 |
$the_tools = '';
|
|
|
|
|
73 |
$the_tools .= '<a href="' . add_query_arg( 'wcj_delete_log', '1' ) . '">' . __( 'Delete Log', 'woocommerce-jetpack' ) . '</a>';
|
74 |
|
75 |
$the_log = '';
|
@@ -85,69 +93,47 @@ class WCJ_Admin_Tools {
|
|
85 |
|
86 |
}
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
* get_settings.
|
99 |
-
*/
|
100 |
-
function get_settings() {
|
101 |
-
|
102 |
-
$settings = array(
|
103 |
-
|
104 |
-
array( 'title' => __( 'Admin Tools Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_admin_tools_options' ),
|
105 |
-
|
106 |
-
array(
|
107 |
-
'title' => __( 'Admin Tools', 'woocommerce-jetpack' ),
|
108 |
-
'desc' => '<strong>' . __( 'Enable Module', 'woocommerce-jetpack' ) . '</strong>',
|
109 |
-
'desc_tip' => __( 'Debug and log tools for WooCommerce Jetpack.', 'woocommerce-jetpack' ),
|
110 |
-
'id' => 'wcj_admin_tools_enabled',
|
111 |
-
'default' => 'no',
|
112 |
-
'type' => 'checkbox',
|
113 |
-
),
|
114 |
-
|
115 |
-
array(
|
116 |
-
'title' => __( 'Logging', 'woocommerce-jetpack' ),
|
117 |
-
'desc' => __( 'Enable', 'woocommerce-jetpack' ),
|
118 |
-
'id' => 'wcj_logging_enabled',
|
119 |
-
'default' => 'no',
|
120 |
-
'type' => 'checkbox',
|
121 |
-
),
|
122 |
|
123 |
array(
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
/*array(
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
* settings_section.
|
146 |
-
*/
|
147 |
-
function settings_section( $sections ) {
|
148 |
-
$sections['admin_tools'] = __( 'Admin Tools', 'woocommerce-jetpack' );
|
149 |
-
return $sections;
|
150 |
-
}
|
151 |
}
|
152 |
|
153 |
endif;
|
4 |
*
|
5 |
* The WooCommerce Jetpack Admin Tools class.
|
6 |
*
|
7 |
+
* @version 2.2.3
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
12 |
|
13 |
if ( ! class_exists( 'WCJ_Admin_Tools' ) ) :
|
14 |
|
15 |
+
class WCJ_Admin_Tools extends WCJ_Module {
|
16 |
|
17 |
+
/**
|
18 |
+
* Constructor.
|
19 |
+
*
|
20 |
+
* @version 2.2.3
|
21 |
+
*/
|
22 |
+
public function __construct() {
|
23 |
+
|
24 |
+
$this->id = 'admin_tools';
|
25 |
+
$this->short_desc = __( 'Admin Tools', 'woocommerce-jetpack' );
|
26 |
+
$this->desc = __( 'Debug and log tools for WooCommerce Jetpack.', 'woocommerce-jetpack' );
|
27 |
+
parent::__construct();
|
28 |
|
29 |
+
$this->add_tools( array( 'admin_tools' => __( 'Admin Tools', 'woocommerce-jetpack' ), ) );
|
30 |
+
|
31 |
+
if ( $this->is_enabled() ) {
|
32 |
add_filter( 'wcj_tools_tabs', array( $this, 'add_tool_tab' ), 100 );
|
33 |
add_action( 'wcj_tools_' . 'admin_tools', array( $this, 'create_tool' ), 100 );
|
34 |
+
}
|
35 |
|
36 |
+
add_action( 'wcj_tools_dashboard', array( $this, 'add_tool_info_to_tools_dashboard' ), 100 );
|
37 |
+
}
|
|
|
|
|
|
|
|
|
38 |
|
39 |
/**
|
40 |
* add_tool_info_to_tools_dashboard.
|
56 |
*/
|
57 |
public function add_tool_tab( $tabs ) {
|
58 |
$tabs[] = array(
|
59 |
+
'id' => 'admin_tools',
|
60 |
+
'title' => __( 'Log', 'woocommerce-jetpack' ),
|
61 |
);
|
62 |
return $tabs;
|
63 |
}
|
64 |
|
65 |
+
/**
|
66 |
+
* create_tool.
|
67 |
+
*
|
68 |
+
* @version 2.2.3
|
69 |
+
*/
|
70 |
public function create_tool() {
|
71 |
|
72 |
$the_notice = '';
|
76 |
}
|
77 |
|
78 |
$the_tools = '';
|
79 |
+
$the_tools .= $this->get_back_to_settings_link_html();
|
80 |
+
$the_tools .= '<br>';
|
81 |
$the_tools .= '<a href="' . add_query_arg( 'wcj_delete_log', '1' ) . '">' . __( 'Delete Log', 'woocommerce-jetpack' ) . '</a>';
|
82 |
|
83 |
$the_log = '';
|
93 |
|
94 |
}
|
95 |
|
96 |
+
/**
|
97 |
+
* get_settings.
|
98 |
+
*
|
99 |
+
* @version 2.2.3
|
100 |
+
*/
|
101 |
+
function get_settings() {
|
102 |
+
|
103 |
+
$settings = array(
|
104 |
+
|
105 |
+
array( 'title' => __( 'Admin Tools Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_admin_tools_module_options' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
array(
|
108 |
+
'title' => __( 'Logging', 'woocommerce-jetpack' ),
|
109 |
+
'desc' => __( 'Enable', 'woocommerce-jetpack' ),
|
110 |
+
'id' => 'wcj_logging_enabled',
|
111 |
+
'default' => 'no',
|
112 |
+
'type' => 'checkbox',
|
113 |
+
),
|
114 |
+
|
115 |
+
array(
|
116 |
+
'title' => __( 'Debug', 'woocommerce-jetpack' ),
|
117 |
+
'desc' => __( 'Enable', 'woocommerce-jetpack' ),
|
118 |
+
'id' => 'wcj_debuging_enabled',
|
119 |
+
'default' => 'no',
|
120 |
+
'type' => 'checkbox',
|
121 |
+
),
|
122 |
|
123 |
/*array(
|
124 |
+
'title' => __( 'Custom Shortcode', 'woocommerce-jetpack' ),
|
125 |
+
'id' => 'wcj_custom_shortcode_1',
|
126 |
+
'default' => '',
|
127 |
+
'type' => 'textarea',
|
128 |
+
),*/
|
129 |
+
|
130 |
+
array( 'type' => 'sectionend', 'id' => 'wcj_admin_tools_module_options' ),
|
131 |
+
);
|
132 |
+
|
133 |
+
$settings = $this->add_tools_list( $settings );
|
134 |
+
|
135 |
+
return $this->add_enable_module_setting( $settings );
|
136 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
}
|
138 |
|
139 |
endif;
|
includes/class-wcj-orders.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Orders class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -190,6 +190,10 @@ class WCJ_Orders extends WCJ_Module {
|
|
190 |
'id' => 'wcj_order_minimum_amount',
|
191 |
'default' => 0,
|
192 |
'type' => 'number',
|
|
|
|
|
|
|
|
|
193 |
),
|
194 |
|
195 |
array(
|
@@ -246,7 +250,7 @@ class WCJ_Orders extends WCJ_Module {
|
|
246 |
),
|
247 |
|
248 |
array( 'type' => 'sectionend', 'id' => 'wcj_order_auto_complete_options' ),
|
249 |
-
|
250 |
array(
|
251 |
'title' => __( 'Orders List Custom Columns', 'woocommerce-jetpack' ),
|
252 |
'type' => 'title',
|
@@ -265,7 +269,7 @@ class WCJ_Orders extends WCJ_Module {
|
|
265 |
array(
|
266 |
'type' => 'sectionend',
|
267 |
'id' => 'wcj_orders_list_custom_columns_options',
|
268 |
-
),
|
269 |
|
270 |
);
|
271 |
|
4 |
*
|
5 |
* The WooCommerce Jetpack Orders class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
190 |
'id' => 'wcj_order_minimum_amount',
|
191 |
'default' => 0,
|
192 |
'type' => 'number',
|
193 |
+
'custom_attributes' => array(
|
194 |
+
'step' => '0.0001',
|
195 |
+
'min' => '0',
|
196 |
+
),
|
197 |
),
|
198 |
|
199 |
array(
|
250 |
),
|
251 |
|
252 |
array( 'type' => 'sectionend', 'id' => 'wcj_order_auto_complete_options' ),
|
253 |
+
|
254 |
array(
|
255 |
'title' => __( 'Orders List Custom Columns', 'woocommerce-jetpack' ),
|
256 |
'type' => 'title',
|
269 |
array(
|
270 |
'type' => 'sectionend',
|
271 |
'id' => 'wcj_orders_list_custom_columns_options',
|
272 |
+
),
|
273 |
|
274 |
);
|
275 |
|
includes/class-wcj-payment-gateways-fees.php
ADDED
@@ -0,0 +1,265 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Jetpack Payment Gateways Fees
|
4 |
+
*
|
5 |
+
* The WooCommerce Jetpack Payment Gateways Fees class.
|
6 |
+
*
|
7 |
+
* @version 2.2.3
|
8 |
+
* @since 2.2.2
|
9 |
+
* @author Algoritmika Ltd.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
if ( ! class_exists( 'WCJ_Payment_Gateways_Fees' ) ) :
|
15 |
+
|
16 |
+
class WCJ_Payment_Gateways_Fees extends WCJ_Module {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Constructor.
|
20 |
+
*/
|
21 |
+
function __construct() {
|
22 |
+
|
23 |
+
$this->id = 'payment_gateways_fees';
|
24 |
+
$this->short_desc = __( 'Payment Gateways Fees', 'woocommerce-jetpack' );
|
25 |
+
$this->desc = __( 'Enable extra fees for WooCommerce payment gateways.', 'woocommerce-jetpack' );
|
26 |
+
parent::__construct();
|
27 |
+
|
28 |
+
add_filter( 'init', array( $this, 'add_hooks' ) );
|
29 |
+
|
30 |
+
if ( $this->is_enabled() ) {
|
31 |
+
add_action( 'woocommerce_cart_calculate_fees', array( $this, 'gateways_fees' ) );
|
32 |
+
add_action( 'wp_enqueue_scripts' , array( $this, 'enqueue_checkout_script' ) );
|
33 |
+
// add_filter( 'woocommerce_payment_gateways_settings', array( $this, 'add_fees_settings' ), 100 );
|
34 |
+
add_action( 'init', array( $this, 'register_script' ) );
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* get_settings.
|
40 |
+
*/
|
41 |
+
function get_settings() {
|
42 |
+
$settings = array();
|
43 |
+
//$settings = $this->add_fees_settings( $settings );
|
44 |
+
$settings = apply_filters( 'wcj_payment_gateways_fees_settings', $settings );
|
45 |
+
return $this->add_enable_module_setting( $settings );
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* add_hooks.
|
50 |
+
*/
|
51 |
+
function add_hooks() {
|
52 |
+
add_filter( 'wcj_payment_gateways_fees_settings', array( $this, 'add_fees_settings' ) );
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* register_script.
|
57 |
+
*/
|
58 |
+
public function register_script() {
|
59 |
+
wp_register_script( 'wcj-payment-gateways-checkout', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'js/checkout.js', array( 'jquery' ), false, true );
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* enqueue_checkout_script.
|
64 |
+
*/
|
65 |
+
public function enqueue_checkout_script() {
|
66 |
+
if( ! is_checkout() )
|
67 |
+
return;
|
68 |
+
wp_enqueue_script( 'wcj-payment-gateways-checkout' );
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* gateways_fees.
|
73 |
+
*
|
74 |
+
* @version 2.2.3
|
75 |
+
*/
|
76 |
+
function gateways_fees() {
|
77 |
+
global $woocommerce;
|
78 |
+
$current_gateway = $woocommerce->session->chosen_payment_method;
|
79 |
+
$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
|
80 |
+
if ( ! array_key_exists( $current_gateway, $available_gateways ) ) {
|
81 |
+
$current_gateway = get_option( 'woocommerce_default_gateway', '' );
|
82 |
+
if ( '' == $current_gateway ) {
|
83 |
+
$current_gateway = current( $available_gateways );
|
84 |
+
$current_gateway = isset( $current_gateway->id ) ? $current_gateway->id : '';
|
85 |
+
}
|
86 |
+
}
|
87 |
+
if ( '' != $current_gateway ) {
|
88 |
+
$fee_text = get_option( 'wcj_gateways_fees_text_' . $current_gateway );
|
89 |
+
$min_cart_amount = get_option( 'wcj_gateways_fees_min_cart_amount_' . $current_gateway );
|
90 |
+
$max_cart_amount = get_option( 'wcj_gateways_fees_max_cart_amount_' . $current_gateway );
|
91 |
+
$total_in_cart = $woocommerce->cart->cart_contents_total + $woocommerce->cart->shipping_total;
|
92 |
+
if ( '' != $fee_text && $total_in_cart >= $min_cart_amount && ( 0 == $max_cart_amount || $total_in_cart <= $max_cart_amount ) ) {
|
93 |
+
$fee_value = get_option( 'wcj_gateways_fees_value_' . $current_gateway );
|
94 |
+
$fee_type = apply_filters( 'wcj_get_option_filter', 'fixed', get_option( 'wcj_gateways_fees_type_' . $current_gateway ) );
|
95 |
+
$final_fee_to_add = 0;
|
96 |
+
switch ( $fee_type ) {
|
97 |
+
case 'fixed':
|
98 |
+
$final_fee_to_add = $fee_value;
|
99 |
+
break;
|
100 |
+
case 'percent':
|
101 |
+
$final_fee_to_add = ( $fee_value / 100 ) * $total_in_cart;
|
102 |
+
if ( 'yes' === get_option( 'wcj_gateways_fees_round_' . $current_gateway ) ) {
|
103 |
+
$final_fee_to_add = round( $final_fee_to_add, get_option( 'wcj_gateways_fees_round_precision_' . $current_gateway ) );
|
104 |
+
}
|
105 |
+
break;
|
106 |
+
}
|
107 |
+
if ( '' != $fee_text && 0 != $final_fee_to_add ) {
|
108 |
+
$taxable = ( 'yes' === get_option( 'wcj_gateways_fees_is_taxable_' . $current_gateway ) ) ? true : false;
|
109 |
+
$tax_class_name = '';
|
110 |
+
if ( $taxable ) {
|
111 |
+
$tax_class_id = apply_filters( 'wcj_get_option_filter', 0, get_option( 'wcj_gateways_fees_tax_class_id_' . $current_gateway, 0 ) );
|
112 |
+
$tax_class_names = array_merge( array( '', ), WC_Tax::get_tax_classes() );
|
113 |
+
$tax_class_name = $tax_class_names[ $tax_class_id ];
|
114 |
+
}
|
115 |
+
$woocommerce->cart->add_fee( $fee_text, $final_fee_to_add, $taxable, $tax_class_name );
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* add_fees_settings.
|
123 |
+
*/
|
124 |
+
function add_fees_settings( $settings ) {
|
125 |
+
// Gateway's Extra Fees
|
126 |
+
$settings[] = array(
|
127 |
+
'title' => __( 'Payment Gateways Fees Options', 'woocommerce-jetpack' ),
|
128 |
+
'type' => 'title',
|
129 |
+
'desc' => __( 'This section lets you set extra fees for payment gateways.', 'woocommerce-jetpack' ),
|
130 |
+
// __( 'Fees are applied BEFORE taxes.', 'woocommerce-jetpack' ),
|
131 |
+
'id' => 'wcj_payment_gateways_fees_options' );
|
132 |
+
|
133 |
+
//$available_gateways = WC()->payment_gateways->payment_gateways();
|
134 |
+
global $woocommerce;
|
135 |
+
$available_gateways = $woocommerce->payment_gateways->payment_gateways();
|
136 |
+
//$available_gateways = WC()->payment_gateways();
|
137 |
+
foreach ( $available_gateways as $key => $gateway ) {
|
138 |
+
/*echo '<h5>' . $gateway->title . '</h5>';
|
139 |
+
if ( $gateway->is_available() )
|
140 |
+
echo '<strong style="color: green;">' . __( 'Available', 'woocommerce-jetpack' ) . '</strong>';
|
141 |
+
else
|
142 |
+
echo '<strong style="color: red;">' . __( 'Not available', 'woocommerce-jetpack' ) . '</strong>';*/
|
143 |
+
|
144 |
+
$settings = array_merge( $settings, array(
|
145 |
+
|
146 |
+
array(
|
147 |
+
'title' => $gateway->title,
|
148 |
+
'desc' => __( 'Fee title to show to customer.', 'woocommerce-jetpack' ),
|
149 |
+
'desc_tip' => __( 'Leave blank to disable.', 'woocommerce-jetpack' ),
|
150 |
+
'id' => 'wcj_gateways_fees_text_' . $key,
|
151 |
+
'default' => '',
|
152 |
+
'type' => 'text',
|
153 |
+
),
|
154 |
+
|
155 |
+
array(
|
156 |
+
'title' => '',
|
157 |
+
'desc' => __( 'Fee type.', 'woocommerce-jetpack' ),
|
158 |
+
'desc_tip' => __( 'Percent or fixed value.', 'woocommerce-jetpack' ) . ' ' . apply_filters( 'get_wc_jetpack_plus_message', '', 'desc_no_link' ),
|
159 |
+
'custom_attributes'
|
160 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
161 |
+
'id' => 'wcj_gateways_fees_type_' . $key,
|
162 |
+
'default' => 'fixed',
|
163 |
+
'type' => 'select',
|
164 |
+
'options' => array(
|
165 |
+
'fixed' => __( 'Fixed', 'woocommerce-jetpack' ),
|
166 |
+
'percent' => __( 'Percent', 'woocommerce-jetpack' ),
|
167 |
+
),
|
168 |
+
),
|
169 |
+
|
170 |
+
array(
|
171 |
+
'title' => '',
|
172 |
+
'desc' => __( 'Fee value.', 'woocommerce-jetpack' ),
|
173 |
+
'desc_tip' => __( 'The value.', 'woocommerce-jetpack' ),
|
174 |
+
'id' => 'wcj_gateways_fees_value_' . $key,
|
175 |
+
'default' => 0,
|
176 |
+
'type' => 'number',
|
177 |
+
'custom_attributes' => array(
|
178 |
+
'step' => '0.01',
|
179 |
+
'min' => '0',
|
180 |
+
),
|
181 |
+
),
|
182 |
+
|
183 |
+
array(
|
184 |
+
'title' => '',
|
185 |
+
'desc' => __( 'Minimum cart amount for adding the fee.', 'woocommerce-jetpack' ),
|
186 |
+
'desc_tip' => __( 'Set 0 to disable.', 'woocommerce-jetpack' ),
|
187 |
+
'id' => 'wcj_gateways_fees_min_cart_amount_' . $key,
|
188 |
+
'default' => 0,
|
189 |
+
'type' => 'number',
|
190 |
+
'custom_attributes' => array(
|
191 |
+
'step' => '0.01',
|
192 |
+
'min' => '0',
|
193 |
+
),
|
194 |
+
),
|
195 |
+
|
196 |
+
array(
|
197 |
+
'title' => '',
|
198 |
+
'desc' => __( 'Maximum cart amount for adding the fee.', 'woocommerce-jetpack' ),
|
199 |
+
'desc_tip' => __( 'Set 0 to disable.', 'woocommerce-jetpack' ),
|
200 |
+
'id' => 'wcj_gateways_fees_max_cart_amount_' . $key,
|
201 |
+
'default' => 0,
|
202 |
+
'type' => 'number',
|
203 |
+
'custom_attributes' => array(
|
204 |
+
'step' => '0.01',
|
205 |
+
'min' => '0',
|
206 |
+
),
|
207 |
+
),
|
208 |
+
|
209 |
+
array(
|
210 |
+
'title' => '',
|
211 |
+
'desc' => __( 'Round the fee value before adding to the cart.', 'woocommerce-jetpack' ),
|
212 |
+
//'desc_tip' => __( 'Set 0 to disable.', 'woocommerce-jetpack' ),
|
213 |
+
'id' => 'wcj_gateways_fees_round_' . $key,
|
214 |
+
'default' => 'no',
|
215 |
+
'type' => 'checkbox',
|
216 |
+
),
|
217 |
+
|
218 |
+
array(
|
219 |
+
'title' => '',
|
220 |
+
'desc' => __( 'If rounding is enabled, set precision here.', 'woocommerce-jetpack' ),
|
221 |
+
//'desc_tip' => __( 'Set 0 to disable.', 'woocommerce-jetpack' ),
|
222 |
+
'id' => 'wcj_gateways_fees_round_precision_' . $key,
|
223 |
+
'default' => 0,
|
224 |
+
'type' => 'number',
|
225 |
+
'custom_attributes' => array(
|
226 |
+
'step' => '1',
|
227 |
+
'min' => '0',
|
228 |
+
),
|
229 |
+
),
|
230 |
+
|
231 |
+
array(
|
232 |
+
'title' => '',
|
233 |
+
'desc' => __( 'Is taxable?', 'woocommerce-jetpack' ),
|
234 |
+
/* 'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ), */
|
235 |
+
'id' => 'wcj_gateways_fees_is_taxable_' . $key,
|
236 |
+
'default' => 'no',
|
237 |
+
'type' => 'checkbox',
|
238 |
+
/* 'custom_attributes'
|
239 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ), */
|
240 |
+
),
|
241 |
+
|
242 |
+
array(
|
243 |
+
'title' => '',
|
244 |
+
'desc' => __( 'Tax Class (only if Taxable selected).', 'woocommerce-jetpack' ),
|
245 |
+
'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc_no_link' ),
|
246 |
+
'id' => 'wcj_gateways_fees_tax_class_id_' . $key,
|
247 |
+
'default' => '',
|
248 |
+
'type' => 'select',
|
249 |
+
'options' => array_merge( array( __( 'Standard Rate', 'woocommerce-jetpack' ) ), WC_Tax::get_tax_classes() ),
|
250 |
+
'custom_attributes'
|
251 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
252 |
+
),
|
253 |
+
|
254 |
+
) );
|
255 |
+
}
|
256 |
+
|
257 |
+
$settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_payment_gateways_fees_options' );
|
258 |
+
|
259 |
+
return $settings;
|
260 |
+
}
|
261 |
+
}
|
262 |
+
|
263 |
+
endif;
|
264 |
+
|
265 |
+
return new WCJ_Payment_Gateways_Fees();
|
includes/class-wcj-payment-gateways-icons.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Jetpack Payment Gateways Icons
|
4 |
+
*
|
5 |
+
* The WooCommerce Jetpack Payment Gateways Icons class.
|
6 |
+
*
|
7 |
+
* @version 2.2.2
|
8 |
+
* @since 2.2.2
|
9 |
+
* @author Algoritmika Ltd.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
if ( ! class_exists( 'WCJ_Payment_Gateways_Icons' ) ) :
|
15 |
+
|
16 |
+
class WCJ_Payment_Gateways_Icons extends WCJ_Module {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Constructor.
|
20 |
+
*/
|
21 |
+
function __construct() {
|
22 |
+
|
23 |
+
$this->id = 'payment_gateways_icons';
|
24 |
+
$this->short_desc = __( 'Payment Gateways Icons', 'woocommerce-jetpack' );
|
25 |
+
$this->desc = __( 'Change icons (images) for all default WooCommerce payment gateways.', 'woocommerce-jetpack' );
|
26 |
+
parent::__construct();
|
27 |
+
|
28 |
+
if ( $this->is_enabled() ) {
|
29 |
+
$woocommerce_icon_filters = $this->get_woocommerce_icon_filters();
|
30 |
+
foreach ( $woocommerce_icon_filters as $filter_name => $filter_title ) {
|
31 |
+
add_filter( $filter_name, array( $this, 'set_icon' ) );
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* get_woocommerce_icon_filters
|
38 |
+
*/
|
39 |
+
function get_woocommerce_icon_filters() {
|
40 |
+
return array(
|
41 |
+
'woocommerce_cod_icon' => 'COD',
|
42 |
+
'woocommerce_cheque_icon' => 'Cheque',
|
43 |
+
'woocommerce_bacs_icon' => 'BACS',
|
44 |
+
'woocommerce_mijireh_checkout_icon' => 'Mijireh Checkout', //depreciated?
|
45 |
+
'woocommerce_paypal_icon' => 'PayPal',
|
46 |
+
// 'woocommerce_wcj_custom_icon' => 'WooJetpack Custom',
|
47 |
+
);
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* set_icon
|
52 |
+
*/
|
53 |
+
function set_icon( $value ) {
|
54 |
+
$icon_url = get_option( 'wcj_payment_gateways_icons_' . current_filter(), '' );
|
55 |
+
if ( '' === $icon_url ) {
|
56 |
+
return $value;
|
57 |
+
}
|
58 |
+
return $icon_url;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* get_settings.
|
63 |
+
*/
|
64 |
+
function get_settings() {
|
65 |
+
|
66 |
+
$settings = array();
|
67 |
+
|
68 |
+
$settings[] = array(
|
69 |
+
'title' => __( 'Default WooCommerce Payment Gateways Icons', 'woocommerce-jetpack' ),
|
70 |
+
'type' => 'title',
|
71 |
+
'desc' => __( 'If you want to show an image next to the gateway\'s name on the frontend, enter a URL to an image.', 'woocommerce-jetpack' ),
|
72 |
+
'id' => 'wcj_payment_gateways_icons_options'
|
73 |
+
);
|
74 |
+
|
75 |
+
$woocommerce_icon_filters = $this->get_woocommerce_icon_filters();
|
76 |
+
foreach ( $woocommerce_icon_filters as $filter_name => $filter_title ) {
|
77 |
+
|
78 |
+
$desc = '';
|
79 |
+
$icon_url = apply_filters( $filter_name, '' );
|
80 |
+
if ( '' != $icon_url )
|
81 |
+
$desc = '<img src="' . $icon_url . '" alt="' . $filter_title . '" title="' . $filter_title . '" />';
|
82 |
+
// $desc = __( 'Current Icon: ', 'woocommerce-jetpack' ) . '<img src="' . $icon_url . '" alt="' . $filter_title . '" title="' . $filter_title . '" />';
|
83 |
+
|
84 |
+
$settings[] = array(
|
85 |
+
'title' => $filter_title,
|
86 |
+
// 'title' => sprintf( __( 'Icon for %s payment gateway', 'woocommerce-jetpack' ), $filter_title ),
|
87 |
+
'desc' => $desc,
|
88 |
+
// 'desc_tip' => $filter_name,
|
89 |
+
'id' => 'wcj_payment_gateways_icons_' . $filter_name,
|
90 |
+
'default' => '',
|
91 |
+
'type' => 'text',
|
92 |
+
'css' => 'min-width:300px;width:50%;',
|
93 |
+
);
|
94 |
+
}
|
95 |
+
|
96 |
+
$settings[] = array(
|
97 |
+
'type' => 'sectionend',
|
98 |
+
'id' => 'wcj_payment_gateways_icons_options'
|
99 |
+
);
|
100 |
+
|
101 |
+
return $this->add_enable_module_setting( $settings );
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
endif;
|
106 |
+
|
107 |
+
return new WCJ_Payment_Gateways_Icons();
|
includes/{gateways/class-wcj-payment-gateways-per-category.php → class-wcj-payment-gateways-per-category.php}
RENAMED
@@ -4,9 +4,8 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Payment Gateways per Category class.
|
6 |
*
|
7 |
-
* @
|
8 |
* @since 2.2.0
|
9 |
-
* @version 2.2.0
|
10 |
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
|
@@ -14,27 +13,42 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
14 |
|
15 |
if ( ! class_exists( 'WCJ_Payment_Gateways_Per_Category' ) ) :
|
16 |
|
17 |
-
class WCJ_Payment_Gateways_Per_Category {
|
18 |
|
19 |
/**
|
20 |
* Constructor.
|
21 |
*/
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
add_filter( 'init', array( $this, 'add_hooks' ) );
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
add_filter( 'woocommerce_payment_gateways_settings', array( $this, 'add_per_category_settings' ), 100 );
|
29 |
add_filter( 'woocommerce_available_payment_gateways', array( $this, 'filter_available_payment_gateways_per_category' ), 100 );
|
30 |
}
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
/**
|
34 |
* add_hooks.
|
35 |
*/
|
36 |
function add_hooks() {
|
37 |
-
add_filter( '
|
38 |
}
|
39 |
|
40 |
/**
|
4 |
*
|
5 |
* The WooCommerce Jetpack Payment Gateways per Category class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
* @since 2.2.0
|
|
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
11 |
|
13 |
|
14 |
if ( ! class_exists( 'WCJ_Payment_Gateways_Per_Category' ) ) :
|
15 |
|
16 |
+
class WCJ_Payment_Gateways_Per_Category extends WCJ_Module {
|
17 |
|
18 |
/**
|
19 |
* Constructor.
|
20 |
*/
|
21 |
+
function __construct() {
|
22 |
+
|
23 |
+
$this->id = 'payment_gateways_per_category';
|
24 |
+
$this->short_desc = __( 'Payment Gateways per Category', 'woocommerce-jetpack' );
|
25 |
+
$this->desc = __( 'Show gateway only if there is product of selected category in WooCommerce cart.', 'woocommerce-jetpack' );
|
26 |
+
parent::__construct();
|
27 |
|
28 |
add_filter( 'init', array( $this, 'add_hooks' ) );
|
29 |
|
30 |
+
if ( $this->is_enabled() ) {
|
31 |
+
//add_filter( 'woocommerce_payment_gateways_settings', array( $this, 'add_per_category_settings' ), 100 );
|
|
|
32 |
add_filter( 'woocommerce_available_payment_gateways', array( $this, 'filter_available_payment_gateways_per_category' ), 100 );
|
33 |
}
|
34 |
}
|
35 |
|
36 |
+
/**
|
37 |
+
* get_settings.
|
38 |
+
*/
|
39 |
+
function get_settings() {
|
40 |
+
$settings = array();
|
41 |
+
|
42 |
+
$settings = apply_filters( 'wcj_payment_gateways_per_category_settings', $settings );
|
43 |
+
|
44 |
+
return $this->add_enable_module_setting( $settings );
|
45 |
+
}
|
46 |
+
|
47 |
/**
|
48 |
* add_hooks.
|
49 |
*/
|
50 |
function add_hooks() {
|
51 |
+
add_filter( 'wcj_payment_gateways_per_category_settings', array( $this, 'add_per_category_settings' ) );
|
52 |
}
|
53 |
|
54 |
/**
|
includes/class-wcj-payment-gateways.php
CHANGED
@@ -4,8 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Payment Gateways class.
|
6 |
*
|
7 |
-
* @
|
8 |
-
* @version 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
11 |
|
@@ -13,435 +12,51 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
13 |
|
14 |
if ( ! class_exists( 'WCJ_Payment_Gateways' ) ) :
|
15 |
|
16 |
-
class WCJ_Payment_Gateways {
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
26 |
|
27 |
-
|
28 |
-
* Constructor.
|
29 |
-
*/
|
30 |
-
public function __construct() {
|
31 |
-
if ( get_option( 'wcj_payment_gateways_enabled' ) == 'yes' ) {
|
32 |
// Include custom payment gateway
|
33 |
include_once( 'gateways/class-wc-gateway-wcj-custom.php' );
|
34 |
-
|
35 |
-
// Main hooks
|
36 |
-
// Icons for default WooCommerce methods hooks
|
37 |
-
/*$this->woocommerce_icon_filters = array (
|
38 |
-
'woocommerce_cod_icon' => __( 'COD', 'woocommerce-jetpack' ),
|
39 |
-
'woocommerce_cheque_icon' => __( 'Cheque', 'woocommerce-jetpack' ),
|
40 |
-
'woocommerce_bacs_icon' => __( 'BACS', 'woocommerce-jetpack' ),
|
41 |
-
'woocommerce_mijireh_checkout_icon' => __( 'Mijireh Checkout', 'woocommerce-jetpack' ),
|
42 |
-
'woocommerce_paypal_icon' => __( 'PayPal', 'woocommerce-jetpack' ),
|
43 |
-
//'woocommerce_wcj_custom_icon' => __( 'WooJetpack Custom', 'woocommerce-jetpack' ),
|
44 |
-
);*/
|
45 |
-
foreach ( $this->woocommerce_icon_filters as $filter_name => $filter_title )
|
46 |
-
add_filter( $filter_name, array( $this, 'set_icon' ) );
|
47 |
-
|
48 |
-
// Settings
|
49 |
-
add_filter( 'woocommerce_payment_gateways_settings', array( $this, 'add_woocommerce_icons_options' ), 100 );
|
50 |
-
|
51 |
-
// PDF Invoices
|
52 |
-
if ( 'yes' === get_option( 'wcj_pdf_invoices_enabled' ) && 'yes' === get_option( 'wcj_pdf_invoices_attach_to_email_enabled' ) )
|
53 |
-
add_filter( 'woocommerce_payment_gateways_settings', array( $this, 'add_attach_invoice_settings' ), 100 );
|
54 |
-
|
55 |
-
// Payment Gateways Fees
|
56 |
-
if ( 'yes' === get_option( 'wcj_payment_gateways_fees_enabled' ) ) {
|
57 |
-
// Main Hooks
|
58 |
-
add_action( 'woocommerce_cart_calculate_fees', array( $this, 'gateways_fees' ) );
|
59 |
-
add_action( 'wp_enqueue_scripts' , array( $this, 'enqueue_checkout_script' ) );
|
60 |
-
// Settings Hooks
|
61 |
-
add_filter( 'woocommerce_payment_gateways_settings', array( $this, 'add_fees_settings' ), 100 );
|
62 |
-
// Scripts
|
63 |
-
add_action( 'init', array( $this, 'register_script' ) );
|
64 |
-
}
|
65 |
-
|
66 |
-
include_once( 'gateways/class-wcj-payment-gateways-per-category.php' );
|
67 |
-
}
|
68 |
-
|
69 |
-
// Settings hooks
|
70 |
-
add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
|
71 |
-
add_filter( 'wcj_settings_payment_gateways', array( $this, 'get_settings' ), 100 );
|
72 |
-
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* register_script.
|
77 |
-
*/
|
78 |
-
public function register_script() {
|
79 |
-
wp_register_script( 'wcj-payment-gateways-checkout', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'js/checkout.js', array( 'jquery' ), false, true );
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* enqueue_checkout_script.
|
84 |
-
*/
|
85 |
-
public function enqueue_checkout_script() {
|
86 |
-
if( ! is_checkout() )
|
87 |
-
return;
|
88 |
-
wp_enqueue_script( 'wcj-payment-gateways-checkout' );
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* gateways_fees.
|
93 |
-
*/
|
94 |
-
function gateways_fees() {
|
95 |
-
|
96 |
-
global $woocommerce;
|
97 |
-
|
98 |
-
//if ( is_admin() && ! defined( 'DOING_AJAX' ) )
|
99 |
-
// return;
|
100 |
-
|
101 |
-
$current_gateway = $woocommerce->session->chosen_payment_method;
|
102 |
-
if ( '' != $current_gateway ) {
|
103 |
-
$fee_text = get_option( 'wcj_gateways_fees_text_' . $current_gateway );
|
104 |
-
$min_cart_amount = get_option( 'wcj_gateways_fees_min_cart_amount_' . $current_gateway );
|
105 |
-
$max_cart_amount = get_option( 'wcj_gateways_fees_max_cart_amount_' . $current_gateway );
|
106 |
-
// Fees are applied BEFORE taxes
|
107 |
-
$total_in_cart = $woocommerce->cart->cart_contents_total + $woocommerce->cart->shipping_total;
|
108 |
-
if ( '' != $fee_text && $total_in_cart >= $min_cart_amount && ( 0 == $max_cart_amount || $total_in_cart <= $max_cart_amount ) ) {
|
109 |
-
$fee_value = get_option( 'wcj_gateways_fees_value_' . $current_gateway );
|
110 |
-
$fee_type = apply_filters( 'wcj_get_option_filter', 'fixed', get_option( 'wcj_gateways_fees_type_' . $current_gateway ) );
|
111 |
-
$final_fee_to_add = 0;
|
112 |
-
switch ( $fee_type ) {
|
113 |
-
case 'fixed': $final_fee_to_add = $fee_value; break;
|
114 |
-
case 'percent':
|
115 |
-
$final_fee_to_add = ( $fee_value / 100 ) * $total_in_cart;
|
116 |
-
if ( 'yes' === get_option( 'wcj_gateways_fees_round_' . $current_gateway ) ) {
|
117 |
-
$final_fee_to_add = round( $final_fee_to_add, get_option( 'wcj_gateways_fees_round_precision_' . $current_gateway ) );
|
118 |
-
}
|
119 |
-
break;
|
120 |
-
}
|
121 |
-
if ( '' != $fee_text && 0 != $final_fee_to_add ) {
|
122 |
-
$woocommerce->cart->add_fee( $fee_text, $final_fee_to_add );//, true );//, 'standard' );
|
123 |
-
}
|
124 |
-
}
|
125 |
}
|
126 |
}
|
127 |
|
128 |
-
/**
|
129 |
-
* add_woocommerce_icons_options.
|
130 |
-
*/
|
131 |
-
function add_woocommerce_icons_options( $settings ) {
|
132 |
-
|
133 |
-
$settings[] = array( 'title' => __( 'WooCommerce Jetpack: Default WooCommerce Payment Gateways Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'If you want to show an image next to the gateway\'s name on the frontend, enter a URL to an image.', 'woocommerce-jetpack' ), 'id' => 'wcj_payment_gateways_icons_options' );
|
134 |
-
|
135 |
-
foreach ( $this->woocommerce_icon_filters as $filter_name => $filter_title ) {
|
136 |
-
// Prepare current value
|
137 |
-
$desc = '';
|
138 |
-
$icon_url = apply_filters( $filter_name, '' );
|
139 |
-
if ( '' != $icon_url )
|
140 |
-
$desc = '<img src="' . $icon_url . '" alt="' . $filter_title . '" title="' . $filter_title . '" />';
|
141 |
-
//$desc = __( 'Current Icon: ', 'woocommerce-jetpack' ) . '<img src="' . $icon_url . '" alt="' . $filter_title . '" title="' . $filter_title . '" />';
|
142 |
-
|
143 |
-
$settings[] = array(
|
144 |
-
'title' => $filter_title,
|
145 |
-
//'title' => sprintf( __( 'Icon for %s payment gateway', 'woocommerce-jetpack' ), $filter_title ),
|
146 |
-
'desc' => $desc,
|
147 |
-
//'desc_tip' => $filter_name,
|
148 |
-
'id' => 'wcj_payment_gateways_icons_' . $filter_name,
|
149 |
-
'default' => '',
|
150 |
-
'type' => 'text',
|
151 |
-
'css' => 'min-width:300px;width:50%;',
|
152 |
-
);
|
153 |
-
}
|
154 |
-
|
155 |
-
$settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_payment_gateways_icons_options' );
|
156 |
-
|
157 |
-
return $settings;
|
158 |
-
}
|
159 |
-
|
160 |
-
/**
|
161 |
-
* add_fees_settings.
|
162 |
-
*/
|
163 |
-
function add_fees_settings( $settings ) {
|
164 |
-
// Gateway's Extra Fees
|
165 |
-
$settings[] = array(
|
166 |
-
'title' => __( 'Payment Gateways Fees Options', 'woocommerce-jetpack' ),
|
167 |
-
'type' => 'title',
|
168 |
-
'desc' => __( 'This section lets you set extra fees for payment gateways.', 'woocommerce-jetpack' ) . ' ' .
|
169 |
-
__( 'Fees are applied BEFORE taxes.', 'woocommerce-jetpack' ),
|
170 |
-
'id' => 'wcj_payment_gateways_fees_options' );
|
171 |
-
|
172 |
-
//$available_gateways = WC()->payment_gateways->payment_gateways();
|
173 |
-
global $woocommerce;
|
174 |
-
$available_gateways = $woocommerce->payment_gateways->payment_gateways();
|
175 |
-
foreach ( $available_gateways as $key => $gateway ) {
|
176 |
-
/*echo '<h5>' . $gateway->title . '</h5>';
|
177 |
-
if ( $gateway->is_available() )
|
178 |
-
echo '<strong style="color: green;">' . __( 'Available', 'woocommerce-jetpack' ) . '</strong>';
|
179 |
-
else
|
180 |
-
echo '<strong style="color: red;">' . __( 'Not available', 'woocommerce-jetpack' ) . '</strong>';*/
|
181 |
-
|
182 |
-
$settings = array_merge( $settings, array(
|
183 |
-
|
184 |
-
array(
|
185 |
-
'title' => $gateway->title,
|
186 |
-
'desc' => __( 'Fee title to show to customer.', 'woocommerce-jetpack' ),
|
187 |
-
'desc_tip' => __( 'Leave blank to disable.', 'woocommerce-jetpack' ),
|
188 |
-
'id' => 'wcj_gateways_fees_text_' . $key,
|
189 |
-
'default' => '',
|
190 |
-
'type' => 'text',
|
191 |
-
),
|
192 |
-
|
193 |
-
array(
|
194 |
-
'title' => '',
|
195 |
-
'desc' => __( 'Fee type.', 'woocommerce-jetpack' ),
|
196 |
-
'desc_tip' => __( 'Percent or fixed value.', 'woocommerce-jetpack' ) . ' ' . apply_filters( 'get_wc_jetpack_plus_message', '', 'desc_no_link' ),
|
197 |
-
'custom_attributes'
|
198 |
-
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
199 |
-
'id' => 'wcj_gateways_fees_type_' . $key,
|
200 |
-
'default' => 'fixed',
|
201 |
-
'type' => 'select',
|
202 |
-
'options' => array(
|
203 |
-
'fixed' => __( 'Fixed', 'woocommerce-jetpack' ),
|
204 |
-
'percent' => __( 'Percent', 'woocommerce-jetpack' ),
|
205 |
-
),
|
206 |
-
),
|
207 |
-
|
208 |
-
array(
|
209 |
-
'title' => '',
|
210 |
-
'desc' => __( 'Fee value.', 'woocommerce-jetpack' ),
|
211 |
-
'desc_tip' => __( 'The value.', 'woocommerce-jetpack' ),
|
212 |
-
'id' => 'wcj_gateways_fees_value_' . $key,
|
213 |
-
'default' => 0,
|
214 |
-
'type' => 'number',
|
215 |
-
'custom_attributes' => array(
|
216 |
-
'step' => '0.01',
|
217 |
-
'min' => '0',
|
218 |
-
),
|
219 |
-
),
|
220 |
-
|
221 |
-
array(
|
222 |
-
'title' => '',
|
223 |
-
'desc' => __( 'Minimum cart amount for adding the fee.', 'woocommerce-jetpack' ),
|
224 |
-
'desc_tip' => __( 'Set 0 to disable.', 'woocommerce-jetpack' ),
|
225 |
-
'id' => 'wcj_gateways_fees_min_cart_amount_' . $key,
|
226 |
-
'default' => 0,
|
227 |
-
'type' => 'number',
|
228 |
-
'custom_attributes' => array(
|
229 |
-
'step' => '0.01',
|
230 |
-
'min' => '0',
|
231 |
-
),
|
232 |
-
),
|
233 |
-
|
234 |
-
array(
|
235 |
-
'title' => '',
|
236 |
-
'desc' => __( 'Maximum cart amount for adding the fee.', 'woocommerce-jetpack' ),
|
237 |
-
'desc_tip' => __( 'Set 0 to disable.', 'woocommerce-jetpack' ),
|
238 |
-
'id' => 'wcj_gateways_fees_max_cart_amount_' . $key,
|
239 |
-
'default' => 0,
|
240 |
-
'type' => 'number',
|
241 |
-
'custom_attributes' => array(
|
242 |
-
'step' => '0.01',
|
243 |
-
'min' => '0',
|
244 |
-
),
|
245 |
-
),
|
246 |
-
|
247 |
-
array(
|
248 |
-
'title' => '',
|
249 |
-
'desc' => __( 'Round the fee value before adding to the cart.', 'woocommerce-jetpack' ),
|
250 |
-
//'desc_tip' => __( 'Set 0 to disable.', 'woocommerce-jetpack' ),
|
251 |
-
'id' => 'wcj_gateways_fees_round_' . $key,
|
252 |
-
'default' => 'no',
|
253 |
-
'type' => 'checkbox',
|
254 |
-
),
|
255 |
-
|
256 |
-
array(
|
257 |
-
'title' => '',
|
258 |
-
'desc' => __( 'If rounding is enabled, set precision here.', 'woocommerce-jetpack' ),
|
259 |
-
//'desc_tip' => __( 'Set 0 to disable.', 'woocommerce-jetpack' ),
|
260 |
-
'id' => 'wcj_gateways_fees_round_precision_' . $key,
|
261 |
-
'default' => 0,
|
262 |
-
'type' => 'number',
|
263 |
-
'custom_attributes' => array(
|
264 |
-
'step' => '1',
|
265 |
-
'min' => '0',
|
266 |
-
),
|
267 |
-
),
|
268 |
-
|
269 |
-
/*array(
|
270 |
-
'title' => '',
|
271 |
-
'desc' => __( 'Taxes.', 'woocommerce-jetpack' ),
|
272 |
-
//'desc_tip' => __( 'Percent or fixed value.', 'woocommerce-jetpack' ),
|
273 |
-
'id' => 'wcj_gateways_fees_tax_' . $key,
|
274 |
-
'default' => ,
|
275 |
-
'type' => 'select',
|
276 |
-
'options' => array(
|
277 |
-
|
278 |
-
),
|
279 |
-
),*/
|
280 |
-
|
281 |
-
) );
|
282 |
-
}
|
283 |
-
|
284 |
-
$settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_payment_gateways_fees_options' );
|
285 |
-
|
286 |
-
return $settings;
|
287 |
-
}
|
288 |
-
|
289 |
-
/**
|
290 |
-
* add_attach_invoice_settings.
|
291 |
-
*/
|
292 |
-
function add_attach_invoice_settings( $settings ) {
|
293 |
-
$settings[] = array( 'title' => __( 'Payment Gateways Attach PDF Invoice Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you choose when to attach PDF invoice to customers emails.', 'woocommerce-jetpack' ), 'id' => 'wcj_gateways_attach_invoice_options' );
|
294 |
-
global $woocommerce;
|
295 |
-
$available_gateways = $woocommerce->payment_gateways->payment_gateways();
|
296 |
-
foreach ( $available_gateways as $key => $gateway ) {
|
297 |
-
|
298 |
-
$settings = array_merge( $settings, array(
|
299 |
-
|
300 |
-
array(
|
301 |
-
'title' => $gateway->title,
|
302 |
-
//'desc' => __( 'Attach PDF invoice to customers emails.', 'woocommerce-jetpack' ),
|
303 |
-
'desc' => __( 'Attach PDF invoice.', 'woocommerce-jetpack' ),
|
304 |
-
'id' => 'wcj_gateways_attach_invoice_' . $key,
|
305 |
-
'default' => 'yes',
|
306 |
-
'type' => 'checkbox',
|
307 |
-
),
|
308 |
-
|
309 |
-
|
310 |
-
) );
|
311 |
-
}
|
312 |
-
|
313 |
-
$settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_gateways_attach_invoice_options' );
|
314 |
-
|
315 |
-
return $settings;
|
316 |
-
}
|
317 |
-
|
318 |
-
/**
|
319 |
-
* add_enabled_option.
|
320 |
-
*/
|
321 |
-
public function add_enabled_option( $settings ) {
|
322 |
-
|
323 |
-
$all_settings = $this->get_settings();
|
324 |
-
$settings[] = $all_settings[1];
|
325 |
-
|
326 |
-
return $settings;
|
327 |
-
}
|
328 |
-
|
329 |
/**
|
330 |
-
*
|
331 |
*/
|
332 |
-
|
333 |
-
$icon_url = get_option( 'wcj_payment_gateways_icons_' . current_filter(), '' );
|
334 |
-
if ( $icon_url === '' )
|
335 |
-
return $value;
|
336 |
-
return $icon_url;
|
337 |
-
}
|
338 |
-
|
339 |
-
/**
|
340 |
-
* get_settings.
|
341 |
-
*/
|
342 |
-
function get_settings() {
|
343 |
-
|
344 |
-
$settings = array(
|
345 |
-
|
346 |
-
array( 'title' => __( 'Payment Gateways Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( '', 'woocommerce-jetpack' ), 'id' => 'wcj_payment_gateways_options' ),
|
347 |
-
|
348 |
-
array(
|
349 |
-
'title' => __( 'Payment Gateways', 'woocommerce-jetpack' ),
|
350 |
-
'desc' => '<strong>' . __( 'Enable Module', 'woocommerce-jetpack' ) . '</strong>',
|
351 |
-
'desc_tip' => __( 'Add custom payment gateway, change icons (images) for all default WooCommerce payment gateways.', 'woocommerce-jetpack' ),
|
352 |
-
'id' => 'wcj_payment_gateways_enabled',
|
353 |
-
'default' => 'no',
|
354 |
-
'type' => 'checkbox',
|
355 |
-
),
|
356 |
|
357 |
-
|
358 |
|
359 |
-
|
360 |
-
|
361 |
-
array(
|
362 |
-
'title' => __( 'Number of Gateways', 'woocommerce-jetpack' ),
|
363 |
-
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
364 |
-
'desc_tip' => __( 'Number of custom payments gateways to be added. All settings for each new gateway are in WooCommerce > Settings > Checkout.', 'woocommerce-jetpack' ),
|
365 |
-
'id' => 'wcj_custom_payment_gateways_number',
|
366 |
-
'default' => 1,
|
367 |
-
'type' => 'number',
|
368 |
-
'custom_attributes' => array(
|
369 |
-
'min' => 1,
|
370 |
-
'step' => 1,
|
371 |
-
'max' => apply_filters( 'wcj_get_option_filter', 1, 10 ),
|
372 |
-
)
|
373 |
-
),
|
374 |
-
|
375 |
-
array( 'type' => 'sectionend', 'id' => 'wcj_custom_payment_gateways_options' ),
|
376 |
-
);
|
377 |
-
|
378 |
-
$settings[] = array( 'title' => __( 'Default WooCommerce Payment Gateways Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'If you want to show an image next to the gateway\'s name on the frontend, enter a URL to an image.', 'woocommerce-jetpack' ), 'id' => 'wcj_payment_gateways_icons_options' );
|
379 |
-
|
380 |
-
foreach ( $this->woocommerce_icon_filters as $filter_name => $filter_title ) {
|
381 |
-
// Prepare current value
|
382 |
-
$desc = '';
|
383 |
-
$icon_url = apply_filters( $filter_name, '' );
|
384 |
-
if ( '' != $icon_url )
|
385 |
-
$desc = '<img src="' . $icon_url . '" alt="' . $filter_title . '" title="' . $filter_title . '" />';
|
386 |
-
//$desc = __( 'Current Icon: ', 'woocommerce-jetpack' ) . '<img src="' . $icon_url . '" alt="' . $filter_title . '" title="' . $filter_title . '" />';
|
387 |
-
|
388 |
-
$settings[] = array(
|
389 |
-
'title' => $filter_title,
|
390 |
-
//'title' => sprintf( __( 'Icon for %s payment gateway', 'woocommerce-jetpack' ), $filter_title ),
|
391 |
-
'desc' => $desc,
|
392 |
-
//'desc_tip' => $filter_name,
|
393 |
-
'id' => 'wcj_payment_gateways_icons_' . $filter_name,
|
394 |
-
'default' => '',
|
395 |
-
'type' => 'text',
|
396 |
-
'css' => 'min-width:300px;width:50%;',
|
397 |
-
);
|
398 |
-
}
|
399 |
-
|
400 |
-
$settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_payment_gateways_icons_options' );
|
401 |
-
|
402 |
-
//$settings = $this->add_fees_settings( $settings );
|
403 |
-
$settings = array_merge( $settings, array(
|
404 |
-
|
405 |
-
array( 'title' => __( 'Payment Gateways Fees Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you enable extra fees for payment gateways. When enabled all options are added to WooCommerce > Settings > Checkout', 'woocommerce-jetpack' ), 'id' => 'wcj_payment_gateways_fees_options' ),
|
406 |
|
407 |
array(
|
408 |
-
'title' => __( '
|
409 |
-
'desc' =>
|
410 |
-
'
|
411 |
-
'
|
412 |
-
'
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
$settings = array_merge( $settings, array(
|
419 |
-
|
420 |
-
array( 'title' => __( 'Payment Gateways per Category', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_payment_gateways_per_category_options' ),
|
421 |
-
|
422 |
-
array(
|
423 |
-
'title' => __( 'Payment Gateways per Category', 'woocommerce-jetpack' ),
|
424 |
-
//'desc' => __( '', 'woocommerce-jetpack' ),
|
425 |
-
'id' => 'wcj_payment_gateways_per_category_enabled',
|
426 |
-
'default' => 'yes',
|
427 |
-
'type' => 'checkbox',
|
428 |
),
|
429 |
|
430 |
-
array( 'type' => 'sectionend', 'id' => '
|
431 |
-
)
|
432 |
-
|
433 |
-
$settings = apply_filters( 'wcj_payment_gateways_settings', $settings );
|
434 |
-
|
435 |
-
return $settings;
|
436 |
-
}
|
437 |
|
438 |
-
|
439 |
-
|
440 |
-
*/
|
441 |
-
function settings_section( $sections ) {
|
442 |
-
$sections['payment_gateways'] = __( 'Payment Gateways', 'woocommerce-jetpack' );
|
443 |
-
return $sections;
|
444 |
-
}
|
445 |
}
|
446 |
|
447 |
endif;
|
4 |
*
|
5 |
* The WooCommerce Jetpack Payment Gateways class.
|
6 |
*
|
7 |
+
* @version 2.2.3
|
|
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
12 |
|
13 |
if ( ! class_exists( 'WCJ_Payment_Gateways' ) ) :
|
14 |
|
15 |
+
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 any number of custom payment gateways to WooCommerce.', 'woocommerce-jetpack' );
|
25 |
+
parent::__construct();
|
26 |
|
27 |
+
if ( $this->is_enabled() ) {
|
|
|
|
|
|
|
|
|
28 |
// Include custom payment gateway
|
29 |
include_once( 'gateways/class-wc-gateway-wcj-custom.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
/**
|
34 |
+
* get_settings.
|
35 |
*/
|
36 |
+
function get_settings() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
$settings = array(
|
39 |
|
40 |
+
array( 'title' => __( 'Custom Payment Gateways Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( '', 'woocommerce-jetpack' ), 'id' => 'wcj_custom_payment_gateways_options' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
array(
|
43 |
+
'title' => __( 'Number of Gateways', 'woocommerce-jetpack' ),
|
44 |
+
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
45 |
+
'desc_tip' => __( 'Number of custom payments gateways to be added. All settings for each new gateway are in WooCommerce > Settings > Checkout.', 'woocommerce-jetpack' ),
|
46 |
+
'id' => 'wcj_custom_payment_gateways_number',
|
47 |
+
'default' => 1,
|
48 |
+
'type' => 'number',
|
49 |
+
'custom_attributes' => array_merge(
|
50 |
+
is_array( apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ) ) ? apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ) : array(),
|
51 |
+
array( 'step' => '1', 'min' => '1', 'max' => '10', )
|
52 |
+
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
),
|
54 |
|
55 |
+
array( 'type' => 'sectionend', 'id' => 'wcj_custom_payment_gateways_options' ),
|
56 |
+
);
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
+
return $this->add_enable_module_setting( $settings );
|
59 |
+
}
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
|
62 |
endif;
|
includes/class-wcj-pdf-invoices.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoices class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -49,6 +49,8 @@ class WCJ_PDF_Invoices {
|
|
49 |
|
50 |
if ( 'yes' === apply_filters( 'wcj_get_option_filter', 'no', get_option( 'wcj_pdf_invoices_attach_to_email_enabled' ) ) )
|
51 |
add_filter( 'woocommerce_email_attachments', array( $this, 'add_pdf_invoice_email_attachment' ), 100, 3 );
|
|
|
|
|
52 |
}
|
53 |
|
54 |
// Settings hooks
|
@@ -57,6 +59,35 @@ class WCJ_PDF_Invoices {
|
|
57 |
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
/**
|
61 |
* Shortcodes.
|
62 |
*/
|
@@ -1387,7 +1418,7 @@ class WCJ_PDF_Invoices {
|
|
1387 |
'desc' => __( 'Enable save as pdf instead of view pdf', 'woocommerce-jetpack' ),
|
1388 |
//'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
1389 |
'id' => 'wcj_pdf_invoices_save_as_enabled',
|
1390 |
-
'default' => '
|
1391 |
'type' => 'checkbox',
|
1392 |
//'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
1393 |
),
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoices class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
49 |
|
50 |
if ( 'yes' === apply_filters( 'wcj_get_option_filter', 'no', get_option( 'wcj_pdf_invoices_attach_to_email_enabled' ) ) )
|
51 |
add_filter( 'woocommerce_email_attachments', array( $this, 'add_pdf_invoice_email_attachment' ), 100, 3 );
|
52 |
+
|
53 |
+
add_filter( 'woocommerce_payment_gateways_settings', array( $this, 'add_attach_invoice_settings' ), 100 );
|
54 |
}
|
55 |
|
56 |
// Settings hooks
|
59 |
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
60 |
}
|
61 |
|
62 |
+
/**
|
63 |
+
* add_attach_invoice_settings.
|
64 |
+
*/
|
65 |
+
function add_attach_invoice_settings( $settings ) {
|
66 |
+
$settings[] = array( 'title' => __( 'Payment Gateways Attach PDF Invoice V1 Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you choose when to attach PDF invoice to customers emails.', 'woocommerce-jetpack' ), 'id' => 'wcj_gateways_attach_invoice_options' );
|
67 |
+
global $woocommerce;
|
68 |
+
$available_gateways = $woocommerce->payment_gateways->payment_gateways();
|
69 |
+
foreach ( $available_gateways as $key => $gateway ) {
|
70 |
+
|
71 |
+
$settings = array_merge( $settings, array(
|
72 |
+
|
73 |
+
array(
|
74 |
+
'title' => $gateway->title,
|
75 |
+
//'desc' => __( 'Attach PDF invoice to customers emails.', 'woocommerce-jetpack' ),
|
76 |
+
'desc' => __( 'Attach PDF invoice.', 'woocommerce-jetpack' ),
|
77 |
+
'id' => 'wcj_gateways_attach_invoice_' . $key,
|
78 |
+
'default' => 'yes',
|
79 |
+
'type' => 'checkbox',
|
80 |
+
),
|
81 |
+
|
82 |
+
|
83 |
+
) );
|
84 |
+
}
|
85 |
+
|
86 |
+
$settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_gateways_attach_invoice_options' );
|
87 |
+
|
88 |
+
return $settings;
|
89 |
+
}
|
90 |
+
|
91 |
/**
|
92 |
* Shortcodes.
|
93 |
*/
|
1418 |
'desc' => __( 'Enable save as pdf instead of view pdf', 'woocommerce-jetpack' ),
|
1419 |
//'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
1420 |
'id' => 'wcj_pdf_invoices_save_as_enabled',
|
1421 |
+
'default' => 'yes',
|
1422 |
'type' => 'checkbox',
|
1423 |
//'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
1424 |
),
|
includes/class-wcj-product-input-fields.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Input Fields class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -14,9 +14,10 @@ if ( ! class_exists( 'WCJ_Product_Input_Fields' ) ) :
|
|
14 |
|
15 |
class WCJ_Product_Input_Fields {
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
20 |
public function __construct() {
|
21 |
|
22 |
include_once( 'input-fields/class-wcj-product-input-fields-abstract.php' );
|
@@ -24,6 +25,10 @@ class WCJ_Product_Input_Fields {
|
|
24 |
// Main hooks
|
25 |
if ( 'yes' === get_option( 'wcj_product_input_fields_enabled' ) ) {
|
26 |
|
|
|
|
|
|
|
|
|
27 |
include_once( 'input-fields/class-wcj-product-input-fields-global.php' );
|
28 |
include_once( 'input-fields/class-wcj-product-input-fields-per-product.php' );
|
29 |
|
@@ -39,7 +44,48 @@ class WCJ_Product_Input_Fields {
|
|
39 |
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
40 |
}
|
41 |
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
* register_script.
|
44 |
*/
|
45 |
public function register_scripts() {
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Input Fields class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
14 |
|
15 |
class WCJ_Product_Input_Fields {
|
16 |
|
17 |
+
/**
|
18 |
+
* Constructor.
|
19 |
+
* @version 2.2.2
|
20 |
+
*/
|
21 |
public function __construct() {
|
22 |
|
23 |
include_once( 'input-fields/class-wcj-product-input-fields-abstract.php' );
|
25 |
// Main hooks
|
26 |
if ( 'yes' === get_option( 'wcj_product_input_fields_enabled' ) ) {
|
27 |
|
28 |
+
add_action( 'woocommerce_delete_order_items', array( $this, 'delete_file_uploads' ) );
|
29 |
+
|
30 |
+
add_action( 'init', array( $this, 'handle_downloads' ) );
|
31 |
+
|
32 |
include_once( 'input-fields/class-wcj-product-input-fields-global.php' );
|
33 |
include_once( 'input-fields/class-wcj-product-input-fields-per-product.php' );
|
34 |
|
44 |
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
45 |
}
|
46 |
|
47 |
+
/**
|
48 |
+
* delete_file_uploads.
|
49 |
+
* @version 2.2.2
|
50 |
+
* @since 2.2.2
|
51 |
+
*/
|
52 |
+
public function delete_file_uploads( $postid ) {
|
53 |
+
$the_order = wc_get_order( $postid );
|
54 |
+
$the_items = $the_order->get_items();
|
55 |
+
foreach ( $the_items as $item ) {
|
56 |
+
foreach ( $item as $item_field ) {
|
57 |
+
$item_field = maybe_unserialize( $item_field );
|
58 |
+
if ( is_array( $item_field ) && isset( $item_field['wcj_type'] ) && 'file' === $item_field['wcj_type'] ) {
|
59 |
+
unlink( $item_field['tmp_name'] );
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* handle_downloads.
|
67 |
+
* @version 2.2.2
|
68 |
+
* @since 2.2.2
|
69 |
+
*/
|
70 |
+
public function handle_downloads() {
|
71 |
+
if ( isset ( $_GET['wcj_download_file'] ) ) {
|
72 |
+
$file_name = $_GET['wcj_download_file'];
|
73 |
+
$upload_dir = wcj_get_wcj_uploads_dir( 'input_fields_uploads' );
|
74 |
+
$file_path = $upload_dir . '/' . $file_name;
|
75 |
+
if ( is_super_admin() || is_shop_manager() ) {
|
76 |
+
header( "Expires: 0" );
|
77 |
+
header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
|
78 |
+
header( "Cache-Control: private", false );
|
79 |
+
header( 'Content-disposition: attachment; filename=' . $file_name );
|
80 |
+
header( "Content-Transfer-Encoding: binary" );
|
81 |
+
header( "Content-Length: ". filesize( $file_path ) );
|
82 |
+
readfile( $file_path );
|
83 |
+
exit();
|
84 |
+
}
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
* register_script.
|
90 |
*/
|
91 |
public function register_scripts() {
|
includes/class-wcj-reports.php
CHANGED
@@ -4,10 +4,8 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Reports class.
|
6 |
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @category Class
|
10 |
-
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
@@ -186,6 +184,13 @@ class WCJ_Reports {
|
|
186 |
'callback' => array( $this, 'get_report_stock' ),
|
187 |
);
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
return $reports;
|
190 |
}
|
191 |
|
@@ -251,6 +256,8 @@ class WCJ_Reports {
|
|
251 |
. __( 'WooJetpack: All in Stock with sales data. Available in WooCommerce > Reports > Stock.', 'woocommerce-jetpack' )
|
252 |
. '</p><p>'
|
253 |
. __( 'WooJetpack: Understocked products (calculated by sales data). Available in WooCommerce > Reports > Stock.', 'woocommerce-jetpack' )
|
|
|
|
|
254 |
. '</p>',
|
255 |
'id' => 'wcj_reports_more_options'
|
256 |
),
|
4 |
*
|
5 |
* The WooCommerce Jetpack Reports class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
+
* @author Algoritmika Ltd.
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
184 |
'callback' => array( $this, 'get_report_stock' ),
|
185 |
);
|
186 |
|
187 |
+
$reports['stock']['reports']['overstocked'] = array(
|
188 |
+
'title' => __( 'WooJetpack: Overstocked', 'woocommerce-jetpack' ),
|
189 |
+
'description' => '',
|
190 |
+
'hide_title' => true,
|
191 |
+
'callback' => array( $this, 'get_report_stock' ),
|
192 |
+
);
|
193 |
+
|
194 |
return $reports;
|
195 |
}
|
196 |
|
256 |
. __( 'WooJetpack: All in Stock with sales data. Available in WooCommerce > Reports > Stock.', 'woocommerce-jetpack' )
|
257 |
. '</p><p>'
|
258 |
. __( 'WooJetpack: Understocked products (calculated by sales data). Available in WooCommerce > Reports > Stock.', 'woocommerce-jetpack' )
|
259 |
+
. '</p><p>'
|
260 |
+
. __( 'WooJetpack: Overstocked products (calculated by sales data). Available in WooCommerce > Reports > Stock.', 'woocommerce-jetpack' )
|
261 |
. '</p>',
|
262 |
'id' => 'wcj_reports_more_options'
|
263 |
),
|
includes/class-wcj-sku.php
CHANGED
@@ -4,38 +4,39 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack SKU class.
|
6 |
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @category Class
|
10 |
-
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
|
15 |
if ( ! class_exists( 'WCJ_SKU' ) ) :
|
16 |
|
17 |
-
class WCJ_SKU {
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
|
24 |
-
$
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
add_action( 'wcj_tools_sku', array( $this, 'create_sku_tool' ), $the_priority );
|
29 |
|
30 |
-
|
31 |
-
}
|
32 |
-
add_action( 'wcj_tools_dashboard', array( $this, 'add_sku_tool_info_to_tools_dashboard' ), $the_priority );
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
39 |
|
40 |
/**
|
41 |
* set_sku_with_variable.
|
@@ -140,15 +141,17 @@ class WCJ_SKU {
|
|
140 |
*/
|
141 |
function add_sku_tool_tab( $tabs ) {
|
142 |
$tabs[] = array(
|
143 |
-
'id'
|
144 |
-
'title'
|
145 |
);
|
146 |
return $tabs;
|
147 |
}
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
|
|
|
|
152 |
function create_sku_tool() {
|
153 |
$result_message = '';
|
154 |
$is_preview = ( isset( $_POST['preview_sku'] ) ) ? true : false;
|
@@ -161,7 +164,7 @@ class WCJ_SKU {
|
|
161 |
'<th></th>' .
|
162 |
'<th>' . __( 'Product', 'woocommerce-jetpack' ) . '</th>' .
|
163 |
'<th>' . __( 'SKU', 'woocommerce-jetpack' ) . '</th>' .
|
164 |
-
|
165 |
ob_start();
|
166 |
$this->set_all_sku( $is_preview );
|
167 |
$preview_html .= ob_get_clean();
|
@@ -169,6 +172,7 @@ class WCJ_SKU {
|
|
169 |
$result_message = '<p><div class="updated"><p><strong>' . __( 'SKUs generated and set successfully!', 'woocommerce-jetpack' ) . '</strong></p></div></p>';
|
170 |
}
|
171 |
?><div>
|
|
|
172 |
<h2><?php echo __( 'WooCommerce Jetpack - Autogenerate SKUs', 'woocommerce-jetpack' ); ?></h2>
|
173 |
<p><?php echo __( 'The tool generates and sets product SKUs.', 'woocommerce-jetpack' ); ?></p>
|
174 |
<?php if ( ! $is_preview ) echo $result_message; ?>
|
@@ -195,93 +199,70 @@ class WCJ_SKU {
|
|
195 |
echo '</tr>';
|
196 |
}
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
function get_settings() {
|
211 |
-
|
212 |
-
$settings = array(
|
213 |
-
|
214 |
-
array(
|
215 |
-
'title' => __( 'SKU Options', 'woocommerce-jetpack' ),
|
216 |
-
'type' => 'title',
|
217 |
-
'desc' => __( 'When enabled - all new products will be given (autogenerated) SKU. If you wish to set SKUs for existing products, use Autogenerate SKUs Tool in WooCommerce > Jetpack Tools.', 'woocommerce-jetpack' ),
|
218 |
-
'id' => 'wcj_sku_options'
|
219 |
),
|
220 |
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
'default' => 0,
|
241 |
-
'type' => 'number',
|
242 |
-
),
|
243 |
-
|
244 |
-
array(
|
245 |
-
'title' => __( 'Suffix', 'woocommerce-jetpack' ),
|
246 |
-
'id' => 'wcj_sku_suffix',
|
247 |
-
'default' => '',
|
248 |
-
'type' => 'text',
|
249 |
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
250 |
'custom_attributes'
|
251 |
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
252 |
-
|
253 |
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
'options' => array(
|
260 |
'as_variable' => __( 'SKU same as parent\'s product', 'woocommerce-jetpack' ),
|
261 |
'as_variation' => __( 'Generate different SKU for each variation', 'woocommerce-jetpack' ),
|
262 |
'as_variable_with_suffix' => __( 'SKU same as parent\'s product + variation letter suffix', 'woocommerce-jetpack' ),
|
263 |
-
|
264 |
-
'desc'
|
265 |
'custom_attributes'
|
266 |
-
|
267 |
-
|
268 |
|
269 |
-
|
270 |
-
'type'
|
271 |
-
'id'
|
272 |
),
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
*/
|
281 |
-
function settings_section( $sections ) {
|
282 |
-
$sections['sku'] = __( 'SKU', 'woocommerce-jetpack' );
|
283 |
-
return $sections;
|
284 |
-
}
|
285 |
}
|
286 |
|
287 |
endif;
|
4 |
*
|
5 |
* The WooCommerce Jetpack SKU class.
|
6 |
*
|
7 |
+
* @version 2.2.3
|
8 |
+
* @author Algoritmika Ltd.
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
if ( ! class_exists( 'WCJ_SKU' ) ) :
|
14 |
|
15 |
+
class WCJ_SKU extends WCJ_Module {
|
16 |
|
17 |
+
/**
|
18 |
+
* Constructor.
|
19 |
+
*
|
20 |
+
* @version 2.2.3
|
21 |
+
*/
|
22 |
+
function __construct() {
|
23 |
|
24 |
+
$this->id = 'sku';
|
25 |
+
$this->short_desc = __( 'SKU', 'woocommerce-jetpack' );
|
26 |
+
$this->desc = __( 'Generate WooCommerce SKUs automatically.', 'woocommerce-jetpack' );
|
27 |
+
parent::__construct();
|
|
|
28 |
|
29 |
+
$this->add_tools( array( 'sku' => __( 'Autogenerate SKUs for Existing Products', 'woocommerce-jetpack' ), ) );
|
|
|
|
|
30 |
|
31 |
+
$the_priority = 100;
|
32 |
+
if ( $this->is_enabled() ) {
|
33 |
+
add_filter( 'wcj_tools_tabs', array( $this, 'add_sku_tool_tab' ), $the_priority );
|
34 |
+
add_action( 'wcj_tools_sku', array( $this, 'create_sku_tool' ), $the_priority );
|
35 |
+
|
36 |
+
add_action( 'wp_insert_post', array( $this, 'set_product_sku' ), $the_priority, 3 );
|
37 |
+
}
|
38 |
+
add_action( 'wcj_tools_dashboard', array( $this, 'add_sku_tool_info_to_tools_dashboard' ), $the_priority );
|
39 |
+
}
|
40 |
|
41 |
/**
|
42 |
* set_sku_with_variable.
|
141 |
*/
|
142 |
function add_sku_tool_tab( $tabs ) {
|
143 |
$tabs[] = array(
|
144 |
+
'id' => 'sku',
|
145 |
+
'title' => __( 'Autogenerate SKUs', 'woocommerce-jetpack' ),
|
146 |
);
|
147 |
return $tabs;
|
148 |
}
|
149 |
|
150 |
+
/**
|
151 |
+
* create_sku_tool
|
152 |
+
*
|
153 |
+
* @version 2.2.3
|
154 |
+
*/
|
155 |
function create_sku_tool() {
|
156 |
$result_message = '';
|
157 |
$is_preview = ( isset( $_POST['preview_sku'] ) ) ? true : false;
|
164 |
'<th></th>' .
|
165 |
'<th>' . __( 'Product', 'woocommerce-jetpack' ) . '</th>' .
|
166 |
'<th>' . __( 'SKU', 'woocommerce-jetpack' ) . '</th>' .
|
167 |
+
'</tr>';
|
168 |
ob_start();
|
169 |
$this->set_all_sku( $is_preview );
|
170 |
$preview_html .= ob_get_clean();
|
172 |
$result_message = '<p><div class="updated"><p><strong>' . __( 'SKUs generated and set successfully!', 'woocommerce-jetpack' ) . '</strong></p></div></p>';
|
173 |
}
|
174 |
?><div>
|
175 |
+
<?php echo $this->get_back_to_settings_link_html(); ?>
|
176 |
<h2><?php echo __( 'WooCommerce Jetpack - Autogenerate SKUs', 'woocommerce-jetpack' ); ?></h2>
|
177 |
<p><?php echo __( 'The tool generates and sets product SKUs.', 'woocommerce-jetpack' ); ?></p>
|
178 |
<?php if ( ! $is_preview ) echo $result_message; ?>
|
199 |
echo '</tr>';
|
200 |
}
|
201 |
|
202 |
+
/**
|
203 |
+
* get_settings.
|
204 |
+
*/
|
205 |
+
function get_settings() {
|
206 |
+
|
207 |
+
$settings = array(
|
208 |
+
|
209 |
+
array(
|
210 |
+
'title' => __( 'SKU Format Options', 'woocommerce-jetpack' ),
|
211 |
+
'type' => 'title',
|
212 |
+
'desc' => '',
|
213 |
+
'id' => 'wcj_sku_format_options'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
),
|
215 |
|
216 |
+
array(
|
217 |
+
'title' => __( 'Prefix', 'woocommerce-jetpack' ),
|
218 |
+
'id' => 'wcj_sku_prefix',
|
219 |
+
'default' => '',
|
220 |
+
'type' => 'text',
|
221 |
+
),
|
222 |
+
|
223 |
+
array(
|
224 |
+
'title' => __( 'Minimum Number Length', 'woocommerce-jetpack' ),
|
225 |
+
'id' => 'wcj_sku_minimum_number_length',
|
226 |
+
'default' => 0,
|
227 |
+
'type' => 'number',
|
228 |
+
),
|
229 |
+
|
230 |
+
array(
|
231 |
+
'title' => __( 'Suffix', 'woocommerce-jetpack' ),
|
232 |
+
'id' => 'wcj_sku_suffix',
|
233 |
+
'default' => '',
|
234 |
+
'type' => 'text',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
236 |
'custom_attributes'
|
237 |
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
238 |
+
),
|
239 |
|
240 |
+
array(
|
241 |
+
'title' => __( 'Variable Products Variations', 'woocommerce-jetpack' ),
|
242 |
+
'id' => 'wcj_sku_variations_handling',
|
243 |
+
'default' => 'as_variable',
|
244 |
+
'type' => 'select',
|
245 |
'options' => array(
|
246 |
'as_variable' => __( 'SKU same as parent\'s product', 'woocommerce-jetpack' ),
|
247 |
'as_variation' => __( 'Generate different SKU for each variation', 'woocommerce-jetpack' ),
|
248 |
'as_variable_with_suffix' => __( 'SKU same as parent\'s product + variation letter suffix', 'woocommerce-jetpack' ),
|
249 |
+
),
|
250 |
+
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
251 |
'custom_attributes'
|
252 |
+
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
253 |
+
),
|
254 |
|
255 |
+
array(
|
256 |
+
'type' => 'sectionend',
|
257 |
+
'id' => 'wcj_sku_format_options'
|
258 |
),
|
259 |
+
|
260 |
+
);
|
261 |
+
|
262 |
+
$settings = $this->add_tools_list( $settings );
|
263 |
+
|
264 |
+
return $this->add_enable_module_setting( $settings, __( 'When enabled - all new products will be given (autogenerated) SKU.<br>If you wish to set SKUs for existing products, use Autogenerate SKUs Tool.', 'woocommerce-jetpack' ) );
|
265 |
+
}
|
|
|
|
|
|
|
|
|
|
|
266 |
}
|
267 |
|
268 |
endif;
|
includes/class-wcj-wholesale-price.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Wholesale Price class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @since 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
@@ -26,12 +26,44 @@ class WCJ_Wholesale_Price extends WCJ_Module {
|
|
26 |
parent::__construct();
|
27 |
|
28 |
if ( $this->is_enabled() ) {
|
|
|
29 |
add_filter( 'woocommerce_get_price', array( $this, 'wholesale_price' ), PHP_INT_MAX, 2 );
|
30 |
add_filter( 'woocommerce_get_sale_price', array( $this, 'wholesale_price' ), PHP_INT_MAX, 2 );
|
31 |
add_filter( 'woocommerce_get_regular_price', array( $this, 'wholesale_price' ), PHP_INT_MAX, 2 );
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
}
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
/**
|
36 |
* get_discount_percent_by_quantity.
|
37 |
*/
|
@@ -62,34 +94,47 @@ class WCJ_Wholesale_Price extends WCJ_Module {
|
|
62 |
}
|
63 |
|
64 |
/**
|
65 |
-
*
|
66 |
*/
|
67 |
-
function
|
68 |
-
|
69 |
-
if ( ! wcj_is_product_wholesale_enabled( $product->id ) ) return $price;
|
70 |
-
|
71 |
-
// Show only on checkout and cart pages
|
72 |
-
$is_ajax = ( is_admin() && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) ? true : false;
|
73 |
-
if ( ! ( is_checkout() || is_cart() || $is_ajax ) ) return $price;
|
74 |
|
75 |
// Get quanitity from cart
|
76 |
-
$quanitities = array();
|
77 |
$the_cart = WC()->cart->get_cart();
|
|
|
|
|
78 |
foreach ( $the_cart as $cart_item_key => $values ) {
|
79 |
if ( ! isset( $quanitities[ $values['product_id'] ] ) ) $quanitities[ $values['product_id'] ] = 0;
|
80 |
$quanitities[ $values['product_id'] ] += $values['quantity'];
|
|
|
81 |
}
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
92 |
}
|
|
|
|
|
93 |
return $price;
|
94 |
}
|
95 |
|
@@ -110,22 +155,46 @@ class WCJ_Wholesale_Price extends WCJ_Module {
|
|
110 |
),
|
111 |
|
112 |
array(
|
113 |
-
'title'
|
114 |
-
'desc'
|
115 |
-
'id'
|
116 |
-
'default'
|
117 |
-
'type'
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
),
|
122 |
|
123 |
array(
|
124 |
-
'title'
|
125 |
-
'id'
|
126 |
-
'default'
|
127 |
-
'type'
|
128 |
-
'desc'
|
129 |
'custom_attributes' => array_merge(
|
130 |
is_array( apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ) ) ? apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ) : array(),
|
131 |
array('step' => '1', 'min' => '1', ) ),
|
@@ -136,8 +205,8 @@ class WCJ_Wholesale_Price extends WCJ_Module {
|
|
136 |
for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_wholesale_price_levels_number', 1 ) ); $i++ ) {
|
137 |
|
138 |
$settings[] = array(
|
139 |
-
'title' => __( 'Min
|
140 |
-
'desc' => __( '
|
141 |
'id' => 'wcj_wholesale_price_level_min_qty_' . $i,
|
142 |
'default' => 0,
|
143 |
'type' => 'number',
|
4 |
*
|
5 |
* The WooCommerce Jetpack Wholesale Price class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
* @since 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
26 |
parent::__construct();
|
27 |
|
28 |
if ( $this->is_enabled() ) {
|
29 |
+
|
30 |
add_filter( 'woocommerce_get_price', array( $this, 'wholesale_price' ), PHP_INT_MAX, 2 );
|
31 |
add_filter( 'woocommerce_get_sale_price', array( $this, 'wholesale_price' ), PHP_INT_MAX, 2 );
|
32 |
add_filter( 'woocommerce_get_regular_price', array( $this, 'wholesale_price' ), PHP_INT_MAX, 2 );
|
33 |
+
|
34 |
+
if ( 'yes' === get_option( 'wcj_wholesale_price_show_info_on_cart', 'no' ) ) {
|
35 |
+
add_filter( 'woocommerce_cart_item_price', array( $this, 'add_discount_info_to_cart_page' ), PHP_INT_MAX, 3 );
|
36 |
+
}
|
37 |
}
|
38 |
}
|
39 |
|
40 |
+
/**
|
41 |
+
* add_discount_info_to_cart_page.
|
42 |
+
*/
|
43 |
+
function add_discount_info_to_cart_page( $price_html, $cart_item, $cart_item_key ) {
|
44 |
+
|
45 |
+
$_product = wc_get_product( $cart_item['product_id'] );
|
46 |
+
|
47 |
+
remove_filter( 'woocommerce_get_price', array( $this, 'wholesale_price' ), PHP_INT_MAX, 2 );
|
48 |
+
$old_price_html = $_product->get_price_html();
|
49 |
+
add_filter( 'woocommerce_get_price', array( $this, 'wholesale_price' ), PHP_INT_MAX, 2 );
|
50 |
+
|
51 |
+
if ( $old_price_html != $price_html ) {
|
52 |
+
|
53 |
+
$the_quantity = $this->get_wholesale_quantity( $_product );
|
54 |
+
$discount_percent = $this->get_discount_percent_by_quantity( $the_quantity );
|
55 |
+
|
56 |
+
$wholesale_price_html = get_option( 'wcj_wholesale_price_show_info_on_cart_format' );
|
57 |
+
$wholesale_price_html = str_replace( '%old_price%', $old_price_html, $wholesale_price_html );
|
58 |
+
$wholesale_price_html = str_replace( '%price%', $price_html, $wholesale_price_html );
|
59 |
+
$wholesale_price_html = str_replace( '%discount_percent%', $discount_percent, $wholesale_price_html );
|
60 |
+
|
61 |
+
return $wholesale_price_html;
|
62 |
+
}
|
63 |
+
|
64 |
+
return $price_html;
|
65 |
+
}
|
66 |
+
|
67 |
/**
|
68 |
* get_discount_percent_by_quantity.
|
69 |
*/
|
94 |
}
|
95 |
|
96 |
/**
|
97 |
+
* get_wholesale_quantity.
|
98 |
*/
|
99 |
+
private function get_wholesale_quantity( $_product ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
// Get quanitity from cart
|
|
|
102 |
$the_cart = WC()->cart->get_cart();
|
103 |
+
$quanitities = array();
|
104 |
+
$total_quantity = 0;
|
105 |
foreach ( $the_cart as $cart_item_key => $values ) {
|
106 |
if ( ! isset( $quanitities[ $values['product_id'] ] ) ) $quanitities[ $values['product_id'] ] = 0;
|
107 |
$quanitities[ $values['product_id'] ] += $values['quantity'];
|
108 |
+
$total_quantity += $values['quantity'];
|
109 |
}
|
110 |
+
$product_quantity = ( isset( $quanitities[ $_product->id ] ) ) ? $quanitities[ $_product->id ] : 0;
|
111 |
+
|
112 |
+
return ( 'yes' === get_option( 'wcj_wholesale_price_use_total_cart_quantity', 'no' ) ) ? $total_quantity : $product_quantity;
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* wholesale_price.
|
117 |
+
*/
|
118 |
+
function wholesale_price( $price, $_product ) {
|
119 |
+
|
120 |
+
if ( ! wcj_is_product_wholesale_enabled( $_product->id ) ) return $price;
|
121 |
+
|
122 |
+
// Show only on checkout and cart pages
|
123 |
+
$is_ajax = ( is_admin() && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) ? true : false;
|
124 |
+
if ( ! ( is_checkout() || is_cart() || $is_ajax ) ) return $price;
|
125 |
+
|
126 |
+
// Maybe set wholesale price
|
127 |
+
$the_quantity = $this->get_wholesale_quantity( $_product );
|
128 |
+
if ( $the_quantity > 1 ) {
|
129 |
+
$wholesale_price = $this->get_wholesale_price( $price, $the_quantity );
|
130 |
+
if ( $wholesale_price != $price ) {
|
131 |
+
// Setting wholesale price
|
132 |
+
$precision = get_option( 'woocommerce_price_num_decimals', 2 );
|
133 |
+
return round( $wholesale_price, $precision );
|
134 |
}
|
135 |
}
|
136 |
+
|
137 |
+
// No changes to the price
|
138 |
return $price;
|
139 |
}
|
140 |
|
155 |
),
|
156 |
|
157 |
array(
|
158 |
+
'title' => __( 'Use total cart quantity instead of product quantity', 'woocommerce-jetpack' ),
|
159 |
+
'desc' => __( 'Enable', 'woocommerce-jetpack' ),
|
160 |
+
'id' => 'wcj_wholesale_price_use_total_cart_quantity',
|
161 |
+
'default' => 'no',
|
162 |
+
'type' => 'checkbox',
|
163 |
+
),
|
164 |
+
|
165 |
+
array(
|
166 |
+
'title' => __( 'Show discount info on cart page', 'woocommerce-jetpack' ),
|
167 |
+
'desc' => __( 'Show', 'woocommerce-jetpack' ),
|
168 |
+
'id' => 'wcj_wholesale_price_show_info_on_cart',
|
169 |
+
'default' => 'no',
|
170 |
+
'type' => 'checkbox',
|
171 |
+
),
|
172 |
+
|
173 |
+
array(
|
174 |
+
'title' => __( 'If show discount info on cart page is enabled, set format here', 'woocommerce-jetpack' ),
|
175 |
+
'id' => 'wcj_wholesale_price_show_info_on_cart_format',
|
176 |
+
'default' => '<del>%old_price%</del> %price%<br>You save: <span style="color:red;">%discount_percent%%</span>',
|
177 |
+
'type' => 'textarea',
|
178 |
+
'css' => 'width: 450px;',
|
179 |
+
),
|
180 |
+
|
181 |
+
array(
|
182 |
+
'title' => __( 'Products to include', 'woocommerce-jetpack' ),
|
183 |
+
'desc' => __( 'Leave blank to include all products.', 'woocommerce-jetpack' ),
|
184 |
+
'id' => 'wcj_wholesale_price_products_to_include',
|
185 |
+
'default' => '',
|
186 |
+
'type' => 'multiselect',
|
187 |
+
'class' => 'chosen_select',
|
188 |
+
//'css' => 'width: 450px;',
|
189 |
+
'options' => $products,
|
190 |
),
|
191 |
|
192 |
array(
|
193 |
+
'title' => __( 'Number of levels', 'woocommerce-jetpack' ),
|
194 |
+
'id' => 'wcj_wholesale_price_levels_number',
|
195 |
+
'default' => 1,
|
196 |
+
'type' => 'custom_number',
|
197 |
+
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
198 |
'custom_attributes' => array_merge(
|
199 |
is_array( apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ) ) ? apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ) : array(),
|
200 |
array('step' => '1', 'min' => '1', ) ),
|
205 |
for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_wholesale_price_levels_number', 1 ) ); $i++ ) {
|
206 |
|
207 |
$settings[] = array(
|
208 |
+
'title' => __( 'Min quantity', 'woocommerce-jetpack' ) . ' #' . $i,
|
209 |
+
'desc' => __( 'Minimum quantity to apply discount', 'woocommerce-jetpack' ),
|
210 |
'id' => 'wcj_wholesale_price_level_min_qty_' . $i,
|
211 |
'default' => 0,
|
212 |
'type' => 'number',
|
includes/classes/class-wcj-invoice.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Invoice class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -37,7 +37,7 @@ class WCJ_Invoice {
|
|
37 |
*/
|
38 |
function delete() {
|
39 |
update_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_number_id', 0 );
|
40 |
-
update_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_number', 0 );
|
41 |
update_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_date', '' );
|
42 |
}
|
43 |
|
@@ -56,7 +56,7 @@ class WCJ_Invoice {
|
|
56 |
}
|
57 |
$the_date = ( '' == $date ) ? time() : $date;
|
58 |
update_post_meta( $order_id, '_wcj_invoicing_' . $invoice_type . '_number_id', $the_invoice_number );
|
59 |
-
update_post_meta( $order_id, '_wcj_invoicing_' . $invoice_type . '_number', $this->get_invoice_full_number( $the_invoice_number ) );
|
60 |
update_post_meta( $order_id, '_wcj_invoicing_' . $invoice_type . '_date', $the_date );
|
61 |
//}
|
62 |
}
|
@@ -83,14 +83,21 @@ class WCJ_Invoice {
|
|
83 |
* get_invoice_number.
|
84 |
*/
|
85 |
function get_invoice_number() {
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
return apply_filters( 'wcj_get_' . $this->invoice_type . '_number', $the_number, $this->order_id );
|
89 |
}
|
90 |
|
91 |
/**
|
92 |
* get_invoice_full_number.
|
93 |
-
|
94 |
private function get_invoice_full_number( $the_number ) {
|
95 |
$the_prefix = get_option( 'wcj_invoicing_' . $this->invoice_type . '_numbering_prefix' );
|
96 |
$the_suffix = get_option( 'wcj_invoicing_' . $this->invoice_type . '_numbering_suffix' );
|
@@ -99,6 +106,7 @@ class WCJ_Invoice {
|
|
99 |
$the_number,
|
100 |
$the_suffix ) );
|
101 |
}
|
|
|
102 |
}
|
103 |
|
104 |
endif;
|
4 |
*
|
5 |
* The WooCommerce Jetpack Invoice class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
37 |
*/
|
38 |
function delete() {
|
39 |
update_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_number_id', 0 );
|
40 |
+
//update_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_number', 0 );
|
41 |
update_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_date', '' );
|
42 |
}
|
43 |
|
56 |
}
|
57 |
$the_date = ( '' == $date ) ? time() : $date;
|
58 |
update_post_meta( $order_id, '_wcj_invoicing_' . $invoice_type . '_number_id', $the_invoice_number );
|
59 |
+
//update_post_meta( $order_id, '_wcj_invoicing_' . $invoice_type . '_number', $this->get_invoice_full_number( $the_invoice_number ) );
|
60 |
update_post_meta( $order_id, '_wcj_invoicing_' . $invoice_type . '_date', $the_date );
|
61 |
//}
|
62 |
}
|
83 |
* get_invoice_number.
|
84 |
*/
|
85 |
function get_invoice_number() {
|
86 |
+
//$the_number = get_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_number', true );
|
87 |
+
$the_number_id = get_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_number_id', true );
|
88 |
+
//$the_number = $this->get_invoice_full_number( $the_number_id );
|
89 |
+
$the_prefix = get_option( 'wcj_invoicing_' . $this->invoice_type . '_numbering_prefix' );
|
90 |
+
$the_suffix = get_option( 'wcj_invoicing_' . $this->invoice_type . '_numbering_suffix' );
|
91 |
+
$the_number = do_shortcode( sprintf( '%s%0' . get_option( 'wcj_invoicing_' . $this->invoice_type . '_numbering_counter_width', 0 ). 'd%s',
|
92 |
+
$the_prefix,
|
93 |
+
$the_number_id,
|
94 |
+
$the_suffix ) );
|
95 |
return apply_filters( 'wcj_get_' . $this->invoice_type . '_number', $the_number, $this->order_id );
|
96 |
}
|
97 |
|
98 |
/**
|
99 |
* get_invoice_full_number.
|
100 |
+
*
|
101 |
private function get_invoice_full_number( $the_number ) {
|
102 |
$the_prefix = get_option( 'wcj_invoicing_' . $this->invoice_type . '_numbering_prefix' );
|
103 |
$the_suffix = get_option( 'wcj_invoicing_' . $this->invoice_type . '_numbering_suffix' );
|
106 |
$the_number,
|
107 |
$the_suffix ) );
|
108 |
}
|
109 |
+
/**/
|
110 |
}
|
111 |
|
112 |
endif;
|
includes/classes/class-wcj-module.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Module class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @since 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
@@ -31,7 +31,7 @@ class WCJ_Module {
|
|
31 |
$this->type = $type;
|
32 |
if ( 'module' === $this->type ) {
|
33 |
$this->parent_id = '';
|
34 |
-
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
35 |
}
|
36 |
}
|
37 |
|
@@ -46,7 +46,7 @@ class WCJ_Module {
|
|
46 |
/**
|
47 |
* add_enabled_option.
|
48 |
* only for `module`
|
49 |
-
|
50 |
public function add_enabled_option( $settings ) {
|
51 |
$all_settings = $this->get_settings();
|
52 |
$settings[] = $all_settings[1];
|
@@ -60,16 +60,109 @@ class WCJ_Module {
|
|
60 |
$sections[ $this->id ] = $this->short_desc;
|
61 |
return $sections;
|
62 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
/**
|
64 |
* settings_section.
|
65 |
* only for `module`
|
|
|
|
|
66 |
*/
|
67 |
-
function add_enable_module_setting( $settings ) {
|
68 |
$enable_module_setting = array(
|
69 |
array(
|
70 |
'title' => $this->short_desc . ' ' . __( 'Options', 'woocommerce-jetpack' ),
|
71 |
'type' => 'title',
|
72 |
-
'desc' =>
|
73 |
'id' => 'wcj_' . $this->id . '_options',
|
74 |
),
|
75 |
array(
|
4 |
*
|
5 |
* The WooCommerce Jetpack Module class.
|
6 |
*
|
7 |
+
* @version 2.2.3
|
8 |
* @since 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
31 |
$this->type = $type;
|
32 |
if ( 'module' === $this->type ) {
|
33 |
$this->parent_id = '';
|
34 |
+
//add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
35 |
}
|
36 |
}
|
37 |
|
46 |
/**
|
47 |
* add_enabled_option.
|
48 |
* only for `module`
|
49 |
+
*
|
50 |
public function add_enabled_option( $settings ) {
|
51 |
$all_settings = $this->get_settings();
|
52 |
$settings[] = $all_settings[1];
|
60 |
$sections[ $this->id ] = $this->short_desc;
|
61 |
return $sections;
|
62 |
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* get_cat_by_section
|
66 |
+
*
|
67 |
+
* @version 2.2.3
|
68 |
+
* @since 2.2.3
|
69 |
+
*/
|
70 |
+
function get_cat_by_section( $section ) {
|
71 |
+
$cats = include( wcj_plugin_path() . '/includes/admin/' . 'wcj-modules-cats.php' );
|
72 |
+
foreach ( $cats as $id => $label_info ) {
|
73 |
+
if ( ( ! empty( $label_info['all_cat_ids'] ) ) &&
|
74 |
+
( is_array( $label_info['all_cat_ids'] ) ) &&
|
75 |
+
( in_array( $section, $label_info['all_cat_ids'] ) )
|
76 |
+
) {
|
77 |
+
return $id;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
return '';
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* get_back_to_settings_link_html.
|
85 |
+
*
|
86 |
+
* @version 2.2.3
|
87 |
+
* @since 2.2.3
|
88 |
+
*/
|
89 |
+
function get_back_to_settings_link_html() {
|
90 |
+
$cat_id = $this->get_cat_by_section( $this->id );
|
91 |
+
$the_link = admin_url( 'admin.php?page=wc-settings&tab=jetpack&wcj-cat=' . $cat_id . '§ion=' . $this->id );
|
92 |
+
return '<a href="' . $the_link . '">' . __( 'Back to Module Settings', 'woocommerce-jetpack' ) . '</a>';
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* add_tools_list.
|
97 |
+
*
|
98 |
+
* @version 2.2.3
|
99 |
+
* @since 2.2.3
|
100 |
+
*/
|
101 |
+
function add_tools_list( $settings ) {
|
102 |
+
return array_merge( $settings, array(
|
103 |
+
array(
|
104 |
+
'title' => $this->short_desc . ' ' . __( 'Tools', 'woocommerce-jetpack' ),
|
105 |
+
'type' => 'title',
|
106 |
+
'desc' => '',
|
107 |
+
'id' => 'wcj_' . $this->id . '_tools_options'
|
108 |
+
),
|
109 |
+
array(
|
110 |
+
'title' => __( 'Module Tools', 'woocommerce-jetpack' ),
|
111 |
+
'id' => 'wcj_' . $this->id . '_module_tools',
|
112 |
+
'type' => 'module_tools',
|
113 |
+
),
|
114 |
+
array(
|
115 |
+
'type' => 'sectionend',
|
116 |
+
'id' => 'wcj_' . $this->id . '_tools_options'
|
117 |
+
),
|
118 |
+
) );
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* add_tools.
|
123 |
+
*
|
124 |
+
* @version 2.2.3
|
125 |
+
* @since 2.2.3
|
126 |
+
*/
|
127 |
+
function add_tools( $tools_array ) {
|
128 |
+
$this->tools_array = $tools_array;
|
129 |
+
add_action( 'wcj_module_tools_' . $this->id, array( $this, 'add_tool_link' ), PHP_INT_MAX );
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* add_tool_link.
|
134 |
+
*
|
135 |
+
* @version 2.2.3
|
136 |
+
* @since 2.2.3
|
137 |
+
*/
|
138 |
+
function add_tool_link() {
|
139 |
+
//echo '<ul>';
|
140 |
+
foreach ( $this->tools_array as $tool_id => $tool_desc ) {
|
141 |
+
//echo '<li>';
|
142 |
+
if ( $this->is_enabled() ) {
|
143 |
+
echo '<a href="' . admin_url( 'admin.php?page=wcj-tools&tab=' . $tool_id ) . '"><code>' . $tool_desc . '</code></a>';
|
144 |
+
}
|
145 |
+
else {
|
146 |
+
echo '<code>' . $tool_desc . '</code>';
|
147 |
+
}
|
148 |
+
//echo '</li>';
|
149 |
+
echo '<br>';
|
150 |
+
}
|
151 |
+
//echo '</ul>';
|
152 |
+
}
|
153 |
+
|
154 |
/**
|
155 |
* settings_section.
|
156 |
* only for `module`
|
157 |
+
*
|
158 |
+
* @version 2.2.3
|
159 |
*/
|
160 |
+
function add_enable_module_setting( $settings, $module_desc = '' ) {
|
161 |
$enable_module_setting = array(
|
162 |
array(
|
163 |
'title' => $this->short_desc . ' ' . __( 'Options', 'woocommerce-jetpack' ),
|
164 |
'type' => 'title',
|
165 |
+
'desc' => $module_desc,
|
166 |
'id' => 'wcj_' . $this->id . '_options',
|
167 |
),
|
168 |
array(
|
includes/functions/wcj-functions.php
CHANGED
@@ -4,10 +4,23 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Functions.
|
6 |
*
|
7 |
-
* @version
|
8 |
-
* @author
|
9 |
*/
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
/**
|
12 |
* wcj_is_product_wholesale_enabled.
|
13 |
*/
|
4 |
*
|
5 |
* The WooCommerce Jetpack Functions.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
+
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
11 |
+
/**
|
12 |
+
* wcj_get_wcj_uploads_dir.
|
13 |
+
*/
|
14 |
+
if ( ! function_exists( 'wcj_get_wcj_uploads_dir' ) ) {
|
15 |
+
function wcj_get_wcj_uploads_dir( $subdir = '' ) {
|
16 |
+
$upload_dir = wp_upload_dir();
|
17 |
+
$upload_dir = $upload_dir['basedir'];
|
18 |
+
$upload_dir = $upload_dir . '/woocommerce_uploads/wcj_uploads';
|
19 |
+
if ( '' != $subdir ) $upload_dir = $upload_dir . '/' . $subdir;
|
20 |
+
return $upload_dir;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
/**
|
25 |
* wcj_is_product_wholesale_enabled.
|
26 |
*/
|
includes/gateways/class-wc-gateway-wcj-custom.php
CHANGED
@@ -4,10 +4,8 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Custom Payment Gateway class.
|
6 |
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @category Class
|
10 |
-
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
|
13 |
add_action( 'plugins_loaded', 'init_wc_gateway_wcj_custom_class' );
|
@@ -357,9 +355,21 @@ function init_wc_gateway_wcj_custom_class() {
|
|
357 |
class WC_Gateway_WCJ_Custom_10 extends WC_Gateway_WCJ_Custom_Template { public function __construct() { $this->init( 10 ); } }
|
358 |
function add_wc_gateway_wcj_custom_classes( $methods ) {
|
359 |
$methods[] = 'WC_Gateway_WCJ_Custom'; // required
|
360 |
-
|
|
|
|
|
361 |
$methods[] = 'WC_Gateway_WCJ_Custom_' . $i;
|
362 |
return $methods;
|
363 |
}
|
364 |
add_filter( 'woocommerce_payment_gateways', 'add_wc_gateway_wcj_custom_classes' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
}
|
4 |
*
|
5 |
* The WooCommerce Jetpack Custom Payment Gateway class.
|
6 |
*
|
7 |
+
* @version 2.2.3
|
8 |
+
* @author Algoritmika Ltd.
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
add_action( 'plugins_loaded', 'init_wc_gateway_wcj_custom_class' );
|
355 |
class WC_Gateway_WCJ_Custom_10 extends WC_Gateway_WCJ_Custom_Template { public function __construct() { $this->init( 10 ); } }
|
356 |
function add_wc_gateway_wcj_custom_classes( $methods ) {
|
357 |
$methods[] = 'WC_Gateway_WCJ_Custom'; // required
|
358 |
+
$the_number = apply_filters( 'wcj_get_option_filter', 0, get_option( 'wcj_custom_payment_gateways_number' ) );
|
359 |
+
if ( $the_number > 10 ) $the_number = 10;
|
360 |
+
for ( $i = 2; $i <= $the_number; $i++ )
|
361 |
$methods[] = 'WC_Gateway_WCJ_Custom_' . $i;
|
362 |
return $methods;
|
363 |
}
|
364 |
add_filter( 'woocommerce_payment_gateways', 'add_wc_gateway_wcj_custom_classes' );
|
365 |
+
|
366 |
+
/* function add_wc_gateway_wcj_custom_classes( $methods ) {
|
367 |
+
for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 0, get_option( 'wcj_custom_payment_gateways_number' ) ); $i++ ) {
|
368 |
+
$class_name = ( 1 === $i ) ? 'WC_Gateway_WCJ_Custom' : 'WC_Gateway_WCJ_Custom_' . $i;
|
369 |
+
eval( 'class ' . $class_name . ' extends WC_Gateway_WCJ_Custom_Template { public function __construct() { $this->init( ' . $i . ' ); } }' );
|
370 |
+
$methods[] = $class_name;
|
371 |
+
}
|
372 |
+
return $methods;
|
373 |
+
}
|
374 |
+
add_filter( 'woocommerce_payment_gateways', 'add_wc_gateway_wcj_custom_classes' ); */
|
375 |
}
|
includes/input-fields/class-wcj-product-input-fields-abstract.php
CHANGED
@@ -4,10 +4,8 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Input Fields abstract class.
|
6 |
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @category Class
|
10 |
-
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
@@ -47,6 +45,7 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
47 |
'textarea' => __( 'Textarea', 'woocommerce-jetpack' ),
|
48 |
'number' => __( 'Number', 'woocommerce-jetpack' ),
|
49 |
'checkbox' => __( 'Checkbox', 'woocommerce-jetpack' ),
|
|
|
50 |
),
|
51 |
),
|
52 |
|
@@ -75,6 +74,15 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
75 |
'default' => __( 'No', 'woocommerce-jetpack' ),
|
76 |
),
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
array(
|
79 |
'id' => 'wcj_product_input_fields_required_' . $this->scope . '_',
|
80 |
'title' => __( 'Required', 'woocommerce-jetpack' ),
|
@@ -135,6 +143,22 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
135 |
|
136 |
$the_value = isset( $item[ 'wcj_product_input_fields_' . $this->scope . '_' . $i ] ) ? $item[ 'wcj_product_input_fields_' . $this->scope . '_' . $i ] : '';
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
if ( '' != $the_value ) {
|
139 |
echo '<tr><th>' . $the_nice_name . ':</th><td>' . $the_value . '</td></tr>';
|
140 |
}
|
@@ -249,21 +273,44 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
249 |
}
|
250 |
|
251 |
$type = $this->get_value( 'wcj_product_input_fields_type_' . $this->scope . '_' . $i, $product_id, '' );
|
|
|
252 |
|
253 |
-
if ( 'checkbox' === $type && ! isset( $_POST[
|
254 |
-
$_POST[
|
255 |
}
|
256 |
|
257 |
$is_required = $this->get_value( 'wcj_product_input_fields_required_' . $this->scope . '_' . $i, $product_id, 'no' );
|
258 |
-
if (
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
}
|
266 |
}
|
|
|
267 |
return $passed;
|
268 |
}
|
269 |
|
@@ -284,15 +331,20 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
284 |
$title = $this->get_value( 'wcj_product_input_fields_title_' . $this->scope . '_' . $i, $product->id, '' );
|
285 |
$placeholder = $this->get_value( 'wcj_product_input_fields_placeholder_' . $this->scope . '_' . $i, $product->id, '' );
|
286 |
|
|
|
|
|
|
|
|
|
287 |
if ( 'on' === $is_enabled || 'yes' === $is_enabled ) {
|
288 |
switch ( $type ) {
|
289 |
case 'number':
|
290 |
case 'text':
|
291 |
case 'checkbox':
|
292 |
-
|
|
|
293 |
break;
|
294 |
case 'textarea':
|
295 |
-
echo '<p>' . $title . '<textarea name="
|
296 |
break;
|
297 |
}
|
298 |
}
|
@@ -306,8 +358,20 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
306 |
public function add_product_input_fields_to_cart_item_data( $cart_item_data, $product_id, $variation_id ) {
|
307 |
$total_number = apply_filters( 'wcj_get_option_filter', 1, $this->get_value( 'wcj_' . 'product_input_fields' . '_' . $this->scope . '_total_number', $product_id, 1 ) );
|
308 |
for ( $i = 1; $i <= $total_number; $i++ ) {
|
309 |
-
|
310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
}
|
312 |
return $cart_item_data;
|
313 |
}
|
@@ -359,6 +423,11 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
359 |
$value = ( 'on' === $value ) ? $yes_value : $no_value;
|
360 |
}
|
361 |
|
|
|
|
|
|
|
|
|
|
|
362 |
$name .= '<dt>'
|
363 |
. $title
|
364 |
. '</dt>'
|
@@ -385,8 +454,35 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
385 |
public function add_product_input_fields_to_order_item_meta( $item_id, $values, $cart_item_key ) {
|
386 |
$total_number = apply_filters( 'wcj_get_option_filter', 1, $this->get_value( 'wcj_' . 'product_input_fields' . '_' . $this->scope . '_total_number', $values['product_id'], 1 ) );
|
387 |
for ( $i = 1; $i <= $total_number; $i++ ) {
|
388 |
-
if ( array_key_exists( 'wcj_product_input_fields_' . $this->scope . '_' . $i , $values ) )
|
389 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
}
|
391 |
}
|
392 |
}
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Input Fields abstract class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
+
* @author Algoritmika Ltd.
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
45 |
'textarea' => __( 'Textarea', 'woocommerce-jetpack' ),
|
46 |
'number' => __( 'Number', 'woocommerce-jetpack' ),
|
47 |
'checkbox' => __( 'Checkbox', 'woocommerce-jetpack' ),
|
48 |
+
'file' => __( 'File', 'woocommerce-jetpack' ),
|
49 |
),
|
50 |
),
|
51 |
|
74 |
'default' => __( 'No', 'woocommerce-jetpack' ),
|
75 |
),
|
76 |
|
77 |
+
// TODO: http://www.w3schools.com/tags/att_input_accept.asp
|
78 |
+
array(
|
79 |
+
'id' => 'wcj_product_input_fields_type_file_accept_' . $this->scope . '_',
|
80 |
+
'title' => __( 'If file is selected, set accepted file types here. E.g.: ".jpg,.jpeg,.png". Leave blank to accept all files', 'woocommerce-jetpack' ),
|
81 |
+
'short_title' => __( 'File: Accepted types', 'woocommerce-jetpack' ),
|
82 |
+
'type' => 'text',
|
83 |
+
'default' => __( '.jpg,.jpeg,.png', 'woocommerce-jetpack' ),
|
84 |
+
),
|
85 |
+
|
86 |
array(
|
87 |
'id' => 'wcj_product_input_fields_required_' . $this->scope . '_',
|
88 |
'title' => __( 'Required', 'woocommerce-jetpack' ),
|
143 |
|
144 |
$the_value = isset( $item[ 'wcj_product_input_fields_' . $this->scope . '_' . $i ] ) ? $item[ 'wcj_product_input_fields_' . $this->scope . '_' . $i ] : '';
|
145 |
|
146 |
+
$type = $this->get_value( 'wcj_product_input_fields_type_' . $this->scope . '_' . $i, $_product->id, '' );
|
147 |
+
if ( 'file' === $type ) {
|
148 |
+
/* $file_name = $the_value;
|
149 |
+
$upload_dir = wp_upload_dir();
|
150 |
+
$upload_url = $upload_dir['baseurl'];
|
151 |
+
$the_value = $upload_url . '/woocommerce_uploads/' . $file_name;
|
152 |
+
//$the_value = $upload_url . '/' . $the_value;
|
153 |
+
//$the_value = '<img style="width:50px;" src="' . $the_value . '">'; */
|
154 |
+
$the_value = maybe_unserialize( $the_value );
|
155 |
+
$the_value = '<a href="' . add_query_arg( 'wcj_download_file', $item_id . '.' . pathinfo( $the_value['name'], PATHINFO_EXTENSION ) ) . '">' . $the_value['name'] . '</a>';
|
156 |
+
} else {
|
157 |
+
if ( 'no' === get_option( 'wcj_product_input_fields_make_nicer_name_enabled' ) ) {
|
158 |
+
continue;
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
if ( '' != $the_value ) {
|
163 |
echo '<tr><th>' . $the_nice_name . ':</th><td>' . $the_value . '</td></tr>';
|
164 |
}
|
273 |
}
|
274 |
|
275 |
$type = $this->get_value( 'wcj_product_input_fields_type_' . $this->scope . '_' . $i, $product_id, '' );
|
276 |
+
$field_name = 'wcj_product_input_fields_' . $this->scope . '_' . $i;
|
277 |
|
278 |
+
if ( 'checkbox' === $type && ! isset( $_POST[ $field_name ] ) ) {
|
279 |
+
$_POST[ $field_name ] = 'off';
|
280 |
}
|
281 |
|
282 |
$is_required = $this->get_value( 'wcj_product_input_fields_required_' . $this->scope . '_' . $i, $product_id, 'no' );
|
283 |
+
if ( 'on' === $is_required || 'yes' === $is_required ) {
|
284 |
+
if ( 'file' === $type ) {
|
285 |
+
$field_value = ( isset( $_FILES[ $field_name ]['name'] ) ) ? $_FILES[ $field_name ]['name'] : '';
|
286 |
+
} else {
|
287 |
+
$field_value = ( isset( $_POST[ $field_name ] ) ) ? $_POST[ $field_name ] : '';
|
288 |
+
if ( 'checkbox' === $type && 'off' === $field_value ) {
|
289 |
+
$field_value = '';
|
290 |
+
}
|
291 |
+
}
|
292 |
+
if ( '' == $field_value ) {
|
293 |
+
$passed = false;
|
294 |
+
wc_add_notice( $this->get_value( 'wcj_product_input_fields_required_message_' . $this->scope . '_' . $i, $product_id, '' ), 'error' );
|
295 |
+
}
|
296 |
+
}
|
297 |
+
|
298 |
+
|
299 |
+
if ( 'file' === $type && '' != $_FILES[ $field_name ]['name'] ) {
|
300 |
+
// Validate file type
|
301 |
+
$file_accept = $this->get_value( 'wcj_product_input_fields_type_file_accept_' . $this->scope . '_' . $i, $product_id, '' );
|
302 |
+
$file_accept = explode( ',', $file_accept );
|
303 |
+
if ( is_array( $file_accept ) && ! empty( $file_accept ) ) {
|
304 |
+
$file_type = '.' . pathinfo( $_FILES[ $field_name ]['name'], PATHINFO_EXTENSION );
|
305 |
+
if ( ! in_array( $file_type, $file_accept ) ) {
|
306 |
+
$passed = false;
|
307 |
+
wc_add_notice( __( 'Wrong file type!', 'woocommerce-jetpack' ), 'error' );
|
308 |
+
//wc_add_notice( $this->get_value( 'wcj_product_input_fields_wrong_file_type_msg_' . $this->scope . '_' . $i, $product_id, '' ), 'error' );
|
309 |
+
}
|
310 |
+
}
|
311 |
}
|
312 |
}
|
313 |
+
|
314 |
return $passed;
|
315 |
}
|
316 |
|
331 |
$title = $this->get_value( 'wcj_product_input_fields_title_' . $this->scope . '_' . $i, $product->id, '' );
|
332 |
$placeholder = $this->get_value( 'wcj_product_input_fields_placeholder_' . $this->scope . '_' . $i, $product->id, '' );
|
333 |
|
334 |
+
$file_accept = $this->get_value( 'wcj_product_input_fields_type_file_accept_' . $this->scope . '_' . $i, $product->id, '' );
|
335 |
+
$custom_attributes = ( 'file' === $type ) ? ' accept="' . $file_accept . '"' : '';
|
336 |
+
$field_name = 'wcj_product_input_fields_' . $this->scope . '_' . $i;
|
337 |
+
|
338 |
if ( 'on' === $is_enabled || 'yes' === $is_enabled ) {
|
339 |
switch ( $type ) {
|
340 |
case 'number':
|
341 |
case 'text':
|
342 |
case 'checkbox':
|
343 |
+
case 'file':
|
344 |
+
echo '<p>' . $title . '<input type="' . $type . '" name="' . $field_name . '" placeholder="' . $placeholder . '"' . $custom_attributes . '>' . '</p>';
|
345 |
break;
|
346 |
case 'textarea':
|
347 |
+
echo '<p>' . $title . '<textarea name="' . $field_name . '" placeholder="' . $placeholder . '">' . '</textarea>' . '</p>';
|
348 |
break;
|
349 |
}
|
350 |
}
|
358 |
public function add_product_input_fields_to_cart_item_data( $cart_item_data, $product_id, $variation_id ) {
|
359 |
$total_number = apply_filters( 'wcj_get_option_filter', 1, $this->get_value( 'wcj_' . 'product_input_fields' . '_' . $this->scope . '_total_number', $product_id, 1 ) );
|
360 |
for ( $i = 1; $i <= $total_number; $i++ ) {
|
361 |
+
$type = $this->get_value( 'wcj_product_input_fields_type_' . $this->scope . '_' . $i, $product_id, '' );
|
362 |
+
$value_name = 'wcj_product_input_fields_' . $this->scope . '_' . $i;
|
363 |
+
if ( 'file' === $type ) {
|
364 |
+
if ( isset( $_FILES[ $value_name ] ) ) {
|
365 |
+
$cart_item_data[ $value_name ] = $_FILES[ $value_name ];
|
366 |
+
$tmp_dest_file = tempnam( sys_get_temp_dir(), 'wcj' );
|
367 |
+
move_uploaded_file( $cart_item_data[ $value_name ]['tmp_name'], $tmp_dest_file );
|
368 |
+
$cart_item_data[ $value_name ]['tmp_name'] = $tmp_dest_file;
|
369 |
+
}
|
370 |
+
} else {
|
371 |
+
if ( isset( $_POST[ $value_name ] ) ) {
|
372 |
+
$cart_item_data[ $value_name ] = $_POST[ $value_name ];
|
373 |
+
}
|
374 |
+
}
|
375 |
}
|
376 |
return $cart_item_data;
|
377 |
}
|
423 |
$value = ( 'on' === $value ) ? $yes_value : $no_value;
|
424 |
}
|
425 |
|
426 |
+
if ( 'file' === $type ) {
|
427 |
+
$value = maybe_unserialize( $value );
|
428 |
+
$value = $value['name'];
|
429 |
+
}
|
430 |
+
|
431 |
$name .= '<dt>'
|
432 |
. $title
|
433 |
. '</dt>'
|
454 |
public function add_product_input_fields_to_order_item_meta( $item_id, $values, $cart_item_key ) {
|
455 |
$total_number = apply_filters( 'wcj_get_option_filter', 1, $this->get_value( 'wcj_' . 'product_input_fields' . '_' . $this->scope . '_total_number', $values['product_id'], 1 ) );
|
456 |
for ( $i = 1; $i <= $total_number; $i++ ) {
|
457 |
+
if ( array_key_exists( 'wcj_product_input_fields_' . $this->scope . '_' . $i , $values ) ) {
|
458 |
+
$type = $this->get_value( 'wcj_product_input_fields_type_' . $this->scope . '_' . $i, $values['product_id'], '' );
|
459 |
+
$input_field_value = $values[ 'wcj_product_input_fields_' . $this->scope . '_' . $i ];
|
460 |
+
|
461 |
+
if ( 'file' === $type ) {
|
462 |
+
$tmp_name = $input_field_value['tmp_name'];
|
463 |
+
$ext = pathinfo( $input_field_value['name'], PATHINFO_EXTENSION );
|
464 |
+
$name = $item_id . '.' . $ext;//$input_field_value['name'];
|
465 |
+
$upload_dir = wcj_get_wcj_uploads_dir( 'input_fields_uploads' );
|
466 |
+
if ( ! file_exists( $upload_dir ) ) {
|
467 |
+
mkdir( $upload_dir, 0755, true );
|
468 |
+
}
|
469 |
+
//$upload_dir = ( wp_mkdir_p( $upload_dir['path'] ) ) ? $upload_dir['path'] : $upload_dir['basedir'];
|
470 |
+
$upload_dir_and_name = $upload_dir . '/' . $name;
|
471 |
+
//move_uploaded_file( $tmp_name, $upload_dir_and_name );
|
472 |
+
$file_data = file_get_contents( $tmp_name );
|
473 |
+
file_put_contents( $upload_dir_and_name, $file_data );
|
474 |
+
unlink( $tmp_name );
|
475 |
+
//unset( $input_field_value['tmp_name'] );
|
476 |
+
$input_field_value['tmp_name'] = $upload_dir_and_name;
|
477 |
+
$input_field_value['wcj_type'] = 'file';
|
478 |
+
//$orig_file_name = $input_field_value['name'];
|
479 |
+
//wc_add_order_item_meta( $item_id, '_wcj_product_input_fields_' . $this->scope . '_' . $i . '_orig_file_name', $orig_file_name );
|
480 |
+
//$input_field_value = '<a href="' . add_query_arg( 'wcj_download_file', $name ) . '">' . $orig_file_name . '</a>';
|
481 |
+
//$input_field_value = $orig_file_name;
|
482 |
+
}
|
483 |
+
|
484 |
+
wc_add_order_item_meta( $item_id, '_wcj_product_input_fields_' . $this->scope . '_' . $i, $input_field_value );
|
485 |
+
}
|
486 |
}
|
487 |
}
|
488 |
}
|
includes/input-fields/class-wcj-product-input-fields-global.php
CHANGED
@@ -4,10 +4,8 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Input Fields Global class.
|
6 |
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @category Class
|
10 |
-
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
@@ -46,8 +44,9 @@ class WCJ_Product_Input_Fields_Global extends WCJ_Product_Input_Fields_Abstract
|
|
46 |
//add_action( 'woocommerce_before_order_itemmeta', array( $this, 'start_making_nicer_name_for_product_input_fields' ), 100, 3 );
|
47 |
//add_action( 'woocommerce_before_order_itemmeta', 'ob_start' );
|
48 |
//add_action( 'woocommerce_after_order_itemmeta', array( $this, 'finish_making_nicer_name_for_product_input_fields' ), 100, 3 );
|
|
|
49 |
if ( 'yes' === get_option( 'wcj_product_input_fields_make_nicer_name_enabled' ) ) {
|
50 |
-
|
51 |
add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'hide_custom_input_fields_default_output_in_admin_order' ), 100 );
|
52 |
}
|
53 |
//add_filter( 'woocommerce_attribute_label', array( $this, 'change_woocommerce_attribute_label' ), PHP_INT_MAX, 2 );
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Input Fields Global class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
+
* @author Algoritmika Ltd.
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
44 |
//add_action( 'woocommerce_before_order_itemmeta', array( $this, 'start_making_nicer_name_for_product_input_fields' ), 100, 3 );
|
45 |
//add_action( 'woocommerce_before_order_itemmeta', 'ob_start' );
|
46 |
//add_action( 'woocommerce_after_order_itemmeta', array( $this, 'finish_making_nicer_name_for_product_input_fields' ), 100, 3 );
|
47 |
+
add_action( 'woocommerce_after_order_itemmeta', array( $this, 'output_custom_input_fields_in_admin_order' ), 100, 3 );
|
48 |
if ( 'yes' === get_option( 'wcj_product_input_fields_make_nicer_name_enabled' ) ) {
|
49 |
+
|
50 |
add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'hide_custom_input_fields_default_output_in_admin_order' ), 100 );
|
51 |
}
|
52 |
//add_filter( 'woocommerce_attribute_label', array( $this, 'change_woocommerce_attribute_label' ), PHP_INT_MAX, 2 );
|
includes/input-fields/class-wcj-product-input-fields-per-product.php
CHANGED
@@ -4,10 +4,8 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Input Fields per Product class.
|
6 |
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @category Class
|
10 |
-
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
@@ -50,8 +48,9 @@ class WCJ_Product_Input_Fields_Per_Product extends WCJ_Product_Input_Fields_Abst
|
|
50 |
//add_action( 'woocommerce_before_order_itemmeta', array( $this, 'start_making_nicer_name_for_product_input_fields' ), 100, 3 );
|
51 |
//add_action( 'woocommerce_before_order_itemmeta', 'ob_start' );
|
52 |
//add_action( 'woocommerce_after_order_itemmeta', array( $this, 'finish_making_nicer_name_for_product_input_fields' ), 100, 3 );
|
|
|
53 |
if ( 'yes' === get_option( 'wcj_product_input_fields_make_nicer_name_enabled' ) ) {
|
54 |
-
|
55 |
add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'hide_custom_input_fields_default_output_in_admin_order' ), 100 );
|
56 |
}
|
57 |
//add_filter( 'woocommerce_attribute_label', array( $this, 'change_woocommerce_attribute_label' ), PHP_INT_MAX, 2 );
|
@@ -150,7 +149,7 @@ class WCJ_Product_Input_Fields_Per_Product extends WCJ_Product_Input_Fields_Abst
|
|
150 |
foreach ( $options as $option ) {
|
151 |
$option_id = $option['id'] . $i;
|
152 |
$option_value = get_post_meta( $current_post_id, '_' . $option_id, true );
|
153 |
-
|
154 |
if ( ! metadata_exists( 'post', $current_post_id, '_' . $option_id ) ) {
|
155 |
$option_value = $option['default'];
|
156 |
}
|
@@ -158,7 +157,7 @@ class WCJ_Product_Input_Fields_Per_Product extends WCJ_Product_Input_Fields_Abst
|
|
158 |
$html .= '<th>';
|
159 |
$html .= ( isset( $option['short_title'] ) ) ? $option['short_title'] : $option['title'];
|
160 |
$html .= '</th>';
|
161 |
-
|
162 |
if ( 'textarea' === $option['type'] )
|
163 |
$html .= '<td style="width:20%;">';
|
164 |
else
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Input Fields per Product class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
+
* @author Algoritmika Ltd.
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
48 |
//add_action( 'woocommerce_before_order_itemmeta', array( $this, 'start_making_nicer_name_for_product_input_fields' ), 100, 3 );
|
49 |
//add_action( 'woocommerce_before_order_itemmeta', 'ob_start' );
|
50 |
//add_action( 'woocommerce_after_order_itemmeta', array( $this, 'finish_making_nicer_name_for_product_input_fields' ), 100, 3 );
|
51 |
+
add_action( 'woocommerce_after_order_itemmeta', array( $this, 'output_custom_input_fields_in_admin_order' ), 100, 3 );
|
52 |
if ( 'yes' === get_option( 'wcj_product_input_fields_make_nicer_name_enabled' ) ) {
|
53 |
+
|
54 |
add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'hide_custom_input_fields_default_output_in_admin_order' ), 100 );
|
55 |
}
|
56 |
//add_filter( 'woocommerce_attribute_label', array( $this, 'change_woocommerce_attribute_label' ), PHP_INT_MAX, 2 );
|
149 |
foreach ( $options as $option ) {
|
150 |
$option_id = $option['id'] . $i;
|
151 |
$option_value = get_post_meta( $current_post_id, '_' . $option_id, true );
|
152 |
+
|
153 |
if ( ! metadata_exists( 'post', $current_post_id, '_' . $option_id ) ) {
|
154 |
$option_value = $option['default'];
|
155 |
}
|
157 |
$html .= '<th>';
|
158 |
$html .= ( isset( $option['short_title'] ) ) ? $option['short_title'] : $option['title'];
|
159 |
$html .= '</th>';
|
160 |
+
|
161 |
if ( 'textarea' === $option['type'] )
|
162 |
$html .= '<td style="width:20%;">';
|
163 |
else
|
includes/lib/tcpdf_min/include/tcpdf_fonts.php
CHANGED
@@ -357,7 +357,10 @@ class TCPDF_FONTS {
|
|
357 |
if ($fmetric['type'] != 'cidfont0') {
|
358 |
if ($link) {
|
359 |
// creates a symbolic link to the existing font
|
360 |
-
|
|
|
|
|
|
|
361 |
} else {
|
362 |
// store compressed font
|
363 |
$fmetric['file'] .= '.z';
|
357 |
if ($fmetric['type'] != 'cidfont0') {
|
358 |
if ($link) {
|
359 |
// creates a symbolic link to the existing font
|
360 |
+
// WooJetpack modification v.2.2.2
|
361 |
+
$func_name = 'symlink';
|
362 |
+
$func_name($fontfile, $outpath.$fmetric['file']);
|
363 |
+
// WooJetpack modification ends here
|
364 |
} else {
|
365 |
// store compressed font
|
366 |
$fmetric['file'] .= '.z';
|
includes/pdf-invoices/settings/class-wcj-pdf-invoicing-display.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Display class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -69,7 +69,6 @@ class WCJ_PDF_Invoicing_Display {
|
|
69 |
return;
|
70 |
|
71 |
$the_invoice = wcj_get_invoice( $order_id, $invoice_type_id );
|
72 |
-
//$the_number = $the_invoice->get_invoice_full_number();
|
73 |
$the_number = $the_invoice->get_invoice_number();
|
74 |
//$the_url = $the_invoice->get_invoice_url();
|
75 |
//$the_link = $the_invoice->get_invoice_link();
|
@@ -179,7 +178,7 @@ class WCJ_PDF_Invoicing_Display {
|
|
179 |
'desc_tip' => __( 'Enable "save as" pdf instead of view pdf in browser', 'woocommerce-jetpack' ),
|
180 |
//'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
181 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_save_as_enabled',
|
182 |
-
'default' => '
|
183 |
'type' => 'checkbox',
|
184 |
//'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
185 |
),
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Display class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
69 |
return;
|
70 |
|
71 |
$the_invoice = wcj_get_invoice( $order_id, $invoice_type_id );
|
|
|
72 |
$the_number = $the_invoice->get_invoice_number();
|
73 |
//$the_url = $the_invoice->get_invoice_url();
|
74 |
//$the_link = $the_invoice->get_invoice_link();
|
178 |
'desc_tip' => __( 'Enable "save as" pdf instead of view pdf in browser', 'woocommerce-jetpack' ),
|
179 |
//'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
180 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_save_as_enabled',
|
181 |
+
'default' => 'yes',
|
182 |
'type' => 'checkbox',
|
183 |
//'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
|
184 |
),
|
includes/pdf-invoices/settings/class-wcj-pdf-invoicing-emails.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Emails class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -14,10 +14,10 @@ if ( ! class_exists( 'WCJ_PDF_Invoicing_Emails' ) ) :
|
|
14 |
|
15 |
class WCJ_PDF_Invoicing_Emails extends WCJ_Module {
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
|
22 |
$this->id = 'pdf_invoicing_emails';
|
23 |
$this->parent_id = 'pdf_invoicing';
|
@@ -25,17 +25,27 @@ class WCJ_PDF_Invoicing_Emails extends WCJ_Module {
|
|
25 |
$this->desc = '';
|
26 |
parent::__construct( 'submodule' );
|
27 |
|
28 |
-
|
|
|
29 |
if ( $this->is_enabled() ) {
|
30 |
add_filter( 'woocommerce_email_attachments', array( $this, 'add_pdf_invoice_email_attachment' ), PHP_INT_MAX, 3 );
|
31 |
}
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
/**
|
35 |
* do_attach_for_payment_method.
|
36 |
-
|
37 |
-
function do_attach_for_payment_method( $payment_method ) {
|
38 |
-
|
|
|
|
|
39 |
}
|
40 |
|
41 |
/**
|
@@ -44,26 +54,50 @@ class WCJ_PDF_Invoicing_Emails extends WCJ_Module {
|
|
44 |
function add_pdf_invoice_email_attachment( $attachments, $status, $order ) {
|
45 |
$invoice_types_ids = wcj_get_enabled_invoice_types_ids();
|
46 |
foreach ( $invoice_types_ids as $invoice_type_id ) {
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
}
|
58 |
}
|
|
|
59 |
}
|
60 |
return $attachments;
|
61 |
}
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
$settings = array();
|
69 |
$invoice_types = wcj_get_invoice_types();
|
@@ -93,13 +127,15 @@ class WCJ_PDF_Invoicing_Emails extends WCJ_Module {
|
|
93 |
)
|
94 |
);
|
95 |
|
|
|
|
|
96 |
$settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_emails_options' );
|
97 |
}
|
98 |
|
99 |
-
|
100 |
-
|
101 |
}
|
102 |
|
103 |
endif;
|
104 |
|
105 |
-
return new WCJ_PDF_Invoicing_Emails();
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Emails class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
14 |
|
15 |
class WCJ_PDF_Invoicing_Emails extends WCJ_Module {
|
16 |
|
17 |
+
/**
|
18 |
+
* Constructor.
|
19 |
+
*/
|
20 |
+
function __construct() {
|
21 |
|
22 |
$this->id = 'pdf_invoicing_emails';
|
23 |
$this->parent_id = 'pdf_invoicing';
|
25 |
$this->desc = '';
|
26 |
parent::__construct( 'submodule' );
|
27 |
|
28 |
+
add_filter( 'init', array( $this, 'add_hooks' ) );
|
29 |
+
|
30 |
if ( $this->is_enabled() ) {
|
31 |
add_filter( 'woocommerce_email_attachments', array( $this, 'add_pdf_invoice_email_attachment' ), PHP_INT_MAX, 3 );
|
32 |
}
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* add_hooks.
|
37 |
+
*/
|
38 |
+
function add_hooks() {
|
39 |
+
add_filter( 'wcj_pdf_invoicing_emails_settings', array( $this, 'add_payment_gateways_pdf_invoicing_emails_settings' ), PHP_INT_MAX, 2 );
|
40 |
+
}
|
41 |
|
42 |
/**
|
43 |
* do_attach_for_payment_method.
|
44 |
+
*/
|
45 |
+
function do_attach_for_payment_method( $invoice_type_id, $payment_method ) {
|
46 |
+
$included_gateways = get_option( 'wcj_invoicing_' . $invoice_type_id . '_payment_gateways', array() );
|
47 |
+
if ( empty ( $included_gateways ) ) return true; // include all
|
48 |
+
return ( in_array( $payment_method, $included_gateways ) ) ? true : false;
|
49 |
}
|
50 |
|
51 |
/**
|
54 |
function add_pdf_invoice_email_attachment( $attachments, $status, $order ) {
|
55 |
$invoice_types_ids = wcj_get_enabled_invoice_types_ids();
|
56 |
foreach ( $invoice_types_ids as $invoice_type_id ) {
|
57 |
+
if ( false === $this->do_attach_for_payment_method( $invoice_type_id, $order->payment_method ) ) {
|
58 |
+
continue;
|
59 |
+
}
|
60 |
+
$send_on_statuses = get_option( 'wcj_invoicing_' . $invoice_type_id . '_attach_to_emails', array() );
|
61 |
+
if ( '' == $send_on_statuses ) $send_on_statuses = array();
|
62 |
+
if ( in_array( $status, $send_on_statuses ) ) {
|
63 |
+
$the_invoice = wcj_get_pdf_invoice( $order->id, $invoice_type_id );
|
64 |
+
$file_name = $the_invoice->get_pdf( 'F' );
|
65 |
+
if ( '' != $file_name ) {
|
66 |
+
$attachments[] = $file_name;
|
|
|
67 |
}
|
68 |
+
}
|
69 |
}
|
70 |
return $attachments;
|
71 |
}
|
72 |
|
73 |
+
/**
|
74 |
+
* add_payment_gateways_pdf_invoicing_emails_settings.
|
75 |
+
*/
|
76 |
+
function add_payment_gateways_pdf_invoicing_emails_settings( $settings, $invoice_type_id ) {
|
77 |
+
global $woocommerce;
|
78 |
+
$available_gateways = $woocommerce->payment_gateways->payment_gateways();
|
79 |
+
foreach ( $available_gateways as $key => $gateway ) {
|
80 |
+
$available_gateways_options_array[ $key ] = $gateway->title;
|
81 |
+
}
|
82 |
+
$settings[] = array(
|
83 |
+
'title' => __( 'Payment gateways to include', 'woocommerce' ),
|
84 |
+
'id' => 'wcj_invoicing_' . $invoice_type_id . '_payment_gateways',
|
85 |
+
'type' => 'multiselect',
|
86 |
+
'class' => 'chosen_select',
|
87 |
+
'css' => 'width: 450px;',
|
88 |
+
'default' => '',
|
89 |
+
'options' => $available_gateways_options_array,
|
90 |
+
'custom_attributes' => array(
|
91 |
+
'data-placeholder' => __( 'Select some gateways. Leave blank to include all.', 'woocommerce-jetpack' )
|
92 |
+
)
|
93 |
+
);
|
94 |
+
return $settings;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* get_settings.
|
99 |
+
*/
|
100 |
+
function get_settings() {
|
101 |
|
102 |
$settings = array();
|
103 |
$invoice_types = wcj_get_invoice_types();
|
127 |
)
|
128 |
);
|
129 |
|
130 |
+
$settings = apply_filters( 'wcj_pdf_invoicing_emails_settings', $settings, $invoice_type['id'] );
|
131 |
+
|
132 |
$settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_emails_options' );
|
133 |
}
|
134 |
|
135 |
+
return $settings;
|
136 |
+
}
|
137 |
}
|
138 |
|
139 |
endif;
|
140 |
|
141 |
+
return new WCJ_PDF_Invoicing_Emails();
|
includes/pdf-invoices/settings/class-wcj-pdf-invoicing-numbering.php
CHANGED
@@ -4,18 +4,16 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoices Numbering class.
|
6 |
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @category Class
|
10 |
-
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
-
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
-
|
15 |
if ( ! class_exists( 'WCJ_PDF_Invoicing_Numbering' ) ) :
|
16 |
-
|
17 |
class WCJ_PDF_Invoicing_Numbering {
|
18 |
-
|
19 |
/**
|
20 |
* Constructor.
|
21 |
*/
|
@@ -24,23 +22,23 @@ class WCJ_PDF_Invoicing_Numbering {
|
|
24 |
add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
|
25 |
add_filter( 'wcj_settings_pdf_invoicing_numbering', array( $this, 'get_settings' ), 100 );
|
26 |
}
|
27 |
-
|
28 |
/**
|
29 |
* get_settings.
|
30 |
-
*/
|
31 |
function get_settings() {
|
32 |
-
|
33 |
-
$settings = array();
|
34 |
$invoice_types = wcj_get_invoice_types();
|
35 |
-
foreach ( $invoice_types as $invoice_type ) {
|
36 |
-
|
37 |
-
$settings[] = array( 'title' => strtoupper( $invoice_type['desc'] ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_numbering_options' );
|
38 |
$settings[] = array(
|
39 |
'title' => __( 'Sequential', 'woocommerce-jetpack' ),
|
40 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_sequential_enabled',
|
41 |
'default' => 'no',
|
42 |
'type' => 'checkbox',
|
43 |
-
);
|
44 |
$settings[] = array(
|
45 |
'title' => __( 'Counter', 'woocommerce-jetpack' ),
|
46 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_numbering_counter',
|
@@ -64,22 +62,22 @@ class WCJ_PDF_Invoicing_Numbering {
|
|
64 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_numbering_suffix',
|
65 |
'default' => '',
|
66 |
'type' => 'text',
|
67 |
-
);
|
68 |
-
$settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_numbering_options' );
|
69 |
-
}
|
70 |
-
|
71 |
return $settings;
|
72 |
}
|
73 |
-
|
74 |
/**
|
75 |
* settings_section.
|
76 |
*/
|
77 |
-
function settings_section( $sections ) {
|
78 |
-
$sections['pdf_invoicing_numbering'] = __( 'Numbering', 'woocommerce-jetpack' );
|
79 |
return $sections;
|
80 |
-
}
|
81 |
}
|
82 |
-
|
83 |
endif;
|
84 |
-
|
85 |
-
return new WCJ_PDF_Invoicing_Numbering();
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoices Numbering class.
|
6 |
*
|
7 |
+
* @version 2.1.0
|
8 |
+
* @author Algoritmika Ltd.
|
|
|
|
|
9 |
*/
|
10 |
+
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
if ( ! class_exists( 'WCJ_PDF_Invoicing_Numbering' ) ) :
|
14 |
+
|
15 |
class WCJ_PDF_Invoicing_Numbering {
|
16 |
+
|
17 |
/**
|
18 |
* Constructor.
|
19 |
*/
|
22 |
add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
|
23 |
add_filter( 'wcj_settings_pdf_invoicing_numbering', array( $this, 'get_settings' ), 100 );
|
24 |
}
|
25 |
+
|
26 |
/**
|
27 |
* get_settings.
|
28 |
+
*/
|
29 |
function get_settings() {
|
30 |
+
|
31 |
+
$settings = array();
|
32 |
$invoice_types = wcj_get_invoice_types();
|
33 |
+
foreach ( $invoice_types as $invoice_type ) {
|
34 |
+
|
35 |
+
$settings[] = array( 'title' => strtoupper( $invoice_type['desc'] ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_numbering_options' );
|
36 |
$settings[] = array(
|
37 |
'title' => __( 'Sequential', 'woocommerce-jetpack' ),
|
38 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_sequential_enabled',
|
39 |
'default' => 'no',
|
40 |
'type' => 'checkbox',
|
41 |
+
);
|
42 |
$settings[] = array(
|
43 |
'title' => __( 'Counter', 'woocommerce-jetpack' ),
|
44 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_numbering_counter',
|
62 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_numbering_suffix',
|
63 |
'default' => '',
|
64 |
'type' => 'text',
|
65 |
+
);
|
66 |
+
$settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_numbering_options' );
|
67 |
+
}
|
68 |
+
|
69 |
return $settings;
|
70 |
}
|
71 |
+
|
72 |
/**
|
73 |
* settings_section.
|
74 |
*/
|
75 |
+
function settings_section( $sections ) {
|
76 |
+
$sections['pdf_invoicing_numbering'] = __( 'Numbering', 'woocommerce-jetpack' );
|
77 |
return $sections;
|
78 |
+
}
|
79 |
}
|
80 |
+
|
81 |
endif;
|
82 |
+
|
83 |
+
return new WCJ_PDF_Invoicing_Numbering();
|
includes/price-by-country/class-wcj-price-by-country-core.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Price by Country Core class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -39,18 +39,21 @@ class WCJ_Price_by_Country_Core {
|
|
39 |
}
|
40 |
|
41 |
// Price hooks
|
42 |
-
add_filter( 'woocommerce_get_price',
|
43 |
-
add_filter( 'woocommerce_get_sale_price',
|
44 |
-
add_filter( 'woocommerce_get_regular_price',
|
45 |
-
// add_filter( '
|
46 |
-
add_filter( '
|
|
|
|
|
|
|
47 |
|
48 |
// Currency hooks
|
49 |
-
add_filter( 'woocommerce_currency_symbol',
|
50 |
-
add_filter( 'woocommerce_currency',
|
51 |
|
52 |
// Shipping
|
53 |
-
add_filter( 'woocommerce_package_rates',
|
54 |
|
55 |
// Country selection box
|
56 |
/* if ( 'by_user_selection' === get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
|
@@ -154,7 +157,7 @@ class WCJ_Price_by_Country_Core {
|
|
154 |
|
155 |
/**
|
156 |
* fix_variable_product_price_on_sale.
|
157 |
-
|
158 |
public function fix_variable_product_price_on_sale( $price, $product ) {
|
159 |
if ( $product->is_type( 'variable' ) ) {
|
160 |
if ( ! $product->is_on_sale() ) {
|
4 |
*
|
5 |
* The WooCommerce Jetpack Price by Country Core class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
39 |
}
|
40 |
|
41 |
// Price hooks
|
42 |
+
add_filter( 'woocommerce_get_price', array( $this, 'change_price_by_country' ), PHP_INT_MAX, 2 );
|
43 |
+
add_filter( 'woocommerce_get_sale_price', array( $this, 'change_price_by_country' ), PHP_INT_MAX, 2 );
|
44 |
+
add_filter( 'woocommerce_get_regular_price', array( $this, 'change_price_by_country' ), PHP_INT_MAX, 2 );
|
45 |
+
// add_filter( 'woocommerce_get_variation_price', array( $this, 'change_price_by_country' ), PHP_INT_MAX, 2 );
|
46 |
+
add_filter( 'woocommerce_get_variation_sale_price', array( $this, 'change_price_by_country' ), PHP_INT_MAX, 2 );
|
47 |
+
add_filter( 'woocommerce_get_variation_regular_price', array( $this, 'change_price_by_country' ), PHP_INT_MAX, 2 );
|
48 |
+
// add_filter( 'booking_form_calculated_booking_cost', array( $this, 'change_price_by_country' ), PHP_INT_MAX );
|
49 |
+
// add_filter( 'woocommerce_get_price_html', array( $this, 'fix_variable_product_price_on_sale' ), 10 , 2 );
|
50 |
|
51 |
// Currency hooks
|
52 |
+
add_filter( 'woocommerce_currency_symbol', array( $this, 'change_currency_symbol' ), PHP_INT_MAX, 2 );
|
53 |
+
add_filter( 'woocommerce_currency', array( $this, 'change_currency_code' ), PHP_INT_MAX, 1 );
|
54 |
|
55 |
// Shipping
|
56 |
+
add_filter( 'woocommerce_package_rates', array( $this, 'change_shipping_price_by_country' ), PHP_INT_MAX, 2 );
|
57 |
|
58 |
// Country selection box
|
59 |
/* if ( 'by_user_selection' === get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
|
157 |
|
158 |
/**
|
159 |
* fix_variable_product_price_on_sale.
|
160 |
+
*
|
161 |
public function fix_variable_product_price_on_sale( $price, $product ) {
|
162 |
if ( $product->is_type( 'variable' ) ) {
|
163 |
if ( ! $product->is_on_sale() ) {
|
includes/reports/wcj-class-reports-stock.php
CHANGED
@@ -4,10 +4,8 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Stock Reports class.
|
6 |
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @category Class
|
10 |
-
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
@@ -39,6 +37,13 @@ class WCJ_Reports_Stock {
|
|
39 |
. ' '
|
40 |
. __( 'Threshold for minimum stock is equal to half of the sales in selected days range.', 'woocommerce-jetpack' ),
|
41 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
);
|
43 |
$this->start_time = microtime( true );
|
44 |
$products_info = array();
|
@@ -48,7 +53,7 @@ class WCJ_Reports_Stock {
|
|
48 |
$this->gather_orders_data( $products_info );
|
49 |
//wp_reset_postdata();
|
50 |
$info = $this->get_stock_summary( $products_info );
|
51 |
-
if ( 'on_stock' === $this->report_id )
|
52 |
$this->sort_products_info( $products_info, 'stock_price' );
|
53 |
//if ( 'sales_up' === $this->report_id )
|
54 |
//$this->sort_products_info( $products_info, 'sales_in_period', $this->range_days );
|
@@ -281,6 +286,7 @@ class WCJ_Reports_Stock {
|
|
281 |
$html .= '<th>' . __( 'Price', 'woocommerce-jetpack' ) . '</th>';
|
282 |
$html .= '<th>' . __( 'Stock', 'woocommerce-jetpack' ) . '</th>';
|
283 |
$html .= '<th>' . __( 'Stock price', 'woocommerce-jetpack' ) . '</th>';
|
|
|
284 |
|
285 |
$html .= '<th class="wcj_report_table_sales_columns">' . __( 'Last sale', 'woocommerce-jetpack' ) . '</th>';
|
286 |
$html .= '<th class="wcj_report_table_sales_columns">' . sprintf( __( 'Sales in last %s days', 'woocommerce-jetpack' ), $this->range_days ) . '</th>';
|
@@ -296,13 +302,22 @@ class WCJ_Reports_Stock {
|
|
296 |
$product_counter = 0;
|
297 |
foreach ( $products_info as $product_info ) {
|
298 |
|
299 |
-
if (
|
300 |
-
|
|
|
301 |
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
|
307 |
$total_current_stock_price += $product_info['stock_price'];
|
308 |
$product_counter++;
|
@@ -318,6 +333,7 @@ class WCJ_Reports_Stock {
|
|
318 |
'<br><em>' . __( 'stock purchase price:', 'woocommerce-jetpack' ) . '</em>' . ' ' . wc_price( $product_info['purchase_price'] * $product_info['stock'] ) :
|
319 |
'';
|
320 |
$html .= '<td>' . wc_price( $product_info['stock_price'] ) . $purchase_stock_price_html . '</td>';
|
|
|
321 |
|
322 |
$html .= '<td class="wcj_report_table_sales_columns">';
|
323 |
if ( 0 == $product_info['last_sale'] ) $html .= __( 'No sales yet', 'woocommerce-jetpack' );
|
@@ -327,7 +343,7 @@ class WCJ_Reports_Stock {
|
|
327 |
$profit_html = ( $product_info['purchase_price'] > 0 && $product_info['sales_in_period'][ $this->range_days ] > 0 ) ?
|
328 |
'<br><em>' . __( 'profit:', 'woocommerce-jetpack' ) . '</em>' . ' '
|
329 |
. wc_price( ( $product_info['price'] - $product_info['purchase_price'] ) * $product_info['sales_in_period'][ $this->range_days ] ) :
|
330 |
-
'';
|
331 |
$html .= '<td class="wcj_report_table_sales_columns">' . $product_info['sales_in_period'][ $this->range_days ] . $profit_html . '</td>';
|
332 |
$html .= '<td class="wcj_report_table_sales_columns">' . $product_info['total_sales'] . '</td>';
|
333 |
|
@@ -362,4 +378,4 @@ class WCJ_Reports_Stock {
|
|
362 |
}
|
363 |
}
|
364 |
|
365 |
-
endif;
|
4 |
*
|
5 |
* The WooCommerce Jetpack Stock Reports class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
+
* @author Algoritmika Ltd.
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
37 |
. ' '
|
38 |
. __( 'Threshold for minimum stock is equal to half of the sales in selected days range.', 'woocommerce-jetpack' ),
|
39 |
),
|
40 |
+
'overstocked' => array(
|
41 |
+
'id' => 'overstocked',
|
42 |
+
'title' => __( 'Overstocked', 'woocommerce-jetpack' ),
|
43 |
+
'desc' => __( 'Report shows all products that are on stock, but have no sales in selected period. Only products added before the start date of selected period are accounted.', 'woocommerce-jetpack' )
|
44 |
+
. ' '
|
45 |
+
. __( '', 'woocommerce-jetpack' ),
|
46 |
+
),
|
47 |
);
|
48 |
$this->start_time = microtime( true );
|
49 |
$products_info = array();
|
53 |
$this->gather_orders_data( $products_info );
|
54 |
//wp_reset_postdata();
|
55 |
$info = $this->get_stock_summary( $products_info );
|
56 |
+
if ( 'on_stock' === $this->report_id || 'overstocked' === $this->report_id )
|
57 |
$this->sort_products_info( $products_info, 'stock_price' );
|
58 |
//if ( 'sales_up' === $this->report_id )
|
59 |
//$this->sort_products_info( $products_info, 'sales_in_period', $this->range_days );
|
286 |
$html .= '<th>' . __( 'Price', 'woocommerce-jetpack' ) . '</th>';
|
287 |
$html .= '<th>' . __( 'Stock', 'woocommerce-jetpack' ) . '</th>';
|
288 |
$html .= '<th>' . __( 'Stock price', 'woocommerce-jetpack' ) . '</th>';
|
289 |
+
$html .= '<th>' . __( 'Total stock price', 'woocommerce-jetpack' ) . '</th>';
|
290 |
|
291 |
$html .= '<th class="wcj_report_table_sales_columns">' . __( 'Last sale', 'woocommerce-jetpack' ) . '</th>';
|
292 |
$html .= '<th class="wcj_report_table_sales_columns">' . sprintf( __( 'Sales in last %s days', 'woocommerce-jetpack' ), $this->range_days ) . '</th>';
|
302 |
$product_counter = 0;
|
303 |
foreach ( $products_info as $product_info ) {
|
304 |
|
305 |
+
if (
|
306 |
+
( ( 'on_stock' === $report_info['id'] ) &&
|
307 |
+
( $product_info['stock'] != 0 ) ) ||
|
308 |
|
309 |
+
( ( 'overstocked' === $report_info['id'] ) &&
|
310 |
+
( $product_info['stock'] > 0 ) &&
|
311 |
+
//( $product_info['total_sales'] > 0 ) &&
|
312 |
+
( ( time() - strtotime( $product_info['date_added'] ) ) > $this->range_days * 24 * 60 * 60 ) &&
|
313 |
+
//( $product_info['sales_in_period'][ $this->range_days ] * 12 < $product_info['stock'] ) ) ||
|
314 |
+
( 0 === $product_info['sales_in_period'][ $this->range_days ] ) ) ||
|
315 |
+
|
316 |
+
( ( 'understocked' === $report_info['id'] ) &&
|
317 |
+
( '' !== $product_info['stock'] ) &&
|
318 |
+
( $product_info['sales_in_period'][ $this->range_days ] > 1 ) &&
|
319 |
+
( $product_info['stock'] < ( $product_info['sales_in_period'][ $this->range_days ] / 2 ) ) )
|
320 |
+
) {
|
321 |
|
322 |
$total_current_stock_price += $product_info['stock_price'];
|
323 |
$product_counter++;
|
333 |
'<br><em>' . __( 'stock purchase price:', 'woocommerce-jetpack' ) . '</em>' . ' ' . wc_price( $product_info['purchase_price'] * $product_info['stock'] ) :
|
334 |
'';
|
335 |
$html .= '<td>' . wc_price( $product_info['stock_price'] ) . $purchase_stock_price_html . '</td>';
|
336 |
+
$html .= '<td>' . wc_price( $total_current_stock_price ) . '</td>';
|
337 |
|
338 |
$html .= '<td class="wcj_report_table_sales_columns">';
|
339 |
if ( 0 == $product_info['last_sale'] ) $html .= __( 'No sales yet', 'woocommerce-jetpack' );
|
343 |
$profit_html = ( $product_info['purchase_price'] > 0 && $product_info['sales_in_period'][ $this->range_days ] > 0 ) ?
|
344 |
'<br><em>' . __( 'profit:', 'woocommerce-jetpack' ) . '</em>' . ' '
|
345 |
. wc_price( ( $product_info['price'] - $product_info['purchase_price'] ) * $product_info['sales_in_period'][ $this->range_days ] ) :
|
346 |
+
'';
|
347 |
$html .= '<td class="wcj_report_table_sales_columns">' . $product_info['sales_in_period'][ $this->range_days ] . $profit_html . '</td>';
|
348 |
$html .= '<td class="wcj_report_table_sales_columns">' . $product_info['total_sales'] . '</td>';
|
349 |
|
378 |
}
|
379 |
}
|
380 |
|
381 |
+
endif;
|
includes/shortcodes/class-wcj-order-items-shortcodes.php
CHANGED
@@ -103,8 +103,6 @@ class WCJ_Order_Items_Shortcodes extends WCJ_Shortcodes {
|
|
103 |
/* $order_total_incl_tax = $this->the_order->get_total();
|
104 |
$order_total_tax = $this->the_order->get_total_tax(); */
|
105 |
|
106 |
-
|
107 |
-
|
108 |
$order_total_incl_tax = 0;
|
109 |
$order_total_tax = 0;
|
110 |
$items = $this->the_order->get_items();
|
@@ -113,24 +111,10 @@ class WCJ_Order_Items_Shortcodes extends WCJ_Shortcodes {
|
|
113 |
$order_total_tax += $item['line_tax'];
|
114 |
}
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
if ( 0 != $order_total_incl_tax ) {
|
121 |
|
122 |
-
// $order_tax_rate = $order_total_tax / ( $order_total_incl_tax - $order_total_tax );
|
123 |
$order_tax_rate = $order_total_tax / $order_total_incl_tax;
|
124 |
-
|
125 |
-
|
126 |
-
$the_tax = $the_cart_discount * $order_tax_rate;//$the_cart_discount * $order_tax_rate;
|
127 |
-
|
128 |
-
/* wcj_log( $order_total_incl_tax );
|
129 |
-
wcj_log( $order_total_tax );
|
130 |
-
wcj_log( $order_tax_rate );
|
131 |
-
wcj_log( $the_tax );
|
132 |
-
wcj_log( $the_tax / ( $the_cart_discount - $the_tax) );
|
133 |
-
wcj_log( $order_total_tax / ( $order_total_incl_tax - $order_total_tax ) ); */
|
134 |
|
135 |
return $the_tax;
|
136 |
}
|
103 |
/* $order_total_incl_tax = $this->the_order->get_total();
|
104 |
$order_total_tax = $this->the_order->get_total_tax(); */
|
105 |
|
|
|
|
|
106 |
$order_total_incl_tax = 0;
|
107 |
$order_total_tax = 0;
|
108 |
$items = $this->the_order->get_items();
|
111 |
$order_total_tax += $item['line_tax'];
|
112 |
}
|
113 |
|
|
|
|
|
|
|
|
|
114 |
if ( 0 != $order_total_incl_tax ) {
|
115 |
|
|
|
116 |
$order_tax_rate = $order_total_tax / $order_total_incl_tax;
|
117 |
+
$the_tax = $the_cart_discount * $order_tax_rate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
return $the_tax;
|
120 |
}
|
includes/shortcodes/class-wcj-orders-shortcodes.php
CHANGED
@@ -4,10 +4,8 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Orders Shortcodes class.
|
6 |
*
|
7 |
-
* @
|
8 |
-
* @
|
9 |
-
* @category Class
|
10 |
-
* @author Algoritmika Ltd.
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
*
|
5 |
* The WooCommerce Jetpack Orders Shortcodes class.
|
6 |
*
|
7 |
+
* @version 2.2.0
|
8 |
+
* @author Algoritmika Ltd.
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
includes/shortcodes/class-wcj-products-shortcodes.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Products Shortcodes class.
|
6 |
*
|
7 |
-
* @version 2.2.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -35,15 +35,16 @@ class WCJ_Products_Shortcodes extends WCJ_Shortcodes {
|
|
35 |
);
|
36 |
|
37 |
$this->the_atts = array(
|
38 |
-
'product_id'
|
39 |
-
'image_size'
|
40 |
-
'multiply_by'
|
41 |
-
'hide_currency'
|
42 |
-
'excerpt_length'
|
43 |
-
'name'
|
44 |
-
'heading_format'
|
45 |
-
'sep'
|
46 |
-
'add_links'
|
|
|
47 |
);
|
48 |
|
49 |
parent::__construct();
|
@@ -77,7 +78,7 @@ class WCJ_Products_Shortcodes extends WCJ_Shortcodes {
|
|
77 |
*/
|
78 |
function wcj_product_purchase_price( $atts ) {
|
79 |
$purchase_price = wc_get_product_purchase_price( $the_product->id );
|
80 |
-
return wc_price( $purchase_price );
|
81 |
//return get_post_meta( $the_product->id, '_' . 'wcj_purchase_price', true );
|
82 |
}
|
83 |
|
@@ -185,14 +186,14 @@ class WCJ_Products_Shortcodes extends WCJ_Shortcodes {
|
|
185 |
|
186 |
for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_wholesale_price_levels_number', 1 ) ); $i++ ) {
|
187 |
$level_qty = get_option( 'wcj_wholesale_price_level_min_qty_' . $i, PHP_INT_MAX );
|
188 |
-
$discount_percent = get_option( 'wcj_wholesale_price_level_discount_percent_' . $i, 0 );
|
189 |
-
$discount_koef
|
190 |
-
$wholesale_price_levels[] = array( 'quantity' => $level_qty, 'koef' => $discount_koef, );
|
191 |
}
|
192 |
-
|
193 |
$data_qty = array();
|
194 |
$data_price = array();
|
195 |
-
|
196 |
foreach ( $wholesale_price_levels as $wholesale_price_level ) {
|
197 |
|
198 |
$the_price = '';
|
@@ -214,7 +215,6 @@ class WCJ_Products_Shortcodes extends WCJ_Shortcodes {
|
|
214 |
// Simple etc.
|
215 |
else {
|
216 |
//$the_price = wc_price( round( $this->the_product->get_price() * $wholesale_price_level['koef'], $precision ) );
|
217 |
-
|
218 |
$the_price = $this->the_product->get_price();
|
219 |
if ( '' !== $wholesale_price_level['koef'] && is_numeric( $wholesale_price_level['koef'] ) ) {
|
220 |
$the_price = $the_price * $wholesale_price_level['koef'];
|
@@ -222,17 +222,21 @@ class WCJ_Products_Shortcodes extends WCJ_Shortcodes {
|
|
222 |
if ( 'yes' !== $atts['hide_currency'] ) {
|
223 |
$the_price = wc_price( $the_price );
|
224 |
}
|
225 |
-
|
226 |
}
|
227 |
|
228 |
-
$data_qty[]
|
229 |
-
$data_price[]
|
|
|
|
|
|
|
230 |
}
|
231 |
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
|
|
|
|
236 |
}
|
237 |
|
238 |
/**
|
4 |
*
|
5 |
* The WooCommerce Jetpack Products Shortcodes class.
|
6 |
*
|
7 |
+
* @version 2.2.2
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
35 |
);
|
36 |
|
37 |
$this->the_atts = array(
|
38 |
+
'product_id' => 0,
|
39 |
+
'image_size' => 'shop_thumbnail',
|
40 |
+
'multiply_by' => '',
|
41 |
+
'hide_currency' => 'no',
|
42 |
+
'excerpt_length' => 0,
|
43 |
+
'name' => '',
|
44 |
+
'heading_format' => 'from %level_qty% pcs.',
|
45 |
+
'sep' => ', ',
|
46 |
+
'add_links' => 'yes',
|
47 |
+
'add_percent_row' => 'no',
|
48 |
);
|
49 |
|
50 |
parent::__construct();
|
78 |
*/
|
79 |
function wcj_product_purchase_price( $atts ) {
|
80 |
$purchase_price = wc_get_product_purchase_price( $the_product->id );
|
81 |
+
return wc_price( $purchase_price );
|
82 |
//return get_post_meta( $the_product->id, '_' . 'wcj_purchase_price', true );
|
83 |
}
|
84 |
|
186 |
|
187 |
for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_wholesale_price_levels_number', 1 ) ); $i++ ) {
|
188 |
$level_qty = get_option( 'wcj_wholesale_price_level_min_qty_' . $i, PHP_INT_MAX );
|
189 |
+
$discount_percent = get_option( 'wcj_wholesale_price_level_discount_percent_' . $i, 0 );
|
190 |
+
$discount_koef = 1.0 - ( $discount_percent / 100.0 );
|
191 |
+
$wholesale_price_levels[] = array( 'quantity' => $level_qty, 'koef' => $discount_koef, 'discount_percent' => $discount_percent, );
|
192 |
}
|
193 |
+
|
194 |
$data_qty = array();
|
195 |
$data_price = array();
|
196 |
+
|
197 |
foreach ( $wholesale_price_levels as $wholesale_price_level ) {
|
198 |
|
199 |
$the_price = '';
|
215 |
// Simple etc.
|
216 |
else {
|
217 |
//$the_price = wc_price( round( $this->the_product->get_price() * $wholesale_price_level['koef'], $precision ) );
|
|
|
218 |
$the_price = $this->the_product->get_price();
|
219 |
if ( '' !== $wholesale_price_level['koef'] && is_numeric( $wholesale_price_level['koef'] ) ) {
|
220 |
$the_price = $the_price * $wholesale_price_level['koef'];
|
222 |
if ( 'yes' !== $atts['hide_currency'] ) {
|
223 |
$the_price = wc_price( $the_price );
|
224 |
}
|
|
|
225 |
}
|
226 |
|
227 |
+
$data_qty[] = str_replace( '%level_qty%', $wholesale_price_level['quantity'], $atts['heading_format'] ) ;
|
228 |
+
$data_price[] = $the_price;
|
229 |
+
if ( 'yes' === $atts['add_percent_row'] ) {
|
230 |
+
$data_discount_percent[] = '-' . $wholesale_price_level['discount_percent'] . '%';
|
231 |
+
}
|
232 |
}
|
233 |
|
234 |
+
$table_rows = array( $data_qty, $data_price, );
|
235 |
+
if ( 'yes' === $atts['add_percent_row'] ) {
|
236 |
+
$table_rows[] = $data_discount_percent;
|
237 |
+
}
|
238 |
+
$table_styles = array( 'columns_styles' => array( 'text-align: center;', 'text-align: center;', 'text-align: center;', ), );
|
239 |
+
return wcj_get_table_html( $table_rows, $table_styles );
|
240 |
}
|
241 |
|
242 |
/**
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://algoritmika.com/donate/
|
|
4 |
Tags: woocommerce,woocommerce jetpack,custom price labels,call for price,currency symbol,remove sorting,remove old product slugs,add to cart text,order number,sequential order numbering,email pdf invoice,pdf invoice,pdf invoices,already in cart,empty cart,redirect to checkout,minimum order amount,customize checkout fields,checkout fields,email,customize product tabs,product tabs,related products number,empty cart,redirect add to cart,redirect to checkout,product already in cart,custom payment gateway,payment gateway icon,auto-complete all orders,custom order statuses,custom order status,remove text from price,custom css,hide categories count,hide subcategories count,hide category count,hide subcategory count,display total sales,custom product tabs,remove product tab,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 |
|
@@ -24,7 +24,7 @@ WooCommerce Jetpack is a WordPress plugin that supercharges your site with aweso
|
|
24 |
* *Prices and Currencies by Country* - Change WooCommerce product price and currency automatically by customer's country.
|
25 |
* *Wholesale Price* - Set WooCommerce wholesale pricing depending on product quantity in cart (buy more pay less).
|
26 |
|
27 |
-
**
|
28 |
|
29 |
* *Add to Cart Labels* - Change text for Add to Cart button by WooCommerce product type, by product category or for individual products.
|
30 |
* *Call for Price* - Create any custom price label for all WooCommerce products with empty price.
|
@@ -50,8 +50,12 @@ 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 |
* *Mini Cart* - Customize WooCommerce mini cart widget.
|
54 |
-
* *Payment Gateways* -
|
|
|
|
|
55 |
|
56 |
**Shipping & Orders**
|
57 |
|
@@ -70,7 +74,7 @@ WooCommerce Jetpack is a WordPress plugin that supercharges your site with aweso
|
|
70 |
|
71 |
* *Admin Tools* - Debug and log tools for WooCommerce Jetpack.
|
72 |
* *Emails* - Add another email recipient(s) to all WooCommerce emails.
|
73 |
-
* *General* - Separate custom CSS for front and back end.
|
74 |
* *Old Slugs* - Remove old WooCommerce products slugs.
|
75 |
* *Reports* - WooCommerce stock, sales, customers etc. reports.
|
76 |
* *WPML* - Basic WPML support for WooCommerce Jetpack.
|
@@ -104,6 +108,33 @@ To unlock all WooCommerce Jetpack features, please install additional <a href="h
|
|
104 |
|
105 |
== Changelog ==
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
= 2.2.1 - 04/07/2015 =
|
108 |
* Dev - Shortcodes - `location`, `site_visibility`, `wpml_language` attributes added to all shortcodes.
|
109 |
* Dev - PRICES & CURRENCIES - Price by Country - "by user selection" option added. `[wcj_country_select_drop_down_list]` shortcode added.
|
@@ -115,7 +146,7 @@ To unlock all WooCommerce Jetpack features, please install additional <a href="h
|
|
115 |
* Dev - PDF Invoicing - Invoice report tool added.
|
116 |
* Dev - PDF Invoicing - PDF invoices Header and Footer font set as "general font" set in "Styling" section.
|
117 |
* Dev - PDF Invoicing - Renumerate Invoices Tool - `date_query` added (fix for "memory exhausted" message, on large number of total shop orders).
|
118 |
-
* Fix - EMAILS & MISC. - WPML - `wcj_wpml_translate` added to General Shortcodes list.
|
119 |
* Dev - EMAILS & MISC. - General - "Enable shortcodes in WordPress text widgets" option added.
|
120 |
* Dev - EMAILS & MISC. - General - Code refactoring.
|
121 |
|
@@ -141,7 +172,7 @@ To unlock all WooCommerce Jetpack features, please install additional <a href="h
|
|
141 |
* Dev - DASHBOARD - Tweak: Categories menu modified (merged categories).
|
142 |
* Fix - PRICES & CURRENCIES - Price by Country - `woocommerce_loaded` hook changed to `init` in `WCJ_Price_by_Country_Core`.
|
143 |
* Dev - PRICES & CURRENCIES - Price by Country - Exchange Rates: "Grab" button tweak.
|
144 |
-
* Dev - PRICES & CURRENCIES - Price by Country - Now shipping cost also
|
145 |
* Dev - PRICES & CURRENCIES - Price by Country - Reporting: currency `merge` option added; and currency symbol fixed.
|
146 |
* Dev - PRICES & CURRENCIES - Wholesale Price (buy more pay less) - Initial module release. `[wcj_product_wholesale_price_table]` shortcode added to "Products Shortcodes".
|
147 |
* Dev - PRICE & BUTTON LABELS - Add to Cart Labels - Add to Cart module code refactoring: per category, per product and per product type merged to single module.
|
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.3
|
8 |
License: GNU General Public License v3.0
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
24 |
* *Prices and Currencies by Country* - Change WooCommerce product price and currency automatically by customer's country.
|
25 |
* *Wholesale Price* - Set WooCommerce wholesale pricing depending on product quantity in cart (buy more pay less).
|
26 |
|
27 |
+
**Button & Price Labels**
|
28 |
|
29 |
* *Add to Cart Labels* - Change text for Add to Cart button by WooCommerce product type, by product category or for individual products.
|
30 |
* *Call for Price* - Create any custom price label for all WooCommerce products with empty price.
|
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 any number of 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.
|
57 |
+
* *Payment Gateways Icons* - Change icons (images) for all default WooCommerce payment gateways.
|
58 |
+
* *Payment Gateways per Category* - Show gateway only if there is product of selected category in WooCommerce cart.
|
59 |
|
60 |
**Shipping & Orders**
|
61 |
|
74 |
|
75 |
* *Admin Tools* - Debug and log tools for WooCommerce Jetpack.
|
76 |
* *Emails* - Add another email recipient(s) to all WooCommerce emails.
|
77 |
+
* *General* - Separate custom CSS for front and back end. Shortcodes in Wordpress text widgets.
|
78 |
* *Old Slugs* - Remove old WooCommerce products slugs.
|
79 |
* *Reports* - WooCommerce stock, sales, customers etc. reports.
|
80 |
* *WPML* - Basic WPML support for WooCommerce Jetpack.
|
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.
|
116 |
+
|
117 |
+
= 2.2.2 - 24/07/2015 =
|
118 |
+
* Fix - DASHBOARD - White screen on dashboard issue, fixed. `wcj_features_status` filter depreciated.
|
119 |
+
* Fix - PRICES & CURRENCIES - Price by Country - Variable onsale old price bug fixed.
|
120 |
+
* Dev - PRICES & CURRENCIES - Wholesale Price Table Shortcode (`[wcj_product_wholesale_price_table]`) - Discount percent row added to the table.
|
121 |
+
* Dev - PRICES & CURRENCIES - Wholesale Price - "Show discount info on cart page" and "Discount info on cart page format" options added.
|
122 |
+
* Dev - PRICES & CURRENCIES - Wholesale Price - "Use total cart quantity instead of product quantity" option added.
|
123 |
+
* Dev - PRODUCTS - Product Input Fields - "File upload" field type added.
|
124 |
+
* Dev - CART & CHECKOUT - Custom Payment Gateways - Limit raised from 10 to unlimited custom gateways.
|
125 |
+
* Dev - CART & CHECKOUT - Payment Gateways Fees - "Is taxable" and "Tax class" options addded.
|
126 |
+
* Dev - CART & CHECKOUT - Payment Gateways - Code refactoring, new modules created:
|
127 |
+
Custom Payment Gateways, Payment Gateways Icons, Payment Gateways Fees, Payment Gateways per Category.
|
128 |
+
Attaching PDF Invoice V1 to emails - code moved to PDF Invoice V1 module.
|
129 |
+
All settings (except depreciated "attaching PDF Invoice V1") moved from WooCommerce Checkout settings to module's settings.
|
130 |
+
* Fix - SHIPPING & ORDERS - Orders - Step in min order amount changed.
|
131 |
+
* Fix - PDF Invoicing - Numbering - `[wcj_invoice_date]` in invoice number bug fixed.
|
132 |
+
* Fix - PDF Invoicing - In TCPDF lib, `symlink` call changed to calling with variable function name to prevent autodeleting tcpdf_fonts.php file from some servers bug.
|
133 |
+
* Dev - PDF Invoicing - Display - "save as" changed to yes by default (same for PDF Invoices V1).
|
134 |
+
* Dev - PDF Invoicing - Emails - "Include Payment Gateway" option added.
|
135 |
+
* Dev - EMAILS & MISC. - Reports - Stock reports: "Total stock price" column added.
|
136 |
+
* Dev - EMAILS & MISC. - Reports - Stock reports: "Overstocked" report added.
|
137 |
+
|
138 |
= 2.2.1 - 04/07/2015 =
|
139 |
* Dev - Shortcodes - `location`, `site_visibility`, `wpml_language` attributes added to all shortcodes.
|
140 |
* Dev - PRICES & CURRENCIES - Price by Country - "by user selection" option added. `[wcj_country_select_drop_down_list]` shortcode added.
|
146 |
* Dev - PDF Invoicing - Invoice report tool added.
|
147 |
* Dev - PDF Invoicing - PDF invoices Header and Footer font set as "general font" set in "Styling" section.
|
148 |
* Dev - PDF Invoicing - Renumerate Invoices Tool - `date_query` added (fix for "memory exhausted" message, on large number of total shop orders).
|
149 |
+
* Fix - EMAILS & MISC. - WPML - `[wcj_wpml_translate]` added to General Shortcodes list.
|
150 |
* Dev - EMAILS & MISC. - General - "Enable shortcodes in WordPress text widgets" option added.
|
151 |
* Dev - EMAILS & MISC. - General - Code refactoring.
|
152 |
|
172 |
* Dev - DASHBOARD - Tweak: Categories menu modified (merged categories).
|
173 |
* Fix - PRICES & CURRENCIES - Price by Country - `woocommerce_loaded` hook changed to `init` in `WCJ_Price_by_Country_Core`.
|
174 |
* Dev - PRICES & CURRENCIES - Price by Country - Exchange Rates: "Grab" button tweak.
|
175 |
+
* Dev - PRICES & CURRENCIES - Price by Country - Now shipping cost also calculated by country (`change_shipping_price_by_country` function added). Suggested by Fabian.
|
176 |
* Dev - PRICES & CURRENCIES - Price by Country - Reporting: currency `merge` option added; and currency symbol fixed.
|
177 |
* Dev - PRICES & CURRENCIES - Wholesale Price (buy more pay less) - Initial module release. `[wcj_product_wholesale_price_table]` shortcode added to "Products Shortcodes".
|
178 |
* Dev - PRICE & BUTTON LABELS - Add to Cart Labels - Add to Cart module code refactoring: per category, per product and per product type merged to single module.
|
woocommerce-jetpack.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WooCommerce Jetpack
|
4 |
Plugin URI: http://woojetpack.com
|
5 |
Description: Supercharge your WooCommerce site with these awesome powerful features.
|
6 |
-
Version: 2.2.
|
7 |
Author: Algoritmika Ltd
|
8 |
Author URI: http://www.algoritmika.com
|
9 |
Copyright: © 2015 Algoritmika Ltd.
|
@@ -280,6 +280,9 @@ final class WC_Jetpack {
|
|
280 |
$settings[] = include_once( 'includes/class-wcj-checkout-custom-fields.php' );
|
281 |
$settings[] = include_once( 'includes/class-wcj-checkout-custom-info.php' );
|
282 |
$settings[] = include_once( 'includes/class-wcj-payment-gateways.php' );
|
|
|
|
|
|
|
283 |
|
284 |
$settings[] = include_once( 'includes/class-wcj-shipping.php' );
|
285 |
$settings[] = include_once( 'includes/class-wcj-shipping-calculator.php' );
|
@@ -303,8 +306,6 @@ final class WC_Jetpack {
|
|
303 |
$settings[] = include_once( 'includes/pdf-invoices/settings/class-wcj-pdf-invoicing-display.php' );
|
304 |
//$settings[] = include_once( 'includes/pdf-invoices/settings/class-wcj-pdf-invoicing-general.php' );
|
305 |
|
306 |
-
//$settings[] = include_once( 'includes/pdf-invoices/class-wcj-pdf-invoices-by-settings.php' );
|
307 |
-
|
308 |
$settings[] = include_once( 'includes/class-wcj-emails.php' );
|
309 |
|
310 |
$settings[] = include_once( 'includes/class-wcj-currencies.php' );
|
@@ -317,14 +318,28 @@ final class WC_Jetpack {
|
|
317 |
$settings[] = include_once( 'includes/class-wcj-admin-tools.php' );
|
318 |
$settings[] = include_once( 'includes/class-wcj-wpml.php' );
|
319 |
|
320 |
-
//include_once( 'includes/class-wcj-shortcodes.php' );
|
321 |
-
|
322 |
// do_action( 'woojetpack_modules', $settings );
|
323 |
|
324 |
// Add options
|
325 |
if ( is_admin() ) {
|
326 |
foreach ( $settings as $section ) {
|
327 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
|
329 |
|
330 |
if ( isset ( $_GET['woojetpack_admin_options_reset'] ) ) {
|
@@ -350,7 +365,9 @@ final class WC_Jetpack {
|
|
350 |
* Add Jetpack settings tab to WooCommerce settings.
|
351 |
*/
|
352 |
public function add_wcj_settings_tab( $settings ) {
|
353 |
-
$
|
|
|
|
|
354 |
return $settings;
|
355 |
}
|
356 |
|
3 |
Plugin Name: WooCommerce Jetpack
|
4 |
Plugin URI: http://woojetpack.com
|
5 |
Description: Supercharge your WooCommerce site with these awesome powerful features.
|
6 |
+
Version: 2.2.3
|
7 |
Author: Algoritmika Ltd
|
8 |
Author URI: http://www.algoritmika.com
|
9 |
Copyright: © 2015 Algoritmika Ltd.
|
280 |
$settings[] = include_once( 'includes/class-wcj-checkout-custom-fields.php' );
|
281 |
$settings[] = include_once( 'includes/class-wcj-checkout-custom-info.php' );
|
282 |
$settings[] = include_once( 'includes/class-wcj-payment-gateways.php' );
|
283 |
+
$settings[] = include_once( 'includes/class-wcj-payment-gateways-icons.php' );
|
284 |
+
$settings[] = include_once( 'includes/class-wcj-payment-gateways-fees.php' );
|
285 |
+
$settings[] = include_once( 'includes/class-wcj-payment-gateways-per-category.php' );
|
286 |
|
287 |
$settings[] = include_once( 'includes/class-wcj-shipping.php' );
|
288 |
$settings[] = include_once( 'includes/class-wcj-shipping-calculator.php' );
|
306 |
$settings[] = include_once( 'includes/pdf-invoices/settings/class-wcj-pdf-invoicing-display.php' );
|
307 |
//$settings[] = include_once( 'includes/pdf-invoices/settings/class-wcj-pdf-invoicing-general.php' );
|
308 |
|
|
|
|
|
309 |
$settings[] = include_once( 'includes/class-wcj-emails.php' );
|
310 |
|
311 |
$settings[] = include_once( 'includes/class-wcj-currencies.php' );
|
318 |
$settings[] = include_once( 'includes/class-wcj-admin-tools.php' );
|
319 |
$settings[] = include_once( 'includes/class-wcj-wpml.php' );
|
320 |
|
|
|
|
|
321 |
// do_action( 'woojetpack_modules', $settings );
|
322 |
|
323 |
// Add options
|
324 |
if ( is_admin() ) {
|
325 |
foreach ( $settings as $section ) {
|
326 |
+
|
327 |
+
$values = $section->get_settings();
|
328 |
+
$submodules_classes = array(
|
329 |
+
'WCJ_PDF_Invoicing_Display',
|
330 |
+
'WCJ_PDF_Invoicing_Emails',
|
331 |
+
'WCJ_PDF_Invoicing_Footer',
|
332 |
+
'WCJ_PDF_Invoicing_Header',
|
333 |
+
'WCJ_PDF_Invoicing_Numbering',
|
334 |
+
'WCJ_PDF_Invoicing_Page',
|
335 |
+
'WCJ_PDF_Invoicing_Styling',
|
336 |
+
'WCJ_PDF_Invoicing_Templates',
|
337 |
+
);
|
338 |
+
if ( ! in_array( get_class( $section ), $submodules_classes ) ) {
|
339 |
+
$this->module_statuses[] = $values[1];
|
340 |
+
}
|
341 |
+
|
342 |
+
foreach ( $values as $value ) {
|
343 |
if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
|
344 |
|
345 |
if ( isset ( $_GET['woojetpack_admin_options_reset'] ) ) {
|
365 |
* Add Jetpack settings tab to WooCommerce settings.
|
366 |
*/
|
367 |
public function add_wcj_settings_tab( $settings ) {
|
368 |
+
$the_settings = include( 'includes/admin/class-wc-settings-jetpack.php' );
|
369 |
+
$the_settings->add_module_statuses( $this->module_statuses );
|
370 |
+
$settings[] = $the_settings;
|
371 |
return $settings;
|
372 |
}
|
373 |
|
wpml-config.xml
CHANGED
@@ -33,18 +33,12 @@
|
|
33 |
<key name="wcj_product_info_product_tabs_reviews_title" />
|
34 |
<key name="wcj_product_input_fields_type_checkbox_yes_global_1" />
|
35 |
<key name="wcj_product_input_fields_type_checkbox_no_global_1" />
|
|
|
36 |
<key name="wcj_product_input_fields_title_global_1" />
|
37 |
<key name="wcj_product_input_fields_placeholder_global_1" />
|
38 |
<key name="wcj_product_input_fields_required_message_global_1" />
|
39 |
-
<key name="wcj_product_input_fields_type_checkbox_yes_global_2" />
|
40 |
-
<key name="wcj_product_input_fields_type_checkbox_no_global_2" />
|
41 |
-
<key name="wcj_product_input_fields_title_global_2" />
|
42 |
-
<key name="wcj_product_input_fields_placeholder_global_2" />
|
43 |
-
<key name="wcj_product_input_fields_required_message_global_2" />
|
44 |
<key name="wcj_add_to_cart_per_category_text_single_group_1" />
|
45 |
<key name="wcj_add_to_cart_per_category_text_archive_group_1" />
|
46 |
-
<key name="wcj_add_to_cart_per_category_text_single_group_2" />
|
47 |
-
<key name="wcj_add_to_cart_per_category_text_archive_group_2" />
|
48 |
<key name="wcj_add_to_cart_text_on_single_simple" />
|
49 |
<key name="wcj_add_to_cart_text_on_archives_simple" />
|
50 |
<key name="wcj_add_to_cart_text_on_single_zero_price_simple" />
|
@@ -78,7 +72,6 @@
|
|
78 |
<key name="wcj_checkout_place_order_button_text" />
|
79 |
<key name="wcj_cart_custom_info_content_1" />
|
80 |
<key name="wcj_mini_cart_custom_info_content_1" />
|
81 |
-
<key name="wcj_mini_cart_custom_info_content_2" />
|
82 |
<key name="wcj_checkout_fields_billing_country_label" />
|
83 |
<key name="wcj_checkout_fields_billing_country_placeholder" />
|
84 |
<key name="wcj_checkout_fields_billing_first_name_label" />
|
@@ -125,8 +118,6 @@
|
|
125 |
<key name="wcj_checkout_fields_order_comments_placeholder" />
|
126 |
<key name="wcj_checkout_custom_field_label_1" />
|
127 |
<key name="wcj_checkout_custom_field_placeholder_1" />
|
128 |
-
<key name="wcj_checkout_custom_field_label_2" />
|
129 |
-
<key name="wcj_checkout_custom_field_placeholder_2" />
|
130 |
<key name="wcj_checkout_custom_info_content_1" />
|
131 |
<key name="wcj_order_minimum_amount_error_message" />
|
132 |
<key name="wcj_order_minimum_amount_cart_notice_message" />
|
33 |
<key name="wcj_product_info_product_tabs_reviews_title" />
|
34 |
<key name="wcj_product_input_fields_type_checkbox_yes_global_1" />
|
35 |
<key name="wcj_product_input_fields_type_checkbox_no_global_1" />
|
36 |
+
<key name="wcj_product_input_fields_type_file_accept_global_1" />
|
37 |
<key name="wcj_product_input_fields_title_global_1" />
|
38 |
<key name="wcj_product_input_fields_placeholder_global_1" />
|
39 |
<key name="wcj_product_input_fields_required_message_global_1" />
|
|
|
|
|
|
|
|
|
|
|
40 |
<key name="wcj_add_to_cart_per_category_text_single_group_1" />
|
41 |
<key name="wcj_add_to_cart_per_category_text_archive_group_1" />
|
|
|
|
|
42 |
<key name="wcj_add_to_cart_text_on_single_simple" />
|
43 |
<key name="wcj_add_to_cart_text_on_archives_simple" />
|
44 |
<key name="wcj_add_to_cart_text_on_single_zero_price_simple" />
|
72 |
<key name="wcj_checkout_place_order_button_text" />
|
73 |
<key name="wcj_cart_custom_info_content_1" />
|
74 |
<key name="wcj_mini_cart_custom_info_content_1" />
|
|
|
75 |
<key name="wcj_checkout_fields_billing_country_label" />
|
76 |
<key name="wcj_checkout_fields_billing_country_placeholder" />
|
77 |
<key name="wcj_checkout_fields_billing_first_name_label" />
|
118 |
<key name="wcj_checkout_fields_order_comments_placeholder" />
|
119 |
<key name="wcj_checkout_custom_field_label_1" />
|
120 |
<key name="wcj_checkout_custom_field_placeholder_1" />
|
|
|
|
|
121 |
<key name="wcj_checkout_custom_info_content_1" />
|
122 |
<key name="wcj_order_minimum_amount_error_message" />
|
123 |
<key name="wcj_order_minimum_amount_cart_notice_message" />
|