Version Description
- Fix: CSV import not working in 3.8.8.
- Fix: Category page display setting does not override default Presentation settings.
- Fix: Clicking All/None in Category target market settings doesn't work.
- Fix: Non-SSL stylesheet is loaded even when force SSL for checkout page is on.
- Fix: PHP Warning and Notice in sales log page.
- Fix: PayPal currency converter is wrong.
- Fix: Sales logs are not displayed for some installations.
- Fix: Sales logs page sometimes display empty customers' names.
- Fix: Saving payment gateway settings erase Shipping settings.
- Fix: Sometimes clicking Save doesn't save tracking ID on sales log page.
Download this release
Release Info
Developer | garyc40 |
Plugin | WP eCommerce |
Version | 3.8.8.1 |
Comparing to | |
See all releases |
Code changes from version 3.8.8 to 3.8.8.1
- readme.txt +15 -3
- wp-shopping-cart.php +1 -1
- wpsc-admin/includes/product-functions.php +20 -117
- wpsc-admin/includes/purchase-log-list-table-class.php +11 -6
- wpsc-admin/includes/settings-tabs/gateway.php +0 -1
- wpsc-admin/includes/settings-tabs/import.php +205 -143
- wpsc-admin/includes/settings-tabs/shipping.php +7 -13
- wpsc-admin/js/admin.js +11 -0
- wpsc-admin/js/purchase-logs.js +15 -5
- wpsc-admin/js/settings-page.js +1 -0
- wpsc-admin/settings-page.php +99 -14
- wpsc-core/wpsc-constants.php +3 -3
- wpsc-core/wpsc-functions.php +16 -2
- wpsc-includes/currency_converter.inc.php +17 -17
- wpsc-includes/theme.functions.php +4 -3
- wpsc-merchants/paypal-express.merchant.php +2 -2
- wpsc-merchants/paypal-pro.merchant.php +1 -1
- wpsc-merchants/paypal-standard.merchant.php +1 -1
readme.txt
CHANGED
@@ -3,14 +3,14 @@ Contributors: mufasa, jghazally, valentinas, mychelle, garyc40, justinsainton
|
|
3 |
Donate link: http://getshopped.org
|
4 |
Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
|
5 |
Requires at least: 3.1
|
6 |
-
Tested up to: 3.3.
|
7 |
-
Stable tag: 3.8.8
|
8 |
|
9 |
WP e-Commerce is a free WordPress Shopping Cart Plugin that lets customers buy your products, services and digital downloads online.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
We make setting up an ecommerce shop easy, and with over 1.
|
14 |
|
15 |
Features:
|
16 |
|
@@ -156,6 +156,18 @@ After upgrading from earlier versions look for link "Update Store". This will up
|
|
156 |
|
157 |
|
158 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
= 3.8.8 =
|
160 |
* New: 3 action hooks to process PayPal IPN responses: wpsc_paypal_pro_ipn, wpsc_paypal_standard_ipn and wpsc_paypal_express_ipn.
|
161 |
* New: Actions for bulk actions on sales page: wpsc_sales_log_process_bulk_action, wpsc_sales_log_extra_tablenav
|
3 |
Donate link: http://getshopped.org
|
4 |
Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
|
5 |
Requires at least: 3.1
|
6 |
+
Tested up to: 3.3.2
|
7 |
+
Stable tag: 3.8.8.1
|
8 |
|
9 |
WP e-Commerce is a free WordPress Shopping Cart Plugin that lets customers buy your products, services and digital downloads online.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
We make setting up an ecommerce shop easy, and with over 1.8 Million downloads, we have unparalleled experience.
|
14 |
|
15 |
Features:
|
16 |
|
156 |
|
157 |
|
158 |
== Changelog ==
|
159 |
+
= 3.8.8.1 =
|
160 |
+
* Fix: CSV import not working in 3.8.8.
|
161 |
+
* Fix: Category page display setting does not override default Presentation settings.
|
162 |
+
* Fix: Clicking All/None in Category target market settings doesn't work.
|
163 |
+
* Fix: Non-SSL stylesheet is loaded even when force SSL for checkout page is on.
|
164 |
+
* Fix: PHP Warning and Notice in sales log page.
|
165 |
+
* Fix: PayPal currency converter is wrong.
|
166 |
+
* Fix: Sales logs are not displayed for some installations.
|
167 |
+
* Fix: Sales logs page sometimes display empty customers' names.
|
168 |
+
* Fix: Saving payment gateway settings erase Shipping settings.
|
169 |
+
* Fix: Sometimes clicking Save doesn't save tracking ID on sales log page.
|
170 |
+
|
171 |
= 3.8.8 =
|
172 |
* New: 3 action hooks to process PayPal IPN responses: wpsc_paypal_pro_ipn, wpsc_paypal_standard_ipn and wpsc_paypal_express_ipn.
|
173 |
* New: Actions for bulk actions on sales page: wpsc_sales_log_process_bulk_action, wpsc_sales_log_extra_tablenav
|
wp-shopping-cart.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WP e-Commerce
|
4 |
* Plugin URI: http://getshopped.org/
|
5 |
* Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
|
6 |
-
* Version: 3.8.8
|
7 |
* Author: Instinct Entertainment
|
8 |
* Author URI: http://getshopped.org/
|
9 |
**/
|
3 |
* Plugin Name: WP e-Commerce
|
4 |
* Plugin URI: http://getshopped.org/
|
5 |
* Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
|
6 |
+
* Version: 3.8.8.1
|
7 |
* Author: Instinct Entertainment
|
8 |
* Author URI: http://getshopped.org/
|
9 |
**/
|
wpsc-admin/includes/product-functions.php
CHANGED
@@ -272,31 +272,18 @@ function wpsc_sanitise_product_forms($post_data = null) {
|
|
272 |
$post_data = &$_POST;
|
273 |
}
|
274 |
|
275 |
-
$product = get_post(absint($post_data['post_ID']));
|
276 |
-
|
277 |
$post_data['name'] = isset($post_data['post_title']) ? $post_data['post_title'] : '';
|
278 |
$post_data['title'] = $post_data['name'];
|
279 |
$post_data['description'] = isset($post_data['content']) ? $post_data['content'] : '';
|
280 |
$post_data['additional_description'] = isset($post_data['additional_description']) ? $post_data['additional_description'] : '';
|
|
|
281 |
|
282 |
-
if($
|
283 |
-
$post_data['post_status'] = $product->post_status;
|
284 |
-
} else {
|
285 |
-
$post_data['post_status'] = 'draft';
|
286 |
-
}
|
287 |
-
|
288 |
-
if(isset($post_data['save']) && $product->post_status == 'inherit' && ( $product->post_parent == 0 || $product->post_parent == $product->ID ) ) {
|
289 |
-
$post_data['post_status'] = 'draft';
|
290 |
-
} else if(isset($post_data['publish'])) {
|
291 |
$post_data['post_status'] = 'publish';
|
292 |
} else if(isset($post_data['unpublish'])) {
|
293 |
$post_data['post_status'] = 'draft';
|
294 |
}
|
295 |
|
296 |
-
|
297 |
-
|
298 |
-
$post_meta['meta'] = (array)$_POST['meta'];
|
299 |
-
|
300 |
$post_data['meta']['_wpsc_price'] = (float)str_replace( ',','',$post_data['meta']['_wpsc_price'] );
|
301 |
$post_data['meta']['_wpsc_special_price'] = (float)str_replace( ',','',$post_data['meta']['_wpsc_special_price'] );
|
302 |
$post_data['meta']['_wpsc_sku'] = $post_data['meta']['_wpsc_sku'];
|
@@ -327,38 +314,6 @@ function wpsc_sanitise_product_forms($post_data = null) {
|
|
327 |
$post_data['meta']['_wpsc_product_metadata']['weight'] = (float)$weight;
|
328 |
$post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = $post_data['meta']['_wpsc_product_metadata']['weight_unit'];
|
329 |
|
330 |
-
// table rate price
|
331 |
-
$post_data['meta']['_wpsc_product_metadata']['table_rate_price'] = $post_data['table_rate_price'];
|
332 |
-
// if table_rate_price is unticked, wipe the table rate prices
|
333 |
-
if(!isset($post_data['table_rate_price']['state'])) $post_data['table_rate_price']['state'] = '';
|
334 |
-
if($post_data['table_rate_price']['state'] != 1) {
|
335 |
-
$post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'] = null;
|
336 |
-
$post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] = null;
|
337 |
-
}
|
338 |
-
foreach((array)$post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] as $key => $value){
|
339 |
-
if(empty($value)){
|
340 |
-
unset($post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'][$key]);
|
341 |
-
unset($post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'][$key]);
|
342 |
-
}
|
343 |
-
}
|
344 |
-
|
345 |
-
|
346 |
-
$post_data['meta']['_wpsc_product_metadata']['shipping']['local'] = (float)$post_data['meta']['_wpsc_product_metadata']['shipping']['local'];
|
347 |
-
$post_data['meta']['_wpsc_product_metadata']['shipping']['international'] = (float)$post_data['meta']['_wpsc_product_metadata']['shipping']['international'];
|
348 |
-
|
349 |
-
|
350 |
-
// Advanced Options
|
351 |
-
$post_data['meta']['_wpsc_product_metadata']['engraved'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['engraved'];
|
352 |
-
$post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'];
|
353 |
-
if(!isset($post_data['meta']['_wpsc_product_metadata']['google_prohibited'])) $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = '';
|
354 |
-
$post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['google_prohibited'];
|
355 |
-
$post_data['meta']['_wpsc_product_metadata']['external_link'] = (string)$post_data['meta']['_wpsc_product_metadata']['external_link'];
|
356 |
-
$post_data['meta']['_wpsc_product_metadata']['external_link_text'] = (string)$post_data['meta']['_wpsc_product_metadata']['external_link_text'];
|
357 |
-
$post_data['meta']['_wpsc_product_metadata']['external_link_target'] = (string)$post_data['meta']['_wpsc_product_metadata']['external_link_target'];
|
358 |
-
|
359 |
-
$post_data['meta']['_wpsc_product_metadata']['enable_comments'] = $post_data['meta']['_wpsc_product_metadata']['enable_comments'];
|
360 |
-
$post_data['meta']['_wpsc_product_metadata']['merchant_notes'] = $post_data['meta']['_wpsc_product_metadata']['merchant_notes'];
|
361 |
-
|
362 |
$post_data['files'] = $_FILES;
|
363 |
return $post_data;
|
364 |
}
|
@@ -373,13 +328,6 @@ function wpsc_insert_product($post_data, $wpsc_error = false) {
|
|
373 |
global $wpdb, $user_ID;
|
374 |
$adding = false;
|
375 |
$update = false;
|
376 |
-
if((int)$post_data['post_ID'] > 0) {
|
377 |
-
$product_id = absint($post_data['post_ID']);
|
378 |
-
$update = true;
|
379 |
-
} else if((int)$post_data['product_id'] > 0) {
|
380 |
-
$product_id = absint($post_data['product_id']);
|
381 |
-
$update = true;
|
382 |
-
}
|
383 |
|
384 |
$product_columns = array(
|
385 |
'name' => '',
|
@@ -419,7 +367,6 @@ function wpsc_insert_product($post_data, $wpsc_error = false) {
|
|
419 |
}
|
420 |
|
421 |
$product_post_values = array(
|
422 |
-
'ID' => $product_id,
|
423 |
'post_author' => $user_ID,
|
424 |
'post_content' => $post_data['description'],
|
425 |
'post_excerpt' => $post_data['additional_description'],
|
@@ -428,11 +375,7 @@ function wpsc_insert_product($post_data, $wpsc_error = false) {
|
|
428 |
'post_type' => "wpsc-product",
|
429 |
'post_name' => sanitize_title($post_data['name'])
|
430 |
);
|
431 |
-
|
432 |
-
$product_post_values["comment_status"] = "closed";
|
433 |
-
}else {
|
434 |
-
$product_post_values["comment_status"] = "open";
|
435 |
-
}
|
436 |
|
437 |
if(isset($sku) && ($sku != '')) {
|
438 |
$product_post_array['guid'] = $sku;
|
@@ -440,66 +383,26 @@ function wpsc_insert_product($post_data, $wpsc_error = false) {
|
|
440 |
|
441 |
|
442 |
|
443 |
-
|
444 |
-
|
445 |
-
$product_id
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
} else {
|
455 |
-
return false;
|
456 |
-
}
|
457 |
-
}
|
458 |
-
} else {
|
459 |
-
$product_post_values += array(
|
460 |
-
'post_date' => $product['date_added']
|
461 |
-
);
|
462 |
-
$product_id = wp_insert_post($product_post_values);
|
463 |
-
if ( isset ( $post_data["sticky"] ) ) {
|
464 |
-
stick_post($product_id);
|
465 |
-
}else {
|
466 |
-
unstick_post($product_id);
|
467 |
-
}
|
468 |
-
if ($product_id == 0 ) {
|
469 |
-
if ( $wp_error ) {
|
470 |
-
return new WP_Error('db_insert_error', __( 'Could not insert product into the database', 'wpsc' ), $wpdb->last_error);
|
471 |
-
} else {
|
472 |
-
return 0;
|
473 |
-
}
|
474 |
}
|
475 |
-
|
476 |
-
|
477 |
|
478 |
// if we succeed, we can do further editing
|
479 |
|
480 |
// and the meta
|
481 |
wpsc_update_product_meta($product_id, $post_data['meta']);
|
482 |
-
|
483 |
-
// and the custom meta
|
484 |
-
wpsc_update_custom_meta($product_id, $post_data);
|
485 |
-
|
486 |
-
//and the alt currency
|
487 |
-
foreach((array)$post_data['newCurrency'] as $key =>$value){
|
488 |
-
wpsc_update_alt_product_currency($product_id, $value, $post_data['newCurrPrice'][$key]);
|
489 |
-
}
|
490 |
-
|
491 |
-
if($post_data['files']['file']['tmp_name'] != '') {
|
492 |
-
wpsc_item_process_file($product_id, $post_data['files']['file']);
|
493 |
-
} else {
|
494 |
-
if (!isset($post_data['select_product_file'])) $post_data['select_product_file'] = null;
|
495 |
-
wpsc_item_reassign_file($product_id, $post_data['select_product_file']);
|
496 |
-
}
|
497 |
-
|
498 |
-
if(isset($post_data['files']['preview_file']['tmp_name']) && ($post_data['files']['preview_file']['tmp_name'] != '')) {
|
499 |
-
wpsc_item_add_preview_file($product_id, $post_data['files']['preview_file']);
|
500 |
-
}
|
501 |
do_action('wpsc_edit_product', $product_id);
|
502 |
-
wpsc_ping();
|
503 |
return $product_id;
|
504 |
}
|
505 |
|
@@ -615,12 +518,12 @@ function wpsc_determine_variation_price( $variation_id, $term_ids = false ) {
|
|
615 |
*/
|
616 |
function wpsc_edit_product_variations($product_id, $post_data) {
|
617 |
global $user_ID;
|
618 |
-
|
619 |
$parent = get_post_field( 'post_parent', $product_id );
|
620 |
-
|
621 |
if( ! empty( $parent ) )
|
622 |
return;
|
623 |
-
|
624 |
$variations = array();
|
625 |
$product_children = array();
|
626 |
if (!isset($post_data['edit_var_val']))
|
@@ -789,7 +692,7 @@ function wpsc_edit_product_variations($product_id, $post_data) {
|
|
789 |
|
790 |
function wpsc_update_alt_product_currency($product_id, $newCurrency, $newPrice){
|
791 |
global $wpdb;
|
792 |
-
|
793 |
$old_curr = get_product_meta($product_id, 'currency',true);
|
794 |
$sql = $wpdb->prepare( "SELECT `isocode` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`= %d", $newCurrency );
|
795 |
$isocode = $wpdb->get_var($sql);
|
272 |
$post_data = &$_POST;
|
273 |
}
|
274 |
|
|
|
|
|
275 |
$post_data['name'] = isset($post_data['post_title']) ? $post_data['post_title'] : '';
|
276 |
$post_data['title'] = $post_data['name'];
|
277 |
$post_data['description'] = isset($post_data['content']) ? $post_data['content'] : '';
|
278 |
$post_data['additional_description'] = isset($post_data['additional_description']) ? $post_data['additional_description'] : '';
|
279 |
+
$post_data['post_status'] = 'draft';
|
280 |
|
281 |
+
if(isset($post_data['publish'])) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
$post_data['post_status'] = 'publish';
|
283 |
} else if(isset($post_data['unpublish'])) {
|
284 |
$post_data['post_status'] = 'draft';
|
285 |
}
|
286 |
|
|
|
|
|
|
|
|
|
287 |
$post_data['meta']['_wpsc_price'] = (float)str_replace( ',','',$post_data['meta']['_wpsc_price'] );
|
288 |
$post_data['meta']['_wpsc_special_price'] = (float)str_replace( ',','',$post_data['meta']['_wpsc_special_price'] );
|
289 |
$post_data['meta']['_wpsc_sku'] = $post_data['meta']['_wpsc_sku'];
|
314 |
$post_data['meta']['_wpsc_product_metadata']['weight'] = (float)$weight;
|
315 |
$post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = $post_data['meta']['_wpsc_product_metadata']['weight_unit'];
|
316 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
$post_data['files'] = $_FILES;
|
318 |
return $post_data;
|
319 |
}
|
328 |
global $wpdb, $user_ID;
|
329 |
$adding = false;
|
330 |
$update = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
|
332 |
$product_columns = array(
|
333 |
'name' => '',
|
367 |
}
|
368 |
|
369 |
$product_post_values = array(
|
|
|
370 |
'post_author' => $user_ID,
|
371 |
'post_content' => $post_data['description'],
|
372 |
'post_excerpt' => $post_data['additional_description'],
|
375 |
'post_type' => "wpsc-product",
|
376 |
'post_name' => sanitize_title($post_data['name'])
|
377 |
);
|
378 |
+
$product_post_values["comment_status"] = "open";
|
|
|
|
|
|
|
|
|
379 |
|
380 |
if(isset($sku) && ($sku != '')) {
|
381 |
$product_post_array['guid'] = $sku;
|
383 |
|
384 |
|
385 |
|
386 |
+
$product_id = wp_insert_post($product_post_values);
|
387 |
+
if ( isset ( $post_data["sticky"] ) ) {
|
388 |
+
stick_post($product_id);
|
389 |
+
}else {
|
390 |
+
unstick_post($product_id);
|
391 |
+
}
|
392 |
+
if ($product_id == 0 ) {
|
393 |
+
if ( $wp_error ) {
|
394 |
+
return new WP_Error('db_insert_error', __( 'Could not insert product into the database', 'wpsc' ), $wpdb->last_error);
|
395 |
+
} else {
|
396 |
+
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
}
|
398 |
+
}
|
399 |
+
$adding = true;
|
400 |
|
401 |
// if we succeed, we can do further editing
|
402 |
|
403 |
// and the meta
|
404 |
wpsc_update_product_meta($product_id, $post_data['meta']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
do_action('wpsc_edit_product', $product_id);
|
|
|
406 |
return $product_id;
|
407 |
}
|
408 |
|
518 |
*/
|
519 |
function wpsc_edit_product_variations($product_id, $post_data) {
|
520 |
global $user_ID;
|
521 |
+
|
522 |
$parent = get_post_field( 'post_parent', $product_id );
|
523 |
+
|
524 |
if( ! empty( $parent ) )
|
525 |
return;
|
526 |
+
|
527 |
$variations = array();
|
528 |
$product_children = array();
|
529 |
if (!isset($post_data['edit_var_val']))
|
692 |
|
693 |
function wpsc_update_alt_product_currency($product_id, $newCurrency, $newPrice){
|
694 |
global $wpdb;
|
695 |
+
|
696 |
$old_curr = get_product_meta($product_id, 'currency',true);
|
697 |
$sql = $wpdb->prepare( "SELECT `isocode` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`= %d", $newCurrency );
|
698 |
$isocode = $wpdb->get_var($sql);
|
wpsc-admin/includes/purchase-log-list-table-class.php
CHANGED
@@ -51,7 +51,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table
|
|
51 |
$offset = ( $page - 1 ) * $this->per_page;
|
52 |
|
53 |
$checkout_fields_sql = "
|
54 |
-
SELECT id, unique_name FROM " . WPSC_TABLE_CHECKOUT_FORMS . " WHERE unique_name IN ('billingfirstname', 'billinglastname', 'billingemail')
|
55 |
";
|
56 |
$checkout_fields = $wpdb->get_results( $checkout_fields_sql );
|
57 |
|
@@ -75,7 +75,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table
|
|
75 |
$table_as = 's' . $i;
|
76 |
$select_as = str_replace('billing', '', $field->unique_name );
|
77 |
$selects[] = $table_as . '.value AS ' . $select_as;
|
78 |
-
$joins[] = $wpdb->prepare( "
|
79 |
|
80 |
// build search term queries for first name, last name, email
|
81 |
foreach ( $search_terms as $term ) {
|
@@ -137,7 +137,6 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table
|
|
137 |
{$limit}
|
138 |
";
|
139 |
$this->items = $wpdb->get_results( $purchase_log_sql );
|
140 |
-
|
141 |
if ( $this->per_page ) {
|
142 |
$total_items = $wpdb->get_var( "SELECT FOUND_ROWS()" );
|
143 |
|
@@ -221,11 +220,17 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table
|
|
221 |
|
222 |
$sql = "SELECT DISTINCT processed, COUNT(*) AS count FROM " . WPSC_TABLE_PURCHASE_LOGS . " GROUP BY processed ORDER BY processed";
|
223 |
$results = $wpdb->get_results( $sql );
|
224 |
-
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
}
|
227 |
|
228 |
-
$total_count = array_sum( $statuses );
|
229 |
$all_text = sprintf(
|
230 |
_nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_count, 'purchase logs', 'wpsc' ),
|
231 |
number_format_i18n( $total_count )
|
51 |
$offset = ( $page - 1 ) * $this->per_page;
|
52 |
|
53 |
$checkout_fields_sql = "
|
54 |
+
SELECT id, unique_name FROM " . WPSC_TABLE_CHECKOUT_FORMS . " WHERE unique_name IN ('billingfirstname', 'billinglastname', 'billingemail') AND active='1' AND checkout_set='0'
|
55 |
";
|
56 |
$checkout_fields = $wpdb->get_results( $checkout_fields_sql );
|
57 |
|
75 |
$table_as = 's' . $i;
|
76 |
$select_as = str_replace('billing', '', $field->unique_name );
|
77 |
$selects[] = $table_as . '.value AS ' . $select_as;
|
78 |
+
$joins[] = $wpdb->prepare( "LEFT OUTER JOIN " . WPSC_TABLE_SUBMITED_FORM_DATA . " AS {$table_as} ON {$table_as}.log_id = p.id AND {$table_as}.form_id = %d", $field->id );
|
79 |
|
80 |
// build search term queries for first name, last name, email
|
81 |
foreach ( $search_terms as $term ) {
|
137 |
{$limit}
|
138 |
";
|
139 |
$this->items = $wpdb->get_results( $purchase_log_sql );
|
|
|
140 |
if ( $this->per_page ) {
|
141 |
$total_items = $wpdb->get_var( "SELECT FOUND_ROWS()" );
|
142 |
|
220 |
|
221 |
$sql = "SELECT DISTINCT processed, COUNT(*) AS count FROM " . WPSC_TABLE_PURCHASE_LOGS . " GROUP BY processed ORDER BY processed";
|
222 |
$results = $wpdb->get_results( $sql );
|
223 |
+
$statuses = array();
|
224 |
+
$total_count = 0;
|
225 |
+
|
226 |
+
if ( ! empty( $results ) ) {
|
227 |
+
foreach ( $results as $status ) {
|
228 |
+
$statuses[$status->processed] = $status->count;
|
229 |
+
}
|
230 |
+
|
231 |
+
$total_count = array_sum( $statuses );
|
232 |
}
|
233 |
|
|
|
234 |
$all_text = sprintf(
|
235 |
_nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_count, 'purchase logs', 'wpsc' ),
|
236 |
number_format_i18n( $total_count )
|
wpsc-admin/includes/settings-tabs/gateway.php
CHANGED
@@ -159,7 +159,6 @@ class WPSC_Settings_Tab_Gateway extends WPSC_Settings_Tab
|
|
159 |
<?php }
|
160 |
?>
|
161 |
<div class='submit gateway_settings'>
|
162 |
-
<input type='hidden' value='true' name='update_gateways' />
|
163 |
<input type='submit' value='<?php _e( 'Update »', 'wpsc' ) ?>' name='updateoption' />
|
164 |
</div>
|
165 |
</div>
|
159 |
<?php }
|
160 |
?>
|
161 |
<div class='submit gateway_settings'>
|
|
|
162 |
<input type='submit' value='<?php _e( 'Update »', 'wpsc' ) ?>' name='updateoption' />
|
163 |
</div>
|
164 |
</div>
|
wpsc-admin/includes/settings-tabs/import.php
CHANGED
@@ -2,161 +2,223 @@
|
|
2 |
|
3 |
class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab
|
4 |
{
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
<input type='file' name='csv_file' />
|
12 |
-
<input type='submit' value='Import' class='button-primary'>
|
13 |
-
<?php
|
14 |
-
if ( isset( $_FILES['csv_file']['name'] ) && ($_FILES['csv_file']['name'] != '') ) {
|
15 |
-
ini_set( "auto_detect_line_endings", 1 );
|
16 |
-
$file = $_FILES['csv_file'];
|
17 |
-
if ( move_uploaded_file( $file['tmp_name'], WPSC_FILE_DIR . $file['name'] ) ) {
|
18 |
-
$content = file_get_contents( WPSC_FILE_DIR . $file['name'] );
|
19 |
-
$handle = @fopen( WPSC_FILE_DIR . $file['name'], 'r' );
|
20 |
-
while ( ($csv_data = @fgetcsv( $handle, filesize( $handle ), "," )) !== false ) {
|
21 |
-
$fields = count( $csv_data );
|
22 |
-
for ( $i = 0; $i < $fields; $i++ ) {
|
23 |
-
if ( !is_array( $data1[$i] ) ) {
|
24 |
-
$data1[$i] = array( );
|
25 |
-
}
|
26 |
-
array_push( $data1[$i], $csv_data[$i] );
|
27 |
-
}
|
28 |
-
}
|
29 |
-
|
30 |
-
$_SESSION['cvs_data'] = $data1;
|
31 |
-
$categories = get_terms( 'wpsc_product_category', 'hide_empty=0&parent=' . $category_id );
|
32 |
-
?>
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
<table>
|
42 |
-
<tr><td style='width:80%;'>
|
43 |
-
<?php _e( 'Select if you would like to import your products in as Drafts or Publish them right away.' , 'wpsc' ); ?>
|
44 |
-
<br />
|
45 |
-
</td><td>
|
46 |
-
<select name='post_status'>
|
47 |
-
<option value='publish'><?php _e('Publish', 'wpsc'); ?></option>
|
48 |
-
<option value='draft'><?php _e('Draft', 'wpsc'); ?></option>
|
49 |
-
</select>
|
50 |
-
</td></tr>
|
51 |
-
</table>
|
52 |
-
</div>
|
53 |
-
</div>
|
54 |
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
?>
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
<br />
|
70 |
-
</td
|
71 |
-
|
72 |
-
|
73 |
-
<option value='
|
74 |
-
<option value='
|
75 |
-
<option value='
|
76 |
-
<option value='
|
77 |
-
<option value='
|
78 |
-
<option value='
|
79 |
-
<option value='
|
80 |
-
<option value='
|
81 |
-
<option value='
|
82 |
</select>
|
83 |
-
</td
|
|
|
84 |
</table>
|
85 |
</div>
|
86 |
</div>
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
<?php
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
</select>
|
96 |
-
<input type='submit' value='Import' class='button-primary'>
|
97 |
-
</div>
|
98 |
-
<?php
|
99 |
-
} else {
|
100 |
-
echo "<br /><br />" . __('There was an error while uploading your csv file.', 'wpsc');
|
101 |
-
}
|
102 |
-
}
|
103 |
-
if ( isset( $_POST['csv_action'] ) && ('import' == $_POST['csv_action']) ) {
|
104 |
-
$cvs_data = $_SESSION['cvs_data'];
|
105 |
-
$column_data = $_POST['column'];
|
106 |
-
$value_data = $_POST['value_name'];
|
107 |
-
|
108 |
-
$status = esc_attr($_POST['post_status']);
|
109 |
-
|
110 |
-
$name = array( );
|
111 |
-
foreach ( $value_data as $key => $value ) {
|
112 |
-
|
113 |
-
$cvs_data2[$value] = $cvs_data[$key];
|
114 |
-
}
|
115 |
-
$num = count( $cvs_data2['name'] );
|
116 |
-
|
117 |
-
for ( $i = 0; $i < $num; $i++ ) {
|
118 |
-
$product_columns = array(
|
119 |
-
'post_title' => esc_attr( $cvs_data2['name'][$i] ),
|
120 |
-
'content' => esc_attr( $cvs_data2['description'][$i] ),
|
121 |
-
'additional_description' => esc_attr( $cvs_data2['additional_description'][$i] ),
|
122 |
-
'price' => esc_attr( str_replace( '$', '', $cvs_data2['price'][$i] ) ),
|
123 |
-
'weight' => esc_attr( $cvs_data2['weight'][$i] ),
|
124 |
-
'weight_unit' => esc_attr( $cvs_data2['weight_unit'][$i] ),
|
125 |
-
'pnp' => null,
|
126 |
-
'international_pnp' => null,
|
127 |
-
'file' => null,
|
128 |
-
'image' => '0',
|
129 |
-
'quantity_limited' => esc_attr( $cvs_data2['quantity_limited'][$i] ),
|
130 |
-
'quantity' => esc_attr( $cvs_data2['quantity'][$i] ),
|
131 |
-
'special' => null,
|
132 |
-
'special_price' => null,
|
133 |
-
'display_frontpage' => null,
|
134 |
-
'notax' => null,
|
135 |
-
'active' => null,
|
136 |
-
'donation' => null,
|
137 |
-
'no_shipping' => null,
|
138 |
-
'thumbnail_image' => null,
|
139 |
-
'thumbnail_state' => null,
|
140 |
-
'meta' => array(
|
141 |
-
'_wpsc_price' => esc_attr( str_replace( '$', '', $cvs_data2['price'][$i] ) ),
|
142 |
-
'_wpsc_sku' => esc_attr( $cvs_data2['sku'][$i] ),
|
143 |
-
'_wpsc_stock' => esc_attr( $cvs_data2['quantity'][$i] ),
|
144 |
-
'_wpsc_limited_stock' => esc_attr( $cvs_data2['quantity_limited'][$i] ),
|
145 |
-
'_wpsc_product_metadata' => array(
|
146 |
-
'weight' => esc_attr( $cvs_data2['weight'][$i] ),
|
147 |
-
'weight_unit' => esc_attr( $cvs_data2['weight_unit'][$i] ),
|
148 |
-
)
|
149 |
-
)
|
150 |
-
);
|
151 |
-
$product_columns = wpsc_sanitise_product_forms( $product_columns );
|
152 |
-
// status needs to be set here because wpsc_sanitise_product_forms overwrites it :/
|
153 |
-
$product_columns['post_status'] = $status;
|
154 |
-
$product_id = wpsc_insert_product( $product_columns );
|
155 |
-
wp_set_object_terms( $product_id , array( (int)$_POST['category'] ) , 'wpsc_product_category' );
|
156 |
-
}
|
157 |
-
echo "<br /><br />". sprintf(__("Success, your <a href='%s'>products</a> have been upload.", "wpsc"), admin_url('edit.php?post_type=wpsc-product'));
|
158 |
-
}
|
159 |
?>
|
|
|
|
|
|
|
160 |
<?php
|
161 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
}
|
2 |
|
3 |
class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab
|
4 |
{
|
5 |
+
private $file = false;
|
6 |
+
private $step = 1;
|
7 |
+
private $display_data = array();
|
8 |
+
private $completed = false;
|
9 |
|
10 |
+
public function __construct() {
|
11 |
+
parent::__construct();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
$file = get_transient( 'wpsc_settings_tab_import_file' );
|
14 |
+
if ( $file )
|
15 |
+
$this->file = $file;
|
16 |
|
17 |
+
$this->step = empty( $_REQUEST['step'] ) ? 1 : (int) $_REQUEST['step'];
|
18 |
+
if ( $this->step < 1 || $this->step > 3 )
|
19 |
+
$this->step = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
switch ( $this->step ) {
|
22 |
+
case 2:
|
23 |
+
$this->prepare_import_columns();
|
24 |
+
break;
|
25 |
+
case 3:
|
26 |
+
$this->import_data();
|
27 |
+
break;
|
28 |
+
}
|
29 |
+
|
30 |
+
$this->hide_submit_button();
|
31 |
+
}
|
32 |
+
|
33 |
+
private function prepare_import_columns() {
|
34 |
+
$this->hide_update_message();
|
35 |
+
ini_set( 'auto_detect_line_endings', 1 );
|
36 |
+
$handle = @fopen( $this->file, 'r' );
|
37 |
+
|
38 |
+
if ( ! $handle ) {
|
39 |
+
$this->reset_state();
|
40 |
+
return;
|
41 |
+
}
|
42 |
+
|
43 |
+
$first_row = @fgetcsv( $handle );
|
44 |
+
$categories = get_terms( 'wpsc_product_category', 'hide_empty=0' );
|
45 |
+
|
46 |
+
$this->display_data = array(
|
47 |
+
'columns' => $first_row,
|
48 |
+
'categories' => $categories,
|
49 |
+
);
|
50 |
+
}
|
51 |
+
|
52 |
+
private function reset_state() {
|
53 |
+
delete_transient( 'wpsc_settings_tab_import_file' );
|
54 |
+
$this->file = false;
|
55 |
+
$this->completed = false;
|
56 |
+
$this->display_data = array();
|
57 |
+
}
|
58 |
+
|
59 |
+
private function import_data() {
|
60 |
+
ini_set( 'auto_detect_line_endings', 1 );
|
61 |
+
$handle = @fopen( $this->file, 'r' );
|
62 |
+
if ( ! $handle ) {
|
63 |
+
$this->reset_state();
|
64 |
+
return;
|
65 |
+
}
|
66 |
+
|
67 |
+
$length = filesize( $this->file );
|
68 |
+
|
69 |
+
$column_map = array_flip( $_POST['value_name'] );
|
70 |
+
extract( $column_map, EXTR_SKIP );
|
71 |
+
|
72 |
+
while ( $row = @fgetcsv( $handle, $length, ',' ) ) {
|
73 |
+
$product = array(
|
74 |
+
'post_title' => isset( $row[$column_name] ) ? $row[$column_name] : '',
|
75 |
+
'content' => isset( $row[$column_description] ) ? $row[$column_description] : '',
|
76 |
+
'additional_description' => isset( $row[$column_additional_description] ) ? $row[$column_additional_description] : '',
|
77 |
+
'price' => isset( $row[$column_price] ) ? str_replace( '$', '', $row[$column_price] ) : 0,
|
78 |
+
'weight' => isset( $row[$column_weight] ) ? $row[$column_weight] : '',
|
79 |
+
'weight_unit' => isset( $row[$column_weight_unit] ) ? $row[$column_weight_unit] : '',
|
80 |
+
'pnp' => null,
|
81 |
+
'international_pnp' => null,
|
82 |
+
'file' => null,
|
83 |
+
'image' => '0',
|
84 |
+
'quantity_limited' => isset( $row[$column_quantity_limited] ) ? $row[$column_quantity_limited] : '',
|
85 |
+
'quantity' => isset( $row[$column_quantity] ) ? $row[$column_quantity] : null,
|
86 |
+
'special' => null,
|
87 |
+
'special_price' => null,
|
88 |
+
'display_frontpage' => null,
|
89 |
+
'notax' => null,
|
90 |
+
'active' => null,
|
91 |
+
'donation' => null,
|
92 |
+
'no_shipping' => null,
|
93 |
+
'thumbnail_image' => null,
|
94 |
+
'thumbnail_state' => null,
|
95 |
+
'meta' => array(
|
96 |
+
'_wpsc_price' => isset( $row[$column_price] ) ? str_replace( '$', '', $row[$column_price] ) : 0,
|
97 |
+
'_wpsc_special_price' => '',
|
98 |
+
'_wpsc_sku' => isset( $row[$column_sku] ) ? $row[$column_sku] : '',
|
99 |
+
'_wpsc_stock' => isset( $row[$column_quantity] ) ? $row[$column_quantity] : null,
|
100 |
+
'_wpsc_limited_stock' => isset( $row[$column_quantity_limited] ) ? $row[$column_quantity_limited] : '',
|
101 |
+
'_wpsc_product_metadata' => array(
|
102 |
+
'weight' => isset( $row[$column_weight] ) ? $row[$column_weight] : '',
|
103 |
+
'weight_unit' => isset( $row[$column_weight_unit] ) ? $row[$column_weight_unit] : '',
|
104 |
+
)
|
105 |
+
)
|
106 |
+
);
|
107 |
+
|
108 |
+
$product = wpsc_sanitise_product_forms( $product );
|
109 |
+
// status needs to be set here because wpsc_sanitise_product_forms overwrites it :/
|
110 |
+
$product['post_status'] = $_POST['post_status'];
|
111 |
+
$product_id = wpsc_insert_product( $product );
|
112 |
+
wp_set_object_terms( $product_id , array( (int)$_POST['category'] ) , 'wpsc_product_category' );
|
113 |
+
}
|
114 |
+
|
115 |
+
$this->reset_state();
|
116 |
+
$this->completed = true;
|
117 |
+
add_settings_error( 'wpsc-settings', 'settings_updated', __( 'CSV file imported.', 'wpsc' ), 'updated' );
|
118 |
+
}
|
119 |
+
|
120 |
+
public function callback_submit_options() {
|
121 |
+
if ( isset( $_FILES['csv_file'] ) && isset( $_FILES['csv_file']['name'] ) && ($_FILES['csv_file']['name'] != '') ) {
|
122 |
+
$this->hide_update_message();
|
123 |
+
ini_set( 'auto_detect_line_endings', 1 );
|
124 |
+
$file = $_FILES['csv_file'];
|
125 |
+
$file_path = WPSC_FILE_DIR . $file['name'];
|
126 |
+
if ( move_uploaded_file( $file['tmp_name'], WPSC_FILE_DIR . $file['name'] ) ) {
|
127 |
+
set_transient( 'wpsc_settings_tab_import_file', $file_path );
|
128 |
+
return array( 'step' => 2 );
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
if ( $this->completed )
|
133 |
+
return array( 'step' => 1 );
|
134 |
+
|
135 |
+
return array( 'step' => $this->step + 1 );
|
136 |
+
}
|
137 |
+
|
138 |
+
private function display_imported_columns() {
|
139 |
+
extract( $this->display_data );
|
140 |
?>
|
141 |
+
<p><?php _e( 'For each column, select the field it corresponds to in \'Belongs to\'. You can upload as many products as you like.', 'wpsc' ); ?></p>
|
142 |
+
<div class='metabox-holder' style='width:90%'>
|
143 |
+
<div style='width:100%;' class='postbox'>
|
144 |
+
<h3 class='hndle'><?php _e('Product Status' , 'wpsc' ); ?></h3>
|
145 |
+
<div class='inside'>
|
146 |
+
<table>
|
147 |
+
<tr>
|
148 |
+
<td style='width:80%;'>
|
149 |
+
<?php _e( 'Select if you would like to import your products in as Drafts or Publish them right away.' , 'wpsc' ); ?>
|
150 |
+
<br />
|
151 |
+
</td>
|
152 |
+
<td>
|
153 |
+
<select name='post_status'>
|
154 |
+
<option value='publish'><?php _e( 'Publish', 'wpsc'); ?></option>
|
155 |
+
<option value='draft' ><?php _e( 'Draft' , 'wpsc'); ?></option>
|
156 |
+
</select>
|
157 |
+
</td>
|
158 |
+
</tr>
|
159 |
+
</table>
|
160 |
+
</div>
|
161 |
+
</div>
|
162 |
+
<?php foreach ( $columns as $key => $datum ): ?>
|
163 |
+
<div style='width:100%;' class='postbox'>
|
164 |
+
<h3 class='hndle'><?php printf(__('Column (%s)', 'wpsc'), ($key + 1)); ?></h3>
|
165 |
+
<div class='inside'>
|
166 |
+
<table>
|
167 |
+
<tr>
|
168 |
+
<td style='width:80%;'>
|
169 |
+
<?php echo $datum; ?>
|
170 |
<br />
|
171 |
+
</td>
|
172 |
+
<td>
|
173 |
+
<select name='value_name[<?php echo $key; ?>]'>
|
174 |
+
<option <?php selected( $key, 0 ); ?> value='column_name' ><?php _e('Product Name' , 'wpsc'); ?></option>
|
175 |
+
<option <?php selected( $key, 1 ); ?> value='column_description' ><?php _e('Description' , 'wpsc'); ?></option>
|
176 |
+
<option <?php selected( $key, 2 ); ?> value='column_additional_description'><?php _e('Additional Description', 'wpsc'); ?></option>
|
177 |
+
<option <?php selected( $key, 3 ); ?> value='column_price' ><?php _e('Price' , 'wpsc'); ?></option>
|
178 |
+
<option <?php selected( $key, 4 ); ?> value='column_sku' ><?php _e('SKU' , 'wpsc'); ?></option>
|
179 |
+
<option <?php selected( $key, 5 ); ?> value='column_weight' ><?php _e('Weight' , 'wpsc'); ?></option>
|
180 |
+
<option <?php selected( $key, 6 ); ?> value='column_weight_unit' ><?php _e('Weight Unit' , 'wpsc'); ?></option>
|
181 |
+
<option <?php selected( $key, 7 ); ?> value='column_quantity' ><?php _e('Stock Quantity' , 'wpsc'); ?></option>
|
182 |
+
<option <?php selected( $key, 8 ); ?> value='column_quantity_limited' ><?php _e('Stock Quantity Limit' , 'wpsc'); ?></option>
|
183 |
</select>
|
184 |
+
</td>
|
185 |
+
</tr>
|
186 |
</table>
|
187 |
</div>
|
188 |
</div>
|
189 |
+
<?php endforeach; ?>
|
190 |
+
<label for='category'><?php _e('Please select a category you would like to place all products from this CSV into' , 'wpsc' ); ?>:</label>
|
191 |
+
<select id='category' name='category'>
|
192 |
+
<?php foreach ( $categories as $category ): ?>
|
193 |
+
<option value="<?php echo $category->term_id; ?>"><?php echo esc_html( $category->name ); ?></option>
|
194 |
+
<?php endforeach; ?>
|
195 |
+
</select>
|
196 |
+
<input type="hidden" name="step" value="3" />
|
197 |
+
<input type='submit' value='<?php echo esc_html_x( 'Continue', 'import csv', 'wpsc' ); ?>' class='button-primary'>
|
198 |
+
</div>
|
199 |
<?php
|
200 |
+
}
|
201 |
+
|
202 |
+
private function display_default() {
|
203 |
+
extract( $this->display_data );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
?>
|
205 |
+
<?php _e( '<p>You can import your products from a comma delimited text file.</p><p>An example of a csv import file would look like this: </p><p>Description, Additional Description, Product Name, Price, SKU, weight, weight unit, stock quantity, is limited quantity</p>', 'wpsc' ); ?>
|
206 |
+
<input type='file' name='csv_file' />
|
207 |
+
<?php submit_button( esc_html_x( 'Upload', 'import csv', 'wpsc' ) ); ?>
|
208 |
<?php
|
209 |
}
|
210 |
+
|
211 |
+
public function display() {
|
212 |
+
switch ( $this->step ) {
|
213 |
+
case 1:
|
214 |
+
$this->display_default();
|
215 |
+
break;
|
216 |
+
case 2:
|
217 |
+
$this->display_imported_columns();
|
218 |
+
break;
|
219 |
+
default:
|
220 |
+
$this->display_default();
|
221 |
+
break;
|
222 |
+
}
|
223 |
+
}
|
224 |
}
|
wpsc-admin/includes/settings-tabs/shipping.php
CHANGED
@@ -133,13 +133,11 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab
|
|
133 |
$shipwire2 = "";
|
134 |
switch ( get_option( 'shipwire' ) ) {
|
135 |
case 1:
|
136 |
-
$shipwire1 = "checked ='checked'";
|
137 |
$shipwire_settings = 'style=\'display: block;\'';
|
138 |
break;
|
139 |
|
140 |
case 0:
|
141 |
default:
|
142 |
-
$shipwire2 = "checked ='checked'";
|
143 |
$shipwire_settings = '';
|
144 |
break;
|
145 |
}
|
@@ -150,17 +148,13 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab
|
|
150 |
<?php _e( 'ShipWire Settings', 'wpsc' ); ?><span style='color: red;'></span> :
|
151 |
</th>
|
152 |
<td>
|
153 |
-
<input type='radio' onclick='jQuery("#wpsc_shipwire_setting").show()' value='1' name='wpsc_options[shipwire]' id='shipwire1' <?php
|
154 |
-
<input type='radio' onclick='jQuery("#wpsc_shipwire_setting").hide()' value='0' name='wpsc_options[shipwire]' id='shipwire2' <?php
|
155 |
-
<?php
|
156 |
-
$shipwireemail = esc_attr_e( get_option( "shipwireemail" ) );
|
157 |
-
$shipwirepassword = esc_attr_e( get_option( "shipwirepassword" ) );
|
158 |
-
?>
|
159 |
<div id='wpsc_shipwire_setting' <?php echo $shipwire_settings; ?>>
|
160 |
<table>
|
161 |
-
<tr><td><?php _e( 'ShipWire Email', 'wpsc' ); ?> :</td><td> <input type="text" name='wpsc_options[shipwireemail]' value="<?php
|
162 |
-
<tr><td><?php _e( 'ShipWire Password', 'wpsc' ); ?> :</td><td><input type="text" name='wpsc_options[shipwirepassword]' value="<?php
|
163 |
-
<tr><td><a
|
164 |
</table>
|
165 |
</div>
|
166 |
</td>
|
@@ -235,7 +229,7 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab
|
|
235 |
</span>
|
236 |
</div>
|
237 |
|
238 |
-
<p><input name='custom_shipping_options[]' <?php echo $shipping->checked; ?> type='checkbox' value='<?php echo $shipping->internal_name; ?>' id='<?php echo $shipping->internal_name; ?>_id' /><label for='<?php echo $shipping->internal_name; ?>_id'
|
239 |
</div>
|
240 |
<?php } ?>
|
241 |
<br />
|
@@ -264,7 +258,7 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab
|
|
264 |
<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
|
265 |
</span>
|
266 |
</div>
|
267 |
-
<p><input <?php echo $disabled; ?> name='custom_shipping_options[]' <?php echo $shipping->checked; ?> type='checkbox' value='<?php echo $shipping->internal_name; ?>' id='<?php echo $shipping->internal_name; ?>_id' /><label for='<?php echo $shipping->internal_name; ?>_id'
|
268 |
</div>
|
269 |
<?php } ?>
|
270 |
<p class="submit">
|
133 |
$shipwire2 = "";
|
134 |
switch ( get_option( 'shipwire' ) ) {
|
135 |
case 1:
|
|
|
136 |
$shipwire_settings = 'style=\'display: block;\'';
|
137 |
break;
|
138 |
|
139 |
case 0:
|
140 |
default:
|
|
|
141 |
$shipwire_settings = '';
|
142 |
break;
|
143 |
}
|
148 |
<?php _e( 'ShipWire Settings', 'wpsc' ); ?><span style='color: red;'></span> :
|
149 |
</th>
|
150 |
<td>
|
151 |
+
<input type='radio' onclick='jQuery("#wpsc_shipwire_setting").show()' value='1' name='wpsc_options[shipwire]' id='shipwire1' <?php checked( '1', get_option( 'shipwire' ) ); ?> /> <label for='shipwire1'><?php _e( 'Yes', 'wpsc' ); ?></label>
|
152 |
+
<input type='radio' onclick='jQuery("#wpsc_shipwire_setting").hide()' value='0' name='wpsc_options[shipwire]' id='shipwire2' <?php checked( '0', get_option( 'shipwire' ) ); ?> /> <label for='shipwire2'><?php _e( 'No', 'wpsc' ); ?></label>
|
|
|
|
|
|
|
|
|
153 |
<div id='wpsc_shipwire_setting' <?php echo $shipwire_settings; ?>>
|
154 |
<table>
|
155 |
+
<tr><td><?php _e( 'ShipWire Email', 'wpsc' ); ?> :</td><td> <input type="text" name='wpsc_options[shipwireemail]' value="<?php esc_attr_e( get_option( 'shipwireemail' ) ); ?>" /></td></tr>
|
156 |
+
<tr><td><?php _e( 'ShipWire Password', 'wpsc' ); ?> :</td><td><input type="text" name='wpsc_options[shipwirepassword]' value="<?php esc_attr_e( get_option( 'shipwirepassword' ) ); ?>" /></td></tr>
|
157 |
+
<tr><td><a class="shipwire_sync">Sync product</a></td></tr>
|
158 |
</table>
|
159 |
</div>
|
160 |
</td>
|
229 |
</span>
|
230 |
</div>
|
231 |
|
232 |
+
<p><input name='custom_shipping_options[]' <?php echo $shipping->checked; ?> type='checkbox' value='<?php echo $shipping->internal_name; ?>' id='<?php echo $shipping->internal_name; ?>_id' /><label for='<?php echo $shipping->internal_name; ?>_id'> <?php echo $shipping->name; ?></label></p>
|
233 |
</div>
|
234 |
<?php } ?>
|
235 |
<br />
|
258 |
<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
|
259 |
</span>
|
260 |
</div>
|
261 |
+
<p><input <?php echo $disabled; ?> name='custom_shipping_options[]' <?php echo $shipping->checked; ?> type='checkbox' value='<?php echo $shipping->internal_name; ?>' id='<?php echo $shipping->internal_name; ?>_id' /><label for='<?php echo $shipping->internal_name; ?>_id'> <?php esc_attr_e( $shipping->name ); ?></label></p>
|
262 |
</div>
|
263 |
<?php } ?>
|
264 |
<p class="submit">
|
wpsc-admin/js/admin.js
CHANGED
@@ -25,6 +25,17 @@
|
|
25 |
|
26 |
$('.edit-tags-php form').attr('enctype', 'multipart/form-data').attr('encoding', 'multipart/form-data');
|
27 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
})(jQuery);
|
30 |
|
25 |
|
26 |
$('.edit-tags-php form').attr('enctype', 'multipart/form-data').attr('encoding', 'multipart/form-data');
|
27 |
});
|
28 |
+
|
29 |
+
$(function() {
|
30 |
+
$('.wpsc_select_all').click(function(){
|
31 |
+
$('input:checkbox', $(this).parent().siblings('.multiple-select') ).each(function(){ this.checked = true; });
|
32 |
+
return false;
|
33 |
+
});
|
34 |
+
$('.wpsc_select_none').click(function(){
|
35 |
+
$('input:checkbox', $(this).parent().siblings('.multiple-select') ).each(function(){ this.checked = false; });
|
36 |
+
return false;
|
37 |
+
});
|
38 |
+
});
|
39 |
}
|
40 |
})(jQuery);
|
41 |
|
wpsc-admin/js/purchase-logs.js
CHANGED
@@ -11,7 +11,9 @@
|
|
11 |
delegate('.wpsc-purchase-log-tracking-id', 'blur', WPSC_Purchase_Logs_Admin.event_tracking_id_blurred).
|
12 |
delegate('.column-tracking a.save', 'click', WPSC_Purchase_Logs_Admin.event_button_save_clicked).
|
13 |
delegate('.column-tracking .send-email a', 'click', WPSC_Purchase_Logs_Admin.event_button_send_email_clicked).
|
14 |
-
delegate('.wpsc-purchase-log-tracking-id', 'keypress', WPSC_Purchase_Logs_Admin.event_enter_key_pressed)
|
|
|
|
|
15 |
|
16 |
});
|
17 |
},
|
@@ -50,8 +52,6 @@
|
|
50 |
},
|
51 |
|
52 |
event_button_save_clicked : function() {
|
53 |
-
WPSC_Purchase_Logs_Admin.reset_textbox_width = false;
|
54 |
-
|
55 |
var t = $(this), textbox = t.siblings('.wpsc-purchase-log-tracking-id'), spinner = t.siblings('.ajax-feedback');
|
56 |
|
57 |
var post_data = {
|
@@ -66,6 +66,7 @@
|
|
66 |
textbox.blur();
|
67 |
if (response == 'success') {
|
68 |
t.parent().removeClass('empty');
|
|
|
69 |
} else {
|
70 |
alert(WPSC_Purchase_Logs_Admin.tracking_error_dialog);
|
71 |
}
|
@@ -80,13 +81,16 @@
|
|
80 |
return false;
|
81 |
},
|
82 |
|
|
|
|
|
|
|
|
|
83 |
event_button_add_clicked : function() {
|
84 |
$(this).siblings('.wpsc-purchase-log-tracking-id').trigger('focus');
|
85 |
return false;
|
86 |
},
|
87 |
|
88 |
-
|
89 |
-
var t = $(this);
|
90 |
var reset_width = function() {
|
91 |
if (WPSC_Purchase_Logs_Admin.reset_textbox_width) {
|
92 |
t.siblings('a.save').hide();
|
@@ -102,6 +106,12 @@
|
|
102 |
WPSC_Purchase_Logs_Admin.blur_timeout = setTimeout(reset_width, 100);
|
103 |
},
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
event_tracking_id_focused : function() {
|
106 |
var t = $(this);
|
107 |
t.width(128);
|
11 |
delegate('.wpsc-purchase-log-tracking-id', 'blur', WPSC_Purchase_Logs_Admin.event_tracking_id_blurred).
|
12 |
delegate('.column-tracking a.save', 'click', WPSC_Purchase_Logs_Admin.event_button_save_clicked).
|
13 |
delegate('.column-tracking .send-email a', 'click', WPSC_Purchase_Logs_Admin.event_button_send_email_clicked).
|
14 |
+
delegate('.wpsc-purchase-log-tracking-id', 'keypress', WPSC_Purchase_Logs_Admin.event_enter_key_pressed).
|
15 |
+
delegate('.column-tracking a.save', 'mousedown', WPSC_Purchase_Logs_Admin.event_disable_textbox_resize).
|
16 |
+
delegate('.column-tracking a.save', 'focus', WPSC_Purchase_Logs_Admin.event_disable_textbox_resize);
|
17 |
|
18 |
});
|
19 |
},
|
52 |
},
|
53 |
|
54 |
event_button_save_clicked : function() {
|
|
|
|
|
55 |
var t = $(this), textbox = t.siblings('.wpsc-purchase-log-tracking-id'), spinner = t.siblings('.ajax-feedback');
|
56 |
|
57 |
var post_data = {
|
66 |
textbox.blur();
|
67 |
if (response == 'success') {
|
68 |
t.parent().removeClass('empty');
|
69 |
+
WPSC_Purchase_Logs_Admin.reset_tracking_id_width(t.siblings('.wpsc-purchase-log-tracking-id'));
|
70 |
} else {
|
71 |
alert(WPSC_Purchase_Logs_Admin.tracking_error_dialog);
|
72 |
}
|
81 |
return false;
|
82 |
},
|
83 |
|
84 |
+
event_disable_textbox_resize : function() {
|
85 |
+
WPSC_Purchase_Logs_Admin.reset_textbox_width = false;
|
86 |
+
},
|
87 |
+
|
88 |
event_button_add_clicked : function() {
|
89 |
$(this).siblings('.wpsc-purchase-log-tracking-id').trigger('focus');
|
90 |
return false;
|
91 |
},
|
92 |
|
93 |
+
reset_tracking_id_width : function(t) {
|
|
|
94 |
var reset_width = function() {
|
95 |
if (WPSC_Purchase_Logs_Admin.reset_textbox_width) {
|
96 |
t.siblings('a.save').hide();
|
106 |
WPSC_Purchase_Logs_Admin.blur_timeout = setTimeout(reset_width, 100);
|
107 |
},
|
108 |
|
109 |
+
event_tracking_id_blurred : function() {
|
110 |
+
var t = $(this);
|
111 |
+
|
112 |
+
WPSC_Purchase_Logs_Admin.reset_tracking_id_width(t);
|
113 |
+
},
|
114 |
+
|
115 |
event_tracking_id_focused : function() {
|
116 |
var t = $(this);
|
117 |
t.width(128);
|
wpsc-admin/js/settings-page.js
CHANGED
@@ -158,6 +158,7 @@
|
|
158 |
t.toggle_ajax_state(tab_id);
|
159 |
$('#options_' + WPSC_Settings_Page.current_tab).replaceWith(response);
|
160 |
WPSC_Settings_Page.current_tab = tab_id;
|
|
|
161 |
$('.nav-tab-active').removeClass('nav-tab-active');
|
162 |
$('[data-tab-id="' + tab_id + '"]').addClass('nav-tab-active');
|
163 |
$('#wpsc_options_page form').attr('action', url);
|
158 |
t.toggle_ajax_state(tab_id);
|
159 |
$('#options_' + WPSC_Settings_Page.current_tab).replaceWith(response);
|
160 |
WPSC_Settings_Page.current_tab = tab_id;
|
161 |
+
$('.settings-error').remove();
|
162 |
$('.nav-tab-active').removeClass('nav-tab-active');
|
163 |
$('[data-tab-id="' + tab_id + '"]').addClass('nav-tab-active');
|
164 |
$('#wpsc_options_page form').attr('action', url);
|
wpsc-admin/settings-page.php
CHANGED
@@ -81,6 +81,22 @@ abstract class WPSC_Settings_Tab
|
|
81 |
*/
|
82 |
abstract public function display();
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
/**
|
85 |
* Constructor
|
86 |
*
|
@@ -88,6 +104,66 @@ abstract class WPSC_Settings_Tab
|
|
88 |
* @access public
|
89 |
*/
|
90 |
public function __construct() {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
92 |
|
93 |
/**
|
@@ -306,14 +382,19 @@ final class WPSC_Settings_Page
|
|
306 |
if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'submit_options' ) ) {
|
307 |
check_admin_referer( 'update-options', 'wpsc-update-options' );
|
308 |
$this->save_options();
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
|
|
|
|
|
|
|
|
|
|
317 |
exit;
|
318 |
}
|
319 |
}
|
@@ -392,7 +473,7 @@ final class WPSC_Settings_Page
|
|
392 |
*/
|
393 |
public function display_current_tab() {
|
394 |
?>
|
395 |
-
<div id="options_<?php echo esc_attr( $this->current_tab_id ); ?>">
|
396 |
<?php
|
397 |
if ( is_callable( array( $this->current_tab, 'display' ) ) ) {
|
398 |
$this->current_tab->display();
|
@@ -400,6 +481,13 @@ final class WPSC_Settings_Page
|
|
400 |
?>
|
401 |
|
402 |
<?php do_action('wpsc_' . $this->current_tab_id . '_settings_page'); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
</div>
|
404 |
<?php
|
405 |
}
|
@@ -426,11 +514,6 @@ final class WPSC_Settings_Page
|
|
426 |
<div id='wpsc_options_page'>
|
427 |
<form method='post' action='<?php echo esc_attr( $this->submit_url() ); ?>' enctype='multipart/form-data' id='wpsc-settings-form'>
|
428 |
<?php $this->display_current_tab(); ?>
|
429 |
-
<div class="submit">
|
430 |
-
<input type='hidden' name='wpsc_admin_action' value='submit_options' />
|
431 |
-
<?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
|
432 |
-
<input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'wpsc' ); ?>" name="updateoption" />
|
433 |
-
</div>
|
434 |
</form>
|
435 |
</div>
|
436 |
</div>
|
@@ -576,8 +659,10 @@ final class WPSC_Settings_Page
|
|
576 |
//This is for submitting shipping details to the shipping module
|
577 |
if ( !isset( $_POST['update_gateways'] ) )
|
578 |
$_POST['update_gateways'] = '';
|
|
|
579 |
if ( !isset( $_POST['custom_shipping_options'] ) )
|
580 |
$_POST['custom_shipping_options'] = null;
|
|
|
581 |
if ( $_POST['update_gateways'] == 'true' ) {
|
582 |
|
583 |
update_option( 'custom_shipping_options', $_POST['custom_shipping_options'] );
|
81 |
*/
|
82 |
abstract public function display();
|
83 |
|
84 |
+
/**
|
85 |
+
* Whether to display the update message when the options are submitted.
|
86 |
+
*
|
87 |
+
* @since 3.8.8.1
|
88 |
+
* @access private
|
89 |
+
*/
|
90 |
+
private $is_update_message_displayed = true;
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Whether to display the "Save Changes" button.
|
94 |
+
*
|
95 |
+
* @since 3.8.8.1
|
96 |
+
* @access private
|
97 |
+
*/
|
98 |
+
private $is_submit_button_displayed= true;
|
99 |
+
|
100 |
/**
|
101 |
* Constructor
|
102 |
*
|
104 |
* @access public
|
105 |
*/
|
106 |
public function __construct() {}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Make sure the update message will be displayed
|
110 |
+
*
|
111 |
+
* @since 3.8.8.1
|
112 |
+
* @access protected
|
113 |
+
*/
|
114 |
+
protected function display_update_message() {
|
115 |
+
$this->is_update_message_displayed = true;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Make sure the update message will not be displayed
|
120 |
+
*
|
121 |
+
* @since 3.8.8.1
|
122 |
+
* @access protected
|
123 |
+
*/
|
124 |
+
protected function hide_update_message() {
|
125 |
+
$this->is_update_message_displayed = false;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Query whether the update message is to be displayed or not.
|
130 |
+
*
|
131 |
+
* @since 3.8.8.1
|
132 |
+
* @access public
|
133 |
+
*/
|
134 |
+
public function is_update_message_displayed() {
|
135 |
+
return $this->is_update_message_displayed;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Hide the default "Save Changes" button
|
140 |
+
*
|
141 |
+
* @since 3.8.8.1
|
142 |
+
* @access protected
|
143 |
+
*/
|
144 |
+
protected function hide_submit_button() {
|
145 |
+
$this->is_submit_button_displayed = false;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Show the default "Save Changes" button
|
150 |
+
*
|
151 |
+
* @since 3.8.8.1
|
152 |
+
* @access protected
|
153 |
+
*/
|
154 |
+
protected function display_submit_button() {
|
155 |
+
$this->is_submit_button_displayed = true;
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Return whether the default "Save Changes" button is to be displayed.
|
160 |
+
*
|
161 |
+
* @since 3.8.8.1
|
162 |
+
* @access public
|
163 |
+
*/
|
164 |
+
public function is_submit_button_displayed() {
|
165 |
+
return $this->is_submit_button_displayed;
|
166 |
+
}
|
167 |
}
|
168 |
|
169 |
/**
|
382 |
if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'submit_options' ) ) {
|
383 |
check_admin_referer( 'update-options', 'wpsc-update-options' );
|
384 |
$this->save_options();
|
385 |
+
$query_args = array();
|
386 |
+
if ( is_callable( array( $this->current_tab, 'callback_submit_options' ) ) ) {
|
387 |
+
$additional_query_args = $this->current_tab->callback_submit_options();
|
388 |
+
if ( ! empty( $additional_query_args ) )
|
389 |
+
$query_args += $additional_query_args;
|
390 |
+
}
|
391 |
+
if ( $this->current_tab->is_update_message_displayed() ) {
|
392 |
+
if ( ! count( get_settings_errors() ) )
|
393 |
+
add_settings_error( 'wpsc-settings', 'settings_updated', __( 'Settings saved.' ), 'updated' );
|
394 |
+
set_transient( 'settings_errors', get_settings_errors(), 30 );
|
395 |
+
$query_args['settings-updated'] = true;
|
396 |
+
}
|
397 |
+
wp_redirect( add_query_arg( $query_args ) );
|
398 |
exit;
|
399 |
}
|
400 |
}
|
473 |
*/
|
474 |
public function display_current_tab() {
|
475 |
?>
|
476 |
+
<div id="options_<?php echo esc_attr( $this->current_tab_id ); ?>" class="tab-content">
|
477 |
<?php
|
478 |
if ( is_callable( array( $this->current_tab, 'display' ) ) ) {
|
479 |
$this->current_tab->display();
|
481 |
?>
|
482 |
|
483 |
<?php do_action('wpsc_' . $this->current_tab_id . '_settings_page'); ?>
|
484 |
+
<div class="submit">
|
485 |
+
<input type='hidden' name='wpsc_admin_action' value='submit_options' />
|
486 |
+
<?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
|
487 |
+
<?php if ( $this->current_tab->is_submit_button_displayed() ): ?>
|
488 |
+
<input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'wpsc' ); ?>" name="updateoption" />
|
489 |
+
<?php endif ?>
|
490 |
+
</div>
|
491 |
</div>
|
492 |
<?php
|
493 |
}
|
514 |
<div id='wpsc_options_page'>
|
515 |
<form method='post' action='<?php echo esc_attr( $this->submit_url() ); ?>' enctype='multipart/form-data' id='wpsc-settings-form'>
|
516 |
<?php $this->display_current_tab(); ?>
|
|
|
|
|
|
|
|
|
|
|
517 |
</form>
|
518 |
</div>
|
519 |
</div>
|
659 |
//This is for submitting shipping details to the shipping module
|
660 |
if ( !isset( $_POST['update_gateways'] ) )
|
661 |
$_POST['update_gateways'] = '';
|
662 |
+
|
663 |
if ( !isset( $_POST['custom_shipping_options'] ) )
|
664 |
$_POST['custom_shipping_options'] = null;
|
665 |
+
|
666 |
if ( $_POST['update_gateways'] == 'true' ) {
|
667 |
|
668 |
update_option( 'custom_shipping_options', $_POST['custom_shipping_options'] );
|
wpsc-core/wpsc-constants.php
CHANGED
@@ -26,9 +26,9 @@ function wpsc_core_constants() {
|
|
26 |
if(!defined('WPSC_URL'))
|
27 |
define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
|
28 |
// Define Plugin version
|
29 |
-
define( 'WPSC_VERSION', '3.8.8' );
|
30 |
-
define( 'WPSC_MINOR_VERSION', '
|
31 |
-
define( 'WPSC_PRESENTABLE_VERSION', '3.8.8' );
|
32 |
|
33 |
// Define Debug Variables for developers
|
34 |
define( 'WPSC_DEBUG', false );
|
26 |
if(!defined('WPSC_URL'))
|
27 |
define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
|
28 |
// Define Plugin version
|
29 |
+
define( 'WPSC_VERSION', '3.8.8.1' );
|
30 |
+
define( 'WPSC_MINOR_VERSION', '545444' );
|
31 |
+
define( 'WPSC_PRESENTABLE_VERSION', '3.8.8.1' );
|
32 |
|
33 |
// Define Debug Variables for developers
|
34 |
define( 'WPSC_DEBUG', false );
|
wpsc-core/wpsc-functions.php
CHANGED
@@ -1404,13 +1404,13 @@ add_action( 'wp', 'wpsc_select_theme_functions', 10, 1 );
|
|
1404 |
*/
|
1405 |
function wpsc_force_ssl() {
|
1406 |
global $wp_query;
|
1407 |
-
if (
|
1408 |
$sslurl = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
1409 |
header( 'Location: ' . $sslurl );
|
1410 |
echo 'Redirecting';
|
1411 |
}
|
1412 |
}
|
1413 |
-
add_action( '
|
1414 |
|
1415 |
|
1416 |
/**
|
@@ -1454,4 +1454,18 @@ function wpsc_cron() {
|
|
1454 |
}
|
1455 |
|
1456 |
add_action( 'init', 'wpsc_cron' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1457 |
?>
|
1404 |
*/
|
1405 |
function wpsc_force_ssl() {
|
1406 |
global $wp_query;
|
1407 |
+
if ( wpsc_is_ssl() ) {
|
1408 |
$sslurl = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
1409 |
header( 'Location: ' . $sslurl );
|
1410 |
echo 'Redirecting';
|
1411 |
}
|
1412 |
}
|
1413 |
+
add_action( 'wp', 'wpsc_force_ssl' );
|
1414 |
|
1415 |
|
1416 |
/**
|
1454 |
}
|
1455 |
|
1456 |
add_action( 'init', 'wpsc_cron' );
|
1457 |
+
|
1458 |
+
/**
|
1459 |
+
* Checks if current page is shopping cart, and it should be SSL, but is not.
|
1460 |
+
* Used primarily for str_replacing links or content for https
|
1461 |
+
*
|
1462 |
+
* @return boolean true if we're on the shopping cart page and should be ssl, false if not
|
1463 |
+
*/
|
1464 |
+
function wpsc_is_ssl() {
|
1465 |
+
global $wp_query;
|
1466 |
+
|
1467 |
+
return '1' == get_option( 'wpsc_force_ssl' ) && ! is_ssl() && false !== strpos( $wp_query->post->post_content, '[shoppingcart]' );
|
1468 |
+
}
|
1469 |
+
|
1470 |
+
|
1471 |
?>
|
wpsc-includes/currency_converter.inc.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/*
|
4 |
-
CURRENCYCONVERTER
|
5 |
Date - Feb 23,2005
|
6 |
Author - Harish Chauhan
|
7 |
Email - harishc@ultraglobal.biz
|
@@ -9,7 +9,7 @@
|
|
9 |
ABOUT
|
10 |
This PHP script will use for conversion of currency.
|
11 |
you can find it is tricky but it is usefull.
|
12 |
-
|
13 |
Modified by Brian Barnes to change from one service that was
|
14 |
not meant to be used from automated purposes to another that
|
15 |
had no such restriction
|
@@ -20,7 +20,7 @@
|
|
20 |
var $_amt=1;
|
21 |
var $_to="";
|
22 |
var $_from="";
|
23 |
-
var $_error="";
|
24 |
function CURRENCYCONVERTER($amt=1,$to="",$from="")
|
25 |
{
|
26 |
$this->_amt=$amt;
|
@@ -31,26 +31,27 @@
|
|
31 |
{
|
32 |
return $this->_error;
|
33 |
}
|
34 |
-
|
35 |
/**
|
36 |
* Given all details converts currency amount
|
37 |
-
*
|
38 |
* @param $amt double
|
39 |
* The amount to convert.
|
40 |
-
*
|
41 |
* @param $to string
|
42 |
* The currency you wish to convert to.
|
43 |
-
*
|
44 |
* @param $from string
|
45 |
* The currency you are converting from.
|
46 |
*/
|
47 |
function convert($amt = NULL, $to = "", $from = ""){
|
48 |
-
|
49 |
$amount = urlencode(round($amt,2));
|
50 |
$from_Currency = urlencode($from);
|
51 |
$to_Currency = urlencode($to);
|
52 |
-
|
53 |
$url = "http://www.google.com/ig/calculator?hl=en&q=$amount$from_Currency=?$to_Currency";
|
|
|
54 |
$ch = curl_init();
|
55 |
$timeout = 0;
|
56 |
curl_setopt ($ch, CURLOPT_URL, $url);
|
@@ -61,13 +62,12 @@
|
|
61 |
if(empty($rawdata)){
|
62 |
throw new Exception('unable to connect to currency conversion service ');
|
63 |
}
|
64 |
-
|
65 |
-
$
|
66 |
-
$data =
|
67 |
-
$
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
}
|
72 |
}
|
73 |
?>
|
1 |
<?php
|
2 |
+
|
3 |
/*
|
4 |
+
CURRENCYCONVERTER
|
5 |
Date - Feb 23,2005
|
6 |
Author - Harish Chauhan
|
7 |
Email - harishc@ultraglobal.biz
|
9 |
ABOUT
|
10 |
This PHP script will use for conversion of currency.
|
11 |
you can find it is tricky but it is usefull.
|
12 |
+
|
13 |
Modified by Brian Barnes to change from one service that was
|
14 |
not meant to be used from automated purposes to another that
|
15 |
had no such restriction
|
20 |
var $_amt=1;
|
21 |
var $_to="";
|
22 |
var $_from="";
|
23 |
+
var $_error="";
|
24 |
function CURRENCYCONVERTER($amt=1,$to="",$from="")
|
25 |
{
|
26 |
$this->_amt=$amt;
|
31 |
{
|
32 |
return $this->_error;
|
33 |
}
|
34 |
+
|
35 |
/**
|
36 |
* Given all details converts currency amount
|
37 |
+
*
|
38 |
* @param $amt double
|
39 |
* The amount to convert.
|
40 |
+
*
|
41 |
* @param $to string
|
42 |
* The currency you wish to convert to.
|
43 |
+
*
|
44 |
* @param $from string
|
45 |
* The currency you are converting from.
|
46 |
*/
|
47 |
function convert($amt = NULL, $to = "", $from = ""){
|
48 |
+
|
49 |
$amount = urlencode(round($amt,2));
|
50 |
$from_Currency = urlencode($from);
|
51 |
$to_Currency = urlencode($to);
|
52 |
+
|
53 |
$url = "http://www.google.com/ig/calculator?hl=en&q=$amount$from_Currency=?$to_Currency";
|
54 |
+
|
55 |
$ch = curl_init();
|
56 |
$timeout = 0;
|
57 |
curl_setopt ($ch, CURLOPT_URL, $url);
|
62 |
if(empty($rawdata)){
|
63 |
throw new Exception('unable to connect to currency conversion service ');
|
64 |
}
|
65 |
+
|
66 |
+
$rawdata = preg_replace( '/(\{|,\s*)([^\s:]+)(\s*:)/', '$1"$2"$3', $rawdata );
|
67 |
+
$data = json_decode( $rawdata );
|
68 |
+
$to_amount = round( $data->rhs, 2 );
|
69 |
+
return $to_amount;
|
70 |
+
|
|
|
71 |
}
|
72 |
}
|
73 |
?>
|
wpsc-includes/theme.functions.php
CHANGED
@@ -280,10 +280,11 @@ function wpsc_get_template_file_url( $file = '' ) {
|
|
280 |
}
|
281 |
}
|
282 |
|
283 |
-
if( is_ssl() && !strstr( $file_url, 'https' ) )
|
|
|
284 |
|
285 |
// Save the transient and update it every 12 hours
|
286 |
-
if ( !empty( $file_url ) )
|
287 |
set_transient( WPEC_TRANSIENT_THEME_URL_PREFIX . $file, $file_url, 60 * 60 * 12 );
|
288 |
}
|
289 |
|
@@ -1008,7 +1009,7 @@ function wpsc_products_page( $content = '' ) {
|
|
1008 |
$GLOBALS['nzshpcrt_activateshpcrt'] = true;
|
1009 |
|
1010 |
// get the display type for the productspage
|
1011 |
-
$display_type =
|
1012 |
if ( isset( $_SESSION['wpsc_display_type'] ) )
|
1013 |
$display_type = $_SESSION['wpsc_display_type'];
|
1014 |
|
280 |
}
|
281 |
}
|
282 |
|
283 |
+
if ( wpsc_is_ssl() || ( is_ssl() && ! strstr( $file_url, 'https://' ) ) )
|
284 |
+
$file_url = str_replace('http://', 'https://', $file_url);
|
285 |
|
286 |
// Save the transient and update it every 12 hours
|
287 |
+
if ( ! empty( $file_url ) )
|
288 |
set_transient( WPEC_TRANSIENT_THEME_URL_PREFIX . $file, $file_url, 60 * 60 * 12 );
|
289 |
}
|
290 |
|
1009 |
$GLOBALS['nzshpcrt_activateshpcrt'] = true;
|
1010 |
|
1011 |
// get the display type for the productspage
|
1012 |
+
$display_type = wpsc_check_display_type();
|
1013 |
if ( isset( $_SESSION['wpsc_display_type'] ) )
|
1014 |
$display_type = $_SESSION['wpsc_display_type'];
|
1015 |
|
wpsc-merchants/paypal-express.merchant.php
CHANGED
@@ -328,7 +328,7 @@ class wpsc_merchant_paypal_express extends wpsc_merchant {
|
|
328 |
}
|
329 |
}
|
330 |
|
331 |
-
return $this->format_price( $amt
|
332 |
}
|
333 |
|
334 |
function get_local_currency_code() {
|
@@ -381,7 +381,7 @@ function wpsc_paypal_express_convert( $amt ) {
|
|
381 |
}
|
382 |
}
|
383 |
|
384 |
-
return wpsc_paypal_express_format( $amt
|
385 |
}
|
386 |
|
387 |
function wpsc_paypal_express_format( $price ) {
|
328 |
}
|
329 |
}
|
330 |
|
331 |
+
return $this->format_price( $amt * $this->rate );
|
332 |
}
|
333 |
|
334 |
function get_local_currency_code() {
|
381 |
}
|
382 |
}
|
383 |
|
384 |
+
return wpsc_paypal_express_format( $amt * $rate );
|
385 |
}
|
386 |
|
387 |
function wpsc_paypal_express_format( $price ) {
|
wpsc-merchants/paypal-pro.merchant.php
CHANGED
@@ -365,7 +365,7 @@ class wpsc_merchant_paypal_pro extends wpsc_merchant {
|
|
365 |
}
|
366 |
}
|
367 |
|
368 |
-
return $this->format_price( $amt
|
369 |
}
|
370 |
|
371 |
}
|
365 |
}
|
366 |
}
|
367 |
|
368 |
+
return $this->format_price( $amt * $this->rate );
|
369 |
}
|
370 |
|
371 |
}
|
wpsc-merchants/paypal-standard.merchant.php
CHANGED
@@ -69,7 +69,7 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
|
|
69 |
$this->rate = $curr->convert( 1, $paypal_currency_code, $local_currency_code );
|
70 |
}
|
71 |
}
|
72 |
-
return $this->format_price( $amt
|
73 |
}
|
74 |
|
75 |
function get_local_currency_code() {
|
69 |
$this->rate = $curr->convert( 1, $paypal_currency_code, $local_currency_code );
|
70 |
}
|
71 |
}
|
72 |
+
return $this->format_price( $amt * $this->rate );
|
73 |
}
|
74 |
|
75 |
function get_local_currency_code() {
|