Version Description
- 08/01/2015 =
- Dev - CHECKOUT - Custom Checkout Fields - Filter for custom checkout fields for "WooCommerce - Store Exporter" plugin, added.
- Fix - ORDERS - Custom Statuses added to WooCommerce reports.
- Fix - CURRENCIES - Prices and Currencies by Country -
$wpdb->prefix
fix. Reported by John. - Fix - Reports -
wc_get_product
instead ofnew WC_Product
. - Fix - PDF Invoices -
wc_get_product
instead ofnew WC_Product
.
Download this release
Release Info
Developer | algoritmika |
Plugin | Booster for WooCommerce |
Version | 2.0.11 |
Comparing to | |
See all releases |
Code changes from version 2.0.9 to 2.0.11
- includes/class-wcj-checkout-custom-fields.php +25 -4
- includes/class-wcj-currencies.php +2 -2
- includes/class-wcj-orders.php +23 -2
- includes/class-wcj-pdf-invoices.php +2 -1
- includes/class-wcj-price-by-country.php +97 -6
- includes/class-wcj-product-bulk-price-converter.php +65 -4
- includes/class-wcj-product-info.php +17 -5
- includes/reports/wcj-class-reports-stock.php +2 -1
- readme.txt +14 -1
- woocommerce-jetpack.php +1 -1
includes/class-wcj-checkout-custom-fields.php
CHANGED
@@ -31,6 +31,8 @@ class WCJ_Checkout_Custom_Fields {
|
|
31 |
add_action( 'woocommerce_admin_order_data_after_shipping_address', array( $this, 'add_custom_order_and_account_fields_to_admin_order_display' ), PHP_INT_MAX );
|
32 |
|
33 |
add_action( 'woocommerce_email_after_order_table', array( $this, 'add_custom_fields_to_emails' ), PHP_INT_MAX, 2 );
|
|
|
|
|
34 |
|
35 |
|
36 |
add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'update_custom_checkout_fields_order_meta' ) );
|
@@ -60,11 +62,22 @@ class WCJ_Checkout_Custom_Fields {
|
|
60 |
}
|
61 |
|
62 |
/**
|
63 |
-
*
|
64 |
*/
|
65 |
-
public function
|
66 |
-
|
|
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
|
70 |
/**
|
@@ -213,7 +226,7 @@ class WCJ_Checkout_Custom_Fields {
|
|
213 |
'placeholder' => get_option( 'wcj_checkout_custom_field_placeholder_' . $i ),
|
214 |
'required' => ( 'yes' === get_option( 'wcj_checkout_custom_field_required_' . $i ) ) ? true : false,
|
215 |
'custom_attributes' => $custom_attributes,
|
216 |
-
'clear' => true,
|
217 |
'class' => array( get_option( 'wcj_checkout_custom_field_class_' . $i ), ),
|
218 |
);
|
219 |
}
|
@@ -381,6 +394,14 @@ class WCJ_Checkout_Custom_Fields {
|
|
381 |
'form-row-last' => __( 'Last', 'woocommerce-jetpack' ),
|
382 |
),
|
383 |
'css' => 'width:200px;',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
),
|
385 |
|
386 |
/**
|
31 |
add_action( 'woocommerce_admin_order_data_after_shipping_address', array( $this, 'add_custom_order_and_account_fields_to_admin_order_display' ), PHP_INT_MAX );
|
32 |
|
33 |
add_action( 'woocommerce_email_after_order_table', array( $this, 'add_custom_fields_to_emails' ), PHP_INT_MAX, 2 );
|
34 |
+
|
35 |
+
add_filter( 'woo_ce_order_fields', array( $this, 'add_custom_fields_to_store_exporter' ) );
|
36 |
|
37 |
|
38 |
add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'update_custom_checkout_fields_order_meta' ) );
|
62 |
}
|
63 |
|
64 |
/**
|
65 |
+
* add_custom_fields_to_store_exporter.
|
66 |
*/
|
67 |
+
public function add_custom_fields_to_store_exporter( $fields ) {
|
68 |
+
for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
|
69 |
+
if ( 'yes' === get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
|
70 |
|
71 |
+
$the_section = get_option( 'wcj_checkout_custom_field_section_' . $i );
|
72 |
+
$the_key = 'wcj_checkout_field_' . $i;
|
73 |
+
|
74 |
+
$fields[] = array(
|
75 |
+
'name' => $the_section . '_' . $the_key,
|
76 |
+
'label' => get_option( 'wcj_checkout_custom_field_label_' . $i ),
|
77 |
+
);
|
78 |
+
}
|
79 |
+
}
|
80 |
+
return $fields;
|
81 |
}
|
82 |
|
83 |
/**
|
226 |
'placeholder' => get_option( 'wcj_checkout_custom_field_placeholder_' . $i ),
|
227 |
'required' => ( 'yes' === get_option( 'wcj_checkout_custom_field_required_' . $i ) ) ? true : false,
|
228 |
'custom_attributes' => $custom_attributes,
|
229 |
+
'clear' => ( 'yes' === get_option( 'wcj_checkout_custom_field_clear_' . $i ) ) ? true : false,
|
230 |
'class' => array( get_option( 'wcj_checkout_custom_field_class_' . $i ), ),
|
231 |
);
|
232 |
}
|
394 |
'form-row-last' => __( 'Last', 'woocommerce-jetpack' ),
|
395 |
),
|
396 |
'css' => 'width:200px;',
|
397 |
+
),
|
398 |
+
|
399 |
+
array(
|
400 |
+
'title' => '',
|
401 |
+
'desc' => __( 'clear', 'woocommerce-jetpack' ),
|
402 |
+
'id' => 'wcj_checkout_custom_field_clear_' . $i,
|
403 |
+
'default' => 'yes',
|
404 |
+
'type' => 'checkbox',
|
405 |
),
|
406 |
|
407 |
/**
|
includes/class-wcj-currencies.php
CHANGED
@@ -89,7 +89,7 @@ class WCJ_Currencies {
|
|
89 |
|
90 |
array(
|
91 |
'title' => __( 'Currencies', 'woocommerce-jetpack' ),
|
92 |
-
'desc' => __( 'Enable
|
93 |
'desc_tip' => __( 'Add all world currencies, change currency symbol.', 'woocommerce-jetpack' ),
|
94 |
'id' => 'wcj_currency_enabled',
|
95 |
'default' => 'yes',
|
@@ -148,7 +148,7 @@ class WCJ_Currencies {
|
|
148 |
if ( 'yes' === get_option( 'wcj_currency_hide_symbol' ) )
|
149 |
return '';
|
150 |
|
151 |
-
return apply_filters( 'wcj_get_option_filter', $this->
|
152 |
}
|
153 |
|
154 |
/*public function check_wooallcurpro_fields($input) {
|
89 |
|
90 |
array(
|
91 |
'title' => __( 'Currencies', 'woocommerce-jetpack' ),
|
92 |
+
'desc' => '<strong>' . __( 'Enable Module', 'woocommerce-jetpack' ) . '</strong>',
|
93 |
'desc_tip' => __( 'Add all world currencies, change currency symbol.', 'woocommerce-jetpack' ),
|
94 |
'id' => 'wcj_currency_enabled',
|
95 |
'default' => 'yes',
|
148 |
if ( 'yes' === get_option( 'wcj_currency_hide_symbol' ) )
|
149 |
return '';
|
150 |
|
151 |
+
return apply_filters( 'wcj_get_option_filter', $this->currency_symbols[ $currency ], get_option( 'wcj_currency_' . $currency, $currency_symbol ) );
|
152 |
}
|
153 |
|
154 |
/*public function check_wooallcurpro_fields($input) {
|
includes/class-wcj-orders.php
CHANGED
@@ -52,6 +52,8 @@ class WCJ_Orders {
|
|
52 |
|
53 |
add_filter( 'woocommerce_default_order_status',
|
54 |
array( $this, 'set_default_order_status' ), 100 );
|
|
|
|
|
55 |
|
56 |
}
|
57 |
add_action( 'wcj_tools_dashboard', array( $this, 'add_custom_statuses_tool_info_to_tools_dashboard' ), 100 );
|
@@ -70,6 +72,25 @@ class WCJ_Orders {
|
|
70 |
// CUSTOM STATUSES //
|
71 |
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
/**
|
74 |
* set_default_order_status.
|
75 |
*/
|
@@ -163,9 +184,9 @@ class WCJ_Orders {
|
|
163 |
// Checking status
|
164 |
$statuses_updated = ( '' == get_option( 'wcj_orders_custom_statuses_array' ) ) ? array() : get_option( 'wcj_orders_custom_statuses_array' );
|
165 |
$new_key = 'wc-' . $_POST['new_status'];
|
166 |
-
if ( isset( $statuses_updated[$new_key] ) )
|
167 |
return '<div class="error"><p>' . __( 'Duplicate slug. Status not added.', 'woocommerce-jetpack' ) . '</p></div>';
|
168 |
-
$statuses_updated[$new_key] = $_POST['new_status_label'];
|
169 |
|
170 |
// Adding custom status
|
171 |
$result = update_option( 'wcj_orders_custom_statuses_array', $statuses_updated );
|
52 |
|
53 |
add_filter( 'woocommerce_default_order_status',
|
54 |
array( $this, 'set_default_order_status' ), 100 );
|
55 |
+
|
56 |
+
add_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'add_custom_order_statuses_to_reports' ), PHP_INT_MAX );
|
57 |
|
58 |
}
|
59 |
add_action( 'wcj_tools_dashboard', array( $this, 'add_custom_statuses_tool_info_to_tools_dashboard' ), 100 );
|
72 |
// CUSTOM STATUSES //
|
73 |
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
74 |
|
75 |
+
/**
|
76 |
+
* add_custom_order_statuses_to_reports.
|
77 |
+
*/
|
78 |
+
public function add_custom_order_statuses_to_reports( $args ) {
|
79 |
+
|
80 |
+
if ( in_array( 'shop_order_refund', $args['order_types'] ) )
|
81 |
+
return $args;
|
82 |
+
if ( is_array( $args['order_status'] ) && 1 === count( $args['order_status'] ) && in_array( 'refunded', $args['order_status'] ) )
|
83 |
+
return $args;
|
84 |
+
|
85 |
+
$custom_order_statuses = get_option( 'wcj_orders_custom_statuses_array' );
|
86 |
+
if ( ! empty( $custom_order_statuses ) && is_array( $custom_order_statuses ) ) {
|
87 |
+
foreach ( $custom_order_statuses as $slug => $label ) {
|
88 |
+
$args['order_status'][] = substr( $slug, 3 );
|
89 |
+
}
|
90 |
+
}
|
91 |
+
return $args;
|
92 |
+
}
|
93 |
+
|
94 |
/**
|
95 |
* set_default_order_status.
|
96 |
*/
|
184 |
// Checking status
|
185 |
$statuses_updated = ( '' == get_option( 'wcj_orders_custom_statuses_array' ) ) ? array() : get_option( 'wcj_orders_custom_statuses_array' );
|
186 |
$new_key = 'wc-' . $_POST['new_status'];
|
187 |
+
if ( isset( $statuses_updated[ $new_key ] ) )
|
188 |
return '<div class="error"><p>' . __( 'Duplicate slug. Status not added.', 'woocommerce-jetpack' ) . '</p></div>';
|
189 |
+
$statuses_updated[ $new_key ] = $_POST['new_status_label'];
|
190 |
|
191 |
// Adding custom status
|
192 |
$result = update_option( 'wcj_orders_custom_statuses_array', $statuses_updated );
|
includes/class-wcj-pdf-invoices.php
CHANGED
@@ -109,7 +109,8 @@ class WCJ_PDF_Invoices {
|
|
109 |
$total_weight = 0;
|
110 |
$the_items = $the_order->get_items();
|
111 |
foreach( $the_items as $the_item ) {
|
112 |
-
|
|
|
113 |
$total_weight += $the_item['qty'] * $the_product->get_weight();
|
114 |
}
|
115 |
return ( 0 == $total_weight ) ? '' : $total_weight;
|
109 |
$total_weight = 0;
|
110 |
$the_items = $the_order->get_items();
|
111 |
foreach( $the_items as $the_item ) {
|
112 |
+
//$the_product = new WC_Product( $the_item['product_id'] );
|
113 |
+
$the_product = wc_get_product( $the_item['product_id'] );
|
114 |
$total_weight += $the_item['qty'] * $the_product->get_weight();
|
115 |
}
|
116 |
return ( 0 == $total_weight ) ? '' : $total_weight;
|
includes/class-wcj-price-by-country.php
CHANGED
@@ -24,7 +24,7 @@ class WCJ_Price_By_Country {
|
|
24 |
$this->customer_country = null;
|
25 |
$this->customer_country_group_id = null;
|
26 |
|
27 |
-
$this->current_db_file_version =
|
28 |
|
29 |
//$this->currency_symbols = include( 'currencies/wcj-currency-symbols.php' );
|
30 |
/*$currencies = include( 'currencies/wcj-currencies.php' );
|
@@ -67,7 +67,7 @@ class WCJ_Price_By_Country {
|
|
67 |
add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
|
68 |
add_filter( 'wcj_settings_price_by_country', array( $this, 'get_settings' ), 100 );
|
69 |
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
70 |
-
}
|
71 |
|
72 |
public function reinstall_ip_db() {
|
73 |
if ( isset( $_GET['wcj-install-ip-db'] ) && '1' == $_GET['wcj-install-ip-db'] ) {
|
@@ -210,6 +210,17 @@ class WCJ_Price_By_Country {
|
|
210 |
return explode( ',', trim( $line ) );
|
211 |
}
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
/**
|
214 |
* check_and_update_database.
|
215 |
*/
|
@@ -222,8 +233,83 @@ class WCJ_Price_By_Country {
|
|
222 |
|
223 |
// Get IPs from file
|
224 |
// This product includes GeoLite data created by MaxMind, available from <a href="http://www.maxmind.com">http://www.maxmind.com</a>.
|
|
|
225 |
$csv = array_map( array( $this, 'parse_csv_line' ), file( plugin_dir_path( __FILE__ ) . 'lib/ipdb.csv' ) );
|
226 |
-
if ( ! empty ($csv) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
|
228 |
/**
|
229 |
update_option( 'wcj_geoipcountry_db_from', array() );
|
@@ -273,7 +359,7 @@ class WCJ_Price_By_Country {
|
|
273 |
}
|
274 |
/**/
|
275 |
|
276 |
-
|
277 |
// IPs from
|
278 |
foreach ( $csv as $key => $data )
|
279 |
$column[ $key ] = $data[0];
|
@@ -289,7 +375,7 @@ class WCJ_Price_By_Country {
|
|
289 |
$column[ $key ] = $data[2];
|
290 |
update_option( 'wcj_geoipcountry_db_country', $column );
|
291 |
/**/
|
292 |
-
|
293 |
$count_db_from = count( get_option( 'wcj_geoipcountry_db_from', array() ) );
|
294 |
$count_db_to = count( get_option( 'wcj_geoipcountry_db_to', array() ) );
|
295 |
$count_db_country = count( get_option( 'wcj_geoipcountry_db_country', array() ) );
|
@@ -307,6 +393,7 @@ class WCJ_Price_By_Country {
|
|
307 |
|
308 |
$output_buffer = ob_get_contents();
|
309 |
ob_end_clean();
|
|
|
310 |
update_option( 'wcj_geoipcountry_db_update_log', $output_buffer );
|
311 |
}
|
312 |
|
@@ -424,6 +511,9 @@ class WCJ_Price_By_Country {
|
|
424 |
// Update DB if needed
|
425 |
$this->check_and_update_database();
|
426 |
|
|
|
|
|
|
|
427 |
// Search for IP in DB
|
428 |
$db = get_option( 'wcj_geoipcountry_db_from', array() );
|
429 |
$index = $this->search_for_nearest_below_value( $db, $ip_as_int );
|
@@ -438,8 +528,9 @@ class WCJ_Price_By_Country {
|
|
438 |
return $db[ $index ];
|
439 |
}
|
440 |
}
|
|
|
441 |
|
442 |
-
return null
|
443 |
}
|
444 |
|
445 |
public function get_user_country_by_ip_external() {
|
24 |
$this->customer_country = null;
|
25 |
$this->customer_country_group_id = null;
|
26 |
|
27 |
+
$this->current_db_file_version = 4;
|
28 |
|
29 |
//$this->currency_symbols = include( 'currencies/wcj-currency-symbols.php' );
|
30 |
/*$currencies = include( 'currencies/wcj-currencies.php' );
|
67 |
add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
|
68 |
add_filter( 'wcj_settings_price_by_country', array( $this, 'get_settings' ), 100 );
|
69 |
add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
|
70 |
+
}
|
71 |
|
72 |
public function reinstall_ip_db() {
|
73 |
if ( isset( $_GET['wcj-install-ip-db'] ) && '1' == $_GET['wcj-install-ip-db'] ) {
|
210 |
return explode( ',', trim( $line ) );
|
211 |
}
|
212 |
|
213 |
+
/**
|
214 |
+
* get_country_by_ip_mysql.
|
215 |
+
*/
|
216 |
+
public function get_country_by_ip_mysql( $ip ) {
|
217 |
+
global $wpdb;
|
218 |
+
$results = $wpdb->get_results( "SELECT `country_code` FROM `{$wpdb->prefix}woojetpack_country_ip` WHERE `ip_from` <= $ip AND `ip_to` >= $ip", OBJECT );
|
219 |
+
if ( 1 !== count( $results ) )
|
220 |
+
return null;
|
221 |
+
return $results[0]->country_code;
|
222 |
+
}
|
223 |
+
|
224 |
/**
|
225 |
* check_and_update_database.
|
226 |
*/
|
233 |
|
234 |
// Get IPs from file
|
235 |
// This product includes GeoLite data created by MaxMind, available from <a href="http://www.maxmind.com">http://www.maxmind.com</a>.
|
236 |
+
//$csv = array_map( array( $this, 'parse_csv_line' ), file( plugin_dir_path( __FILE__ ) . 'lib/ipdb.csv' ) );
|
237 |
$csv = array_map( array( $this, 'parse_csv_line' ), file( plugin_dir_path( __FILE__ ) . 'lib/ipdb.csv' ) );
|
238 |
+
if ( ! empty ( $csv ) ) {
|
239 |
+
// $the_values = file_get_contents( plugin_dir_path( __FILE__ ) . 'lib/ipdb.sql' );
|
240 |
+
// if ( ! empty ( $the_values ) ) {
|
241 |
+
|
242 |
+
global $wpdb;
|
243 |
+
|
244 |
+
$charset_collate = $wpdb->get_charset_collate();
|
245 |
+
|
246 |
+
$table_name = $wpdb->prefix . 'woojetpack_country_ip';
|
247 |
+
|
248 |
+
//echo ( false === $wpdb->query( "DROP TABLE $table_name;" ) ) ? 'truncate-false' : 'truncate-true';
|
249 |
+
$wpdb->query( "DROP TABLE $table_name;" );
|
250 |
+
|
251 |
+
/*$sql = "CREATE TABLE $table_name (
|
252 |
+
ip_from BIGINT NOT NULL,
|
253 |
+
ip_to BIGINT NOT NULL,
|
254 |
+
country_code text NOT NULL,
|
255 |
+
UNIQUE KEY ip_from (ip_from)
|
256 |
+
) $charset_collate;";*/
|
257 |
+
|
258 |
+
$sql = "CREATE TABLE $table_name (
|
259 |
+
ip_from BIGINT NOT NULL,
|
260 |
+
ip_to BIGINT NOT NULL,
|
261 |
+
country_code VARCHAR(2) NOT NULL,
|
262 |
+
UNIQUE KEY ip_from (ip_from)
|
263 |
+
) $charset_collate;";
|
264 |
+
//echo ( false === $wpdb->query( $sql ) ) ? 'false' : 'true';
|
265 |
+
$wpdb->query( $sql );
|
266 |
+
|
267 |
+
//print_r( $wpdb->get_results("SELECT * FROM $table_name;") );
|
268 |
+
|
269 |
+
//require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
270 |
+
//dbDelta( $sql );
|
271 |
+
|
272 |
+
$i = 0;
|
273 |
+
$the_values = '';
|
274 |
+
$max_insert_size = 10000;
|
275 |
+
$the_size = count( $csv );
|
276 |
+
//echo $the_size;
|
277 |
+
foreach ( $csv as $key => $data ) {
|
278 |
+
$the_values .= "('$data[0]', '$data[1]', '$data[2]'), ";
|
279 |
+
//$the_values .= "('" . implode( "', '", $data ) . "'), ";
|
280 |
+
$i++;
|
281 |
+
if ( $i >= $max_insert_size ) {
|
282 |
+
$the_values = rtrim( $the_values, ', ' );
|
283 |
+
$wpdb->query( "INSERT INTO $table_name (`ip_from`, `ip_to`, `country_code`) VALUES $the_values;" );
|
284 |
+
$i = 0;
|
285 |
+
$the_values = '';
|
286 |
+
}
|
287 |
+
}
|
288 |
+
if ( '' != $the_values ) {
|
289 |
+
$the_values = rtrim( $the_values, ', ' );
|
290 |
+
$wpdb->query( "INSERT INTO $table_name (`ip_from`, `ip_to`, `country_code`) VALUES $the_values;" );
|
291 |
+
}
|
292 |
+
|
293 |
+
$count_db_table = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name;" );
|
294 |
+
//print_r( $count_db_table );
|
295 |
+
|
296 |
+
if ( $the_size != $count_db_table ) {
|
297 |
+
// Something went wrong
|
298 |
+
update_option( 'wcj_geoipcountry_db_version', -2 );
|
299 |
+
}
|
300 |
+
else {
|
301 |
+
// Finished
|
302 |
+
update_option( 'wcj_geoipcountry_db_version', $this->current_db_file_version );
|
303 |
+
}
|
304 |
+
|
305 |
+
|
306 |
+
// Depreciated - cleaning
|
307 |
+
update_option( 'wcj_geoipcountry_db_from', array() );
|
308 |
+
update_option( 'wcj_geoipcountry_db_to', array() );
|
309 |
+
update_option( 'wcj_geoipcountry_db_country', array() );
|
310 |
+
|
311 |
+
|
312 |
+
|
313 |
|
314 |
/**
|
315 |
update_option( 'wcj_geoipcountry_db_from', array() );
|
359 |
}
|
360 |
/**/
|
361 |
|
362 |
+
/**
|
363 |
// IPs from
|
364 |
foreach ( $csv as $key => $data )
|
365 |
$column[ $key ] = $data[0];
|
375 |
$column[ $key ] = $data[2];
|
376 |
update_option( 'wcj_geoipcountry_db_country', $column );
|
377 |
/**/
|
378 |
+
/**
|
379 |
$count_db_from = count( get_option( 'wcj_geoipcountry_db_from', array() ) );
|
380 |
$count_db_to = count( get_option( 'wcj_geoipcountry_db_to', array() ) );
|
381 |
$count_db_country = count( get_option( 'wcj_geoipcountry_db_country', array() ) );
|
393 |
|
394 |
$output_buffer = ob_get_contents();
|
395 |
ob_end_clean();
|
396 |
+
//echo $output_buffer;
|
397 |
update_option( 'wcj_geoipcountry_db_update_log', $output_buffer );
|
398 |
}
|
399 |
|
511 |
// Update DB if needed
|
512 |
$this->check_and_update_database();
|
513 |
|
514 |
+
// Search for IP in DB
|
515 |
+
return $this->get_country_by_ip_mysql( $ip_as_int );
|
516 |
+
/*
|
517 |
// Search for IP in DB
|
518 |
$db = get_option( 'wcj_geoipcountry_db_from', array() );
|
519 |
$index = $this->search_for_nearest_below_value( $db, $ip_as_int );
|
528 |
return $db[ $index ];
|
529 |
}
|
530 |
}
|
531 |
+
|
532 |
|
533 |
+
return null;*/
|
534 |
}
|
535 |
|
536 |
public function get_user_country_by_ip_external() {
|
includes/class-wcj-product-bulk-price-converter.php
CHANGED
@@ -53,16 +53,18 @@ class WCJ_Bulk_Price_Converter {
|
|
53 |
$the_price = get_post_meta( $product_id, '_' . $price_type, true );
|
54 |
if ( '' != $the_price ) {
|
55 |
$precision = get_option( 'woocommerce_price_num_decimals', 2 );
|
56 |
-
$
|
|
|
|
|
57 |
if ( ! $is_preview )
|
58 |
-
update_post_meta( $product_id, '_' . $price_type, $
|
59 |
}
|
60 |
|
61 |
echo '<tr>' .
|
62 |
'<td>' . get_the_title( $product_id ) . '</td>' .
|
63 |
'<td><em>' . $price_type . '</em></td>' .
|
64 |
'<td>' . $the_price . '</td>' .
|
65 |
-
'<td>' . $
|
66 |
'</tr>';
|
67 |
}
|
68 |
|
@@ -152,11 +154,70 @@ class WCJ_Bulk_Price_Converter {
|
|
152 |
<?php echo __( 'Multiply all product prices by', 'woocommerce-jetpack' ); ?> <input class="" type="text" name="multiply_prices_by" id="multiply_prices_by" value="<?php echo $multiply_prices_by; ?>">
|
153 |
<input class="button-primary" type="submit" name="bulk_change_prices_preview" id="bulk_change_prices_preview" value="Preview Prices">
|
154 |
<input class="button-primary" type="submit" name="bulk_change_prices" id="bulk_change_prices" value="Change Prices">
|
|
|
155 |
</form></p>
|
156 |
<?php if ( $is_preview ) echo $result_changing_prices; ?>
|
157 |
</div>
|
158 |
<?php
|
159 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
/**
|
162 |
* add_bulk_price_converter_tool_info_to_tools_dashboard.
|
53 |
$the_price = get_post_meta( $product_id, '_' . $price_type, true );
|
54 |
if ( '' != $the_price ) {
|
55 |
$precision = get_option( 'woocommerce_price_num_decimals', 2 );
|
56 |
+
$the_modified_price = round( $the_price * $multiply_price_by, $precision );
|
57 |
+
/*if ( isset( $_POST['make_pretty_prices'] ) )
|
58 |
+
$the_modified_price = $this->make_pretty_price( $the_modified_price );*/
|
59 |
if ( ! $is_preview )
|
60 |
+
update_post_meta( $product_id, '_' . $price_type, $the_modified_price );
|
61 |
}
|
62 |
|
63 |
echo '<tr>' .
|
64 |
'<td>' . get_the_title( $product_id ) . '</td>' .
|
65 |
'<td><em>' . $price_type . '</em></td>' .
|
66 |
'<td>' . $the_price . '</td>' .
|
67 |
+
'<td>' . $the_modified_price . '</td>' .
|
68 |
'</tr>';
|
69 |
}
|
70 |
|
154 |
<?php echo __( 'Multiply all product prices by', 'woocommerce-jetpack' ); ?> <input class="" type="text" name="multiply_prices_by" id="multiply_prices_by" value="<?php echo $multiply_prices_by; ?>">
|
155 |
<input class="button-primary" type="submit" name="bulk_change_prices_preview" id="bulk_change_prices_preview" value="Preview Prices">
|
156 |
<input class="button-primary" type="submit" name="bulk_change_prices" id="bulk_change_prices" value="Change Prices">
|
157 |
+
<?php /*<input type="checkbox" name="make_pretty_prices" id="make_pretty_prices" value="">Make Pretty Prices*/ ?>
|
158 |
</form></p>
|
159 |
<?php if ( $is_preview ) echo $result_changing_prices; ?>
|
160 |
</div>
|
161 |
<?php
|
162 |
+
}
|
163 |
+
|
164 |
+
|
165 |
+
/**
|
166 |
+
* make_pretty_price.
|
167 |
+
*
|
168 |
+
function make_pretty_price( $price ) {
|
169 |
+
|
170 |
+
if ( 0 == $price )
|
171 |
+
return $price;
|
172 |
+
|
173 |
+
$the_price = $price;
|
174 |
+
$the_multiplied_price = $price;
|
175 |
+
|
176 |
+
if ( $the_price < 20 ) {
|
177 |
+
|
178 |
+
|
179 |
+
$mod_10_cents = ( $the_multiplied_price * 10 - floor( $the_multiplied_price * 10 ) ) / 10;
|
180 |
+
// E.g. 14.44 -> 14.39
|
181 |
+
if ( $mod_10_cents < 0.05 )
|
182 |
+
$the_multiplied_price = $the_multiplied_price - ( $mod_10_cents + 0.01 );
|
183 |
+
// E.g. 14.45 -> 14.49
|
184 |
+
else if ( $mod_10_cents >= 0.05 )
|
185 |
+
$the_multiplied_price = $the_multiplied_price + ( 0.1 - ( $mod_10_cents + 0.01 ) );
|
186 |
+
|
187 |
+
$mod_100_cents = ( $the_multiplied_price - floor( $the_multiplied_price ) );
|
188 |
+
// E.g. 14.09 -> 13.99
|
189 |
+
if ( $mod_100_cents < 0.10 )
|
190 |
+
$the_multiplied_price = $the_multiplied_price - ( $mod_100_cents + 0.01 );
|
191 |
+
}
|
192 |
+
|
193 |
+
|
194 |
+
if ( $the_price < 99 && $the_price >= 20 )
|
195 |
+
// E.g. 45.36 -> 44.99
|
196 |
+
// E.g. 45.60 -> 45.99
|
197 |
+
$the_multiplied_price = round( $the_multiplied_price ) - 0.01;
|
198 |
+
|
199 |
+
if ( $the_price >= 100 ) {
|
200 |
+
|
201 |
+
$the_multiplied_price = round( $the_multiplied_price );
|
202 |
+
|
203 |
+
$mod_10 = $the_multiplied_price % 10;
|
204 |
+
if ( $mod_10 < 5 )
|
205 |
+
// E.g. 114.00 -> 109.00
|
206 |
+
$the_multiplied_price = $the_multiplied_price - ( $mod_10 + 1 );
|
207 |
+
else if ( $mod_10 >= 5 )
|
208 |
+
// E.g. 115.00 -> 119.00
|
209 |
+
$the_multiplied_price = $the_multiplied_price + ( 10 - ( $mod_10 + 1 ) );
|
210 |
+
|
211 |
+
if ( $the_price >= 200 ) {
|
212 |
+
$mod_100 = $the_multiplied_price % 100;
|
213 |
+
if ( $mod_100 < 10 )
|
214 |
+
// E.g. 209.00 -> 199.00
|
215 |
+
$the_multiplied_price = $the_multiplied_price - ( $mod_100 + 1 );
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
return $the_multiplied_price;
|
220 |
+
}
|
221 |
|
222 |
/**
|
223 |
* add_bulk_price_converter_tool_info_to_tools_dashboard.
|
includes/class-wcj-product-info.php
CHANGED
@@ -154,11 +154,12 @@ class WCJ_Product_Info {
|
|
154 |
'before' => '',
|
155 |
'after' => '',
|
156 |
'visibility' => '',
|
|
|
157 |
'options' => '',
|
158 |
), $atts, $shortcode );
|
159 |
if ( 'admin' === $atts['visibility'] && ! is_super_admin() )
|
160 |
return '';
|
161 |
-
if ( '' != ( $result = $this->get_product_info_short_code( $shortcode, $atts['options'] ) ) )
|
162 |
return $atts['before'] . $result . $atts['after'];
|
163 |
return '';
|
164 |
}
|
@@ -376,11 +377,22 @@ class WCJ_Product_Info {
|
|
376 |
/**
|
377 |
* get_product_info.
|
378 |
*/
|
379 |
-
public function get_product_info_short_code( $short_code, $options = null ) {
|
380 |
|
381 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
|
383 |
-
if (
|
|
|
|
|
|
|
384 |
return '';
|
385 |
|
386 |
switch( $short_code ) {
|
@@ -701,7 +713,7 @@ class WCJ_Product_Info {
|
|
701 |
|
702 |
array(
|
703 |
'title' => __( 'Product Info', 'woocommerce-jetpack' ),
|
704 |
-
'desc' => __( 'Enable
|
705 |
'desc_tip' => __( 'Add additional info to product, change related products number.', 'woocommerce-jetpack' ),
|
706 |
'id' => 'wcj_product_info_enabled',
|
707 |
'default' => 'yes',
|
154 |
'before' => '',
|
155 |
'after' => '',
|
156 |
'visibility' => '',
|
157 |
+
'id' => 0,
|
158 |
'options' => '',
|
159 |
), $atts, $shortcode );
|
160 |
if ( 'admin' === $atts['visibility'] && ! is_super_admin() )
|
161 |
return '';
|
162 |
+
if ( '' != ( $result = $this->get_product_info_short_code( $shortcode, $atts['id'], $atts['options'] ) ) )
|
163 |
return $atts['before'] . $result . $atts['after'];
|
164 |
return '';
|
165 |
}
|
377 |
/**
|
378 |
* get_product_info.
|
379 |
*/
|
380 |
+
public function get_product_info_short_code( $short_code, $id = 0, $options = null ) {
|
381 |
|
382 |
+
|
383 |
+
if ( 0 != $id ) {
|
384 |
+
$product = wc_get_product( $id );
|
385 |
+
}
|
386 |
+
else {
|
387 |
+
if ( ! array_key_exists( 'product', $GLOBALS ) )
|
388 |
+
return '';
|
389 |
+
global $product;
|
390 |
+
}
|
391 |
|
392 |
+
if ( ! $product )
|
393 |
+
return '';
|
394 |
+
|
395 |
+
if ( '%list_attribute%' == $short_code && empty( $options ) )
|
396 |
return '';
|
397 |
|
398 |
switch( $short_code ) {
|
713 |
|
714 |
array(
|
715 |
'title' => __( 'Product Info', 'woocommerce-jetpack' ),
|
716 |
+
'desc' => '<strong>' . __( 'Enable Module', 'woocommerce-jetpack' ) . '</strong>',
|
717 |
'desc_tip' => __( 'Add additional info to product, change related products number.', 'woocommerce-jetpack' ),
|
718 |
'id' => 'wcj_product_info_enabled',
|
719 |
'default' => 'yes',
|
includes/reports/wcj-class-reports-stock.php
CHANGED
@@ -104,7 +104,8 @@ class WCJ_Reports_Stock {
|
|
104 |
while ( $loop->have_posts() ) : $loop->the_post();
|
105 |
|
106 |
$the_ID = get_the_ID();
|
107 |
-
|
|
|
108 |
$the_price = $the_product->get_price();
|
109 |
$the_stock = $the_product->get_total_stock();
|
110 |
//if ( 0 == $the_stock )
|
104 |
while ( $loop->have_posts() ) : $loop->the_post();
|
105 |
|
106 |
$the_ID = get_the_ID();
|
107 |
+
//$the_product = new WC_Product( $the_ID );
|
108 |
+
$the_product = wc_get_product( $the_ID );
|
109 |
$the_price = $the_product->get_price();
|
110 |
$the_stock = $the_product->get_total_stock();
|
111 |
//if ( 0 == $the_stock )
|
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.9.1
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GNU General Public License v3.0
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -68,6 +68,19 @@ To unlock all WooCommerce Jetpack features, please install additional <a href="h
|
|
68 |
|
69 |
== Changelog ==
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
= 2.0.9 - 01/01/2015 =
|
72 |
* Fix - PRODUCTS - **Bulk Price Coverter** - Not updating on empty price (was setting to zero before).
|
73 |
|
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.9.1
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 2.0.11
|
8 |
License: GNU General Public License v3.0
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
68 |
|
69 |
== Changelog ==
|
70 |
|
71 |
+
= 2.0.11 - 08/01/2015 =
|
72 |
+
* Dev - CHECKOUT - **Custom Checkout Fields** - Filter for custom checkout fields for "WooCommerce - Store Exporter" plugin, added.
|
73 |
+
* Fix - ORDERS - Custom Statuses added to WooCommerce reports.
|
74 |
+
* Fix - CURRENCIES - **Prices and Currencies by Country** - `$wpdb->prefix` fix. Reported by John.
|
75 |
+
* Fix - **Reports** - `wc_get_product` instead of `new WC_Product`.
|
76 |
+
* Fix - **PDF Invoices** - `wc_get_product` instead of `new WC_Product`.
|
77 |
+
|
78 |
+
= 2.0.10 - 04/01/2015 =
|
79 |
+
* Fix - PRODUCTS - **Product Info** - `id` option bug, fixed.
|
80 |
+
* Fix - CURRENCIES - **Currencies** - Empty symbol bug, fixed.
|
81 |
+
* Dev - CHECKOUT - **Custom Checkout Fields** - Option to set *clear* after the field, added.
|
82 |
+
* Dev - CURRENCIES - **Prices and Currencies by Country** - New table `woojetpack_country_ip` added to DB.
|
83 |
+
|
84 |
= 2.0.9 - 01/01/2015 =
|
85 |
* Fix - PRODUCTS - **Bulk Price Coverter** - Not updating on empty price (was setting to zero before).
|
86 |
|
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.0.
|
7 |
Author: Algoritmika Ltd
|
8 |
Author URI: http://www.algoritmika.com
|
9 |
Copyright: © 2014 Algoritmika Ltd.
|
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.0.11
|
7 |
Author: Algoritmika Ltd
|
8 |
Author URI: http://www.algoritmika.com
|
9 |
Copyright: © 2014 Algoritmika Ltd.
|