WP eCommerce - Version 3.8.8.2-dev

Version Description

Download this release

Release Info

Developer garyc40
Plugin Icon 128x128 WP eCommerce
Version 3.8.8.2-dev
Comparing to
See all releases

Code changes from version 3.8.8.1 to 3.8.8.2-dev

readme.txt CHANGED
@@ -156,6 +156,15 @@ After upgrading from earlier versions look for link "Update Store". This will up
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.
156
 
157
 
158
  == Changelog ==
159
+ = 3.8.8.2 =
160
+ * Change: CSV sales export now puts the item quanity in a separate column from the product title.
161
+ * Fix: Core checkout fields cannot be restored if they were deleted before upgrading to 3.8.8.
162
+ * Fix: Insecure SSL resources when WordPress is using SSL, or "Force SSL Checkout" is enabled.
163
+ * Fix: Issue with WPML and Variations.
164
+ * Fix: Terms and Conditions - Checkout page breaks if you read the terms and conditions.
165
+ * Fix: Total shipping value and total price incorrect in transaction results.
166
+ * Fix: Variation sales prices are inaccurate in Product Specials Widget
167
+
168
  = 3.8.8.1 =
169
  * Fix: CSV import not working in 3.8.8.
170
  * Fix: Category page display setting does not override default Presentation settings.
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.1
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.2-dev
7
  * Author: Instinct Entertainment
8
  * Author URI: http://getshopped.org/
9
  **/
wpsc-admin/admin.php CHANGED
@@ -346,7 +346,6 @@ function wpsc_product_log_rss_feed() {
346
  function wpsc_admin_include_coupon_js() {
347
 
348
  // Variables
349
- $siteurl = get_option( 'siteurl' );
350
  $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
351
 
352
  // Coupon CSS
@@ -354,7 +353,7 @@ function wpsc_admin_include_coupon_js() {
354
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
355
 
356
  // Coupon JS
357
- wp_enqueue_script( 'wp-e-commerce-admin-parameters', $siteurl . '/wp-admin/admin.php?wpsc_admin_dynamic_js=true', false, $version_identifier );
358
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
359
  wp_enqueue_script( 'datepicker-ui', WPSC_CORE_JS_URL . '/ui.datepicker.js', array( 'jquery-ui-core' ), $version_identifier );
360
  wp_enqueue_script( 'wp-e-commerce-admin_legacy', WPSC_URL . '/wpsc-admin/js/admin-legacy.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'datepicker-ui' ), $version_identifier );
@@ -414,9 +413,6 @@ add_action( 'admin_footer', 'wpsc_meta_boxes' );
414
  add_action( 'admin_enqueue_scripts', 'wpsc_admin_include_css_and_js_refac' );
415
  function wpsc_admin_include_css_and_js_refac( $pagehook ) {
416
  global $post_type, $current_screen;
417
- $siteurl = get_option( 'siteurl' );
418
- if ( is_ssl ( ) )
419
- $siteurl = str_replace( "http://", "https://", $siteurl );
420
 
421
  if ( version_compare( get_bloginfo( 'version' ), '3.3', '<' ) )
422
  wp_admin_css( 'dashboard' );
@@ -439,7 +435,7 @@ function wpsc_admin_include_css_and_js_refac( $pagehook ) {
439
 
440
  if ( ( in_array( $pagehook, $pages ) && $post_type == 'wpsc-product' ) || $current_screen->id == 'edit-wpsc_product_category' || $current_screen->id == 'dashboard_page_wpsc-sales-logs' || $current_screen->id == 'dashboard_page_wpsc-purchase-logs' || $current_screen->id == 'settings_page_wpsc-settings' || $current_screen->id == 'wpsc-product_page_wpsc-edit-coupons' || $current_screen->id == 'edit-wpsc-variation' ) {
441
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
442
- wp_enqueue_script( 'wp-e-commerce-admin-parameters', $siteurl . '/wp-admin/admin.php?wpsc_admin_dynamic_js=true', false, $version_identifier );
443
  wp_enqueue_script( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/js/admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), $version_identifier, false );
444
  wp_enqueue_script( 'wp-e-commerce-legacy-ajax', WPSC_URL . '/wpsc-admin/js/ajax.js', false, $version_identifier ); // needs removing
445
 
@@ -449,7 +445,7 @@ function wpsc_admin_include_css_and_js_refac( $pagehook ) {
449
  wp_enqueue_script( 'wp-e-commerce-variations', WPSC_URL . '/wpsc-admin/js/variations.js', array( 'jquery', 'wpsc-sortable-table' ), $version_identifier );
450
  }
451
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
452
- wp_enqueue_style( 'wp-e-commerce-admin-dynamic', $siteurl . "/wp-admin/admin.php?wpsc_admin_dynamic_css=true", false, $version_identifier, 'all' );
453
  // Localize scripts
454
  wp_localize_script( 'wp-e-commerce-admin', 'wpsc_adminL10n', array(
455
  'dragndrop_set' => ( get_option( 'wpsc_sort_by' ) == 'dragndrop' ? 'true' : 'false' ),
@@ -911,7 +907,8 @@ function wpsc_fav_action( $actions ) {
911
  add_filter( 'favorite_actions', 'wpsc_fav_action' );
912
 
913
  function wpsc_print_admin_scripts() {
914
- wp_enqueue_script( 'wp-e-commerce-dynamic', get_bloginfo( 'url' ) . "/index.php?wpsc_user_dynamic_js=true" );
 
915
  }
916
 
917
  /**
346
  function wpsc_admin_include_coupon_js() {
347
 
348
  // Variables
 
349
  $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
350
 
351
  // Coupon CSS
353
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
354
 
355
  // Coupon JS
356
+ wp_enqueue_script( 'wp-e-commerce-admin-parameters', admin_url( '/wp-admin/admin.php?wpsc_admin_dynamic_js=true' ), false, $version_identifier );
357
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
358
  wp_enqueue_script( 'datepicker-ui', WPSC_CORE_JS_URL . '/ui.datepicker.js', array( 'jquery-ui-core' ), $version_identifier );
359
  wp_enqueue_script( 'wp-e-commerce-admin_legacy', WPSC_URL . '/wpsc-admin/js/admin-legacy.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'datepicker-ui' ), $version_identifier );
413
  add_action( 'admin_enqueue_scripts', 'wpsc_admin_include_css_and_js_refac' );
414
  function wpsc_admin_include_css_and_js_refac( $pagehook ) {
415
  global $post_type, $current_screen;
 
 
 
416
 
417
  if ( version_compare( get_bloginfo( 'version' ), '3.3', '<' ) )
418
  wp_admin_css( 'dashboard' );
435
 
436
  if ( ( in_array( $pagehook, $pages ) && $post_type == 'wpsc-product' ) || $current_screen->id == 'edit-wpsc_product_category' || $current_screen->id == 'dashboard_page_wpsc-sales-logs' || $current_screen->id == 'dashboard_page_wpsc-purchase-logs' || $current_screen->id == 'settings_page_wpsc-settings' || $current_screen->id == 'wpsc-product_page_wpsc-edit-coupons' || $current_screen->id == 'edit-wpsc-variation' ) {
437
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
438
+ wp_enqueue_script( 'wp-e-commerce-admin-parameters', admin_url( 'admin.php?wpsc_admin_dynamic_js=true' ), false, $version_identifier );
439
  wp_enqueue_script( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/js/admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), $version_identifier, false );
440
  wp_enqueue_script( 'wp-e-commerce-legacy-ajax', WPSC_URL . '/wpsc-admin/js/ajax.js', false, $version_identifier ); // needs removing
441
 
445
  wp_enqueue_script( 'wp-e-commerce-variations', WPSC_URL . '/wpsc-admin/js/variations.js', array( 'jquery', 'wpsc-sortable-table' ), $version_identifier );
446
  }
447
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
448
+ wp_enqueue_style( 'wp-e-commerce-admin-dynamic', admin_url( "admin.php?wpsc_admin_dynamic_css=true" ), false, $version_identifier, 'all' );
449
  // Localize scripts
450
  wp_localize_script( 'wp-e-commerce-admin', 'wpsc_adminL10n', array(
451
  'dragndrop_set' => ( get_option( 'wpsc_sort_by' ) == 'dragndrop' ? 'true' : 'false' ),
907
  add_filter( 'favorite_actions', 'wpsc_fav_action' );
908
 
909
  function wpsc_print_admin_scripts() {
910
+ $scheme = is_ssl() ? 'https' : 'http';
911
+ wp_enqueue_script( 'wp-e-commerce-dynamic', home_url( "/index.php?wpsc_user_dynamic_js=true", $scheme ) );
912
  }
913
 
914
  /**
wpsc-admin/ajax-and-init.php CHANGED
@@ -458,7 +458,8 @@ function wpsc_purchase_log_csv() {
458
  $skuvalue = get_product_meta( $item['prodid'], 'sku', true );
459
  if( empty( $skuvalue ) )
460
  $skuvalue = __( 'N/A', 'wpsc' );
461
- $output .= "\"" . $item['quantity'] . " x " . str_replace( '"', '\"', $item['name'] ) . "\"";
 
462
  $output .= "," . $skuvalue."," ;
463
  }
464
  $output .= "\n"; // terminates the row/line in the CSV file
@@ -466,7 +467,7 @@ function wpsc_purchase_log_csv() {
466
  // Get the most number of products and create a header for them
467
  $headers3 = "";
468
  for( $i = 0; $i < $count; $i++ ){
469
- $headers3 .= "\"Quantity - Product Name \", \" SKU \"";
470
  if( $i < ( $count - 1 ) )
471
  $headers3 .= ",";
472
  }
458
  $skuvalue = get_product_meta( $item['prodid'], 'sku', true );
459
  if( empty( $skuvalue ) )
460
  $skuvalue = __( 'N/A', 'wpsc' );
461
+ $output .= "\"" . $item['quantity'] . "\",";
462
+ $output .= "\"" . str_replace( '"', '\"', $item['name'] ) . "\"";
463
  $output .= "," . $skuvalue."," ;
464
  }
465
  $output .= "\n"; // terminates the row/line in the CSV file
467
  // Get the most number of products and create a header for them
468
  $headers3 = "";
469
  for( $i = 0; $i < $count; $i++ ){
470
+ $headers3 .= "\"Quantity\",\"Product Name\",\"SKU\"";
471
  if( $i < ( $count - 1 ) )
472
  $headers3 .= ",";
473
  }
wpsc-admin/includes/products.php CHANGED
@@ -17,7 +17,7 @@ function wpsc_admin_product_listing($parent_product = null) {
17
  global $wp_query;
18
  add_filter('the_title','esc_html');
19
  $args = array_merge( $wp_query->query, array( 'posts_per_page' => '-1' ) );
20
- $GLOBALS['wpsc_products'] = query_posts( $args );
21
 
22
  foreach ( (array)$GLOBALS['wpsc_products'] as $product ) {
23
  wpsc_product_row($product, $parent_product);
17
  global $wp_query;
18
  add_filter('the_title','esc_html');
19
  $args = array_merge( $wp_query->query, array( 'posts_per_page' => '-1' ) );
20
+ $GLOBALS['wpsc_products'] = get_posts( $args );
21
 
22
  foreach ( (array)$GLOBALS['wpsc_products'] as $product ) {
23
  wpsc_product_row($product, $parent_product);
wpsc-admin/js/variations.js CHANGED
@@ -157,7 +157,7 @@
157
  description : $('#content_ifr').contents().find('body').html(),
158
  additional_description : $('textarea#additional_description').text(),
159
  name : $('input#title').val(),
160
- product_id : $('input#product_id').val()
161
  },
162
  ajax_callback = function(response){
163
  $('div#wpsc_product_variation_forms table.widefat tbody').html(response);
157
  description : $('#content_ifr').contents().find('body').html(),
158
  additional_description : $('textarea#additional_description').text(),
159
  name : $('input#title').val(),
160
+ product_id : $('input#post_ID').val()
161
  },
162
  ajax_callback = function(response){
163
  $('div#wpsc_product_variation_forms table.widefat tbody').html(response);
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.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 );
26
  if(!defined('WPSC_URL'))
27
  define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
28
  // Define Plugin version
29
+ define( 'WPSC_VERSION', '3.8.8.2-dev' );
30
+ define( 'WPSC_MINOR_VERSION', '550322' );
31
+ define( 'WPSC_PRESENTABLE_VERSION', '3.8.8.2-dev' );
32
 
33
  // Define Debug Variables for developers
34
  define( 'WPSC_DEBUG', false );
wpsc-core/wpsc-functions.php CHANGED
@@ -540,7 +540,7 @@ function wpsc_filter_query_request( $args ) {
540
  global $wpsc_page_titles;
541
  if ( is_admin() )
542
  return $args;
543
-
544
  // Make sure no 404 error is thrown for any sub pages of products-page
545
  if ( ! empty( $args['wpsc_product_category'] ) && 'page' != $args['wpsc_product_category'] && ! term_exists($args['wpsc_product_category'], 'wpsc_product_category') ) {
546
  // Probably requesting a page that is a sub page of products page
@@ -1293,11 +1293,11 @@ function wpsc_product_link( $permalink, $post, $leavename ) {
1293
  }
1294
  }
1295
 
1296
- if( isset( $category_slug ) && empty( $category_slug ) )
1297
  $category_slug = 'product';
1298
-
1299
  $category_slug = apply_filters( 'wpsc_product_permalink_cat_slug', $category_slug, $post_id );
1300
-
1301
  $rewritereplace = array(
1302
  $category_slug,
1303
  $post_name
@@ -1404,10 +1404,10 @@ add_action( 'wp', 'wpsc_select_theme_functions', 10, 1 );
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' );
@@ -1458,7 +1458,9 @@ add_action( 'init', 'wpsc_cron' );
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() {
540
  global $wpsc_page_titles;
541
  if ( is_admin() )
542
  return $args;
543
+
544
  // Make sure no 404 error is thrown for any sub pages of products-page
545
  if ( ! empty( $args['wpsc_product_category'] ) && 'page' != $args['wpsc_product_category'] && ! term_exists($args['wpsc_product_category'], 'wpsc_product_category') ) {
546
  // Probably requesting a page that is a sub page of products page
1293
  }
1294
  }
1295
 
1296
+ if( isset( $category_slug ) && empty( $category_slug ) )
1297
  $category_slug = 'product';
1298
+
1299
  $category_slug = apply_filters( 'wpsc_product_permalink_cat_slug', $category_slug, $post_id );
1300
+
1301
  $rewritereplace = array(
1302
  $category_slug,
1303
  $post_name
1404
  */
1405
  function wpsc_force_ssl() {
1406
  global $wp_query;
1407
+ if ( '1' == get_option( 'wpsc_force_ssl' ) && ! is_ssl() && false !== strpos( $wp_query->post->post_content, '[shoppingcart]' ) ) {
1408
  $sslurl = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
1409
+ wp_redirect( $sslurl );
1410
+ exit;
1411
  }
1412
  }
1413
  add_action( 'wp', 'wpsc_force_ssl' );
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
+ * @since 3.8.8.1
1463
+ * @deprecated 3.8.8.2
1464
  * @return boolean true if we're on the shopping cart page and should be ssl, false if not
1465
  */
1466
  function wpsc_is_ssl() {
wpsc-core/wpsc-installer.php CHANGED
@@ -735,4 +735,74 @@ function wpsc_rename_checkout_column(){
735
  }
736
 
737
  }
738
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
735
  }
736
 
737
  }
738
+
739
+ /**
740
+ * In 3.8.8, we removed the ability for the user to delete or add core checkout fields (things like billingfirstname, billinglastname etc.) in order to reduce user error.
741
+ * Mistakenly deleting or duplicating those fields could cause unexpected bugs with checkout form validation.
742
+ *
743
+ * Some users have encountered an issue where, if they had previously deleted a core checkout field, now they can't add it back again.
744
+ * With this function, we should check to see whether any core fields are missing (by checking the uniquenames)
745
+ * If there are some missing, we automatically generate those with the intended uniquename.
746
+ *
747
+ * We set the 'active' field to 0, so as to mitigate any unintended consequences of adding additional fields.
748
+ *
749
+ * @since 3.8.8.2
750
+ * @return none
751
+ */
752
+ function wpsc_3882_database_updates() {
753
+ global $wpdb;
754
+
755
+ // Check if we have done this before
756
+ if ( version_compare( get_option( 'wpsc_version' ), '3.8.8.2', '>=' ) )
757
+ return;
758
+
759
+ $unique_names = array(
760
+ 'billingfirstname' => __( 'First Name', 'wpsc' ),
761
+ 'billinglastname' => __( 'Last Name', 'wpsc' ),
762
+ 'billingaddress' => __( 'Address', 'wpsc' ),
763
+ 'billingcity' => __( 'City', 'wpsc' ),
764
+ 'billingstate' => __( 'State', 'wpsc' ),
765
+ 'billingcountry' => __( 'Country', 'wpsc' ),
766
+ 'billingemail' => __( 'Email', 'wpsc' ),
767
+ 'billingphone' => __( 'Phone', 'wpsc' ),
768
+ 'billingpostcode' => __( 'Postal Code', 'wpsc' ),
769
+ 'delivertoafriend' => __( 'Shipping Address', 'wpsc' ),
770
+ 'shippingfirstname' => __( 'First Name', 'wpsc' ),
771
+ 'shippinglastname' => __( 'Last Name', 'wpsc' ),
772
+ 'shippingaddress' => __( 'Address', 'wpsc' ),
773
+ 'shippingcity' => __( 'City', 'wpsc' ),
774
+ 'shippingstate' => __( 'State', 'wpsc' ),
775
+ 'shippingcountry' => __( 'Country', 'wpsc' ),
776
+ 'shippingpostcode' => __( 'Postal Code', 'wpsc' ),
777
+ );
778
+
779
+ // Check if any uniquenames are missing
780
+ $current_columns = array_filter( $wpdb->get_col( $wpdb->prepare( 'SELECT unique_name FROM ' . WPSC_TABLE_CHECKOUT_FORMS ) ) );
781
+
782
+ $columns_to_add = array_diff_key( $unique_names, array_flip( $current_columns ) );
783
+
784
+ if ( empty( $columns_to_add ) )
785
+ return update_option( 'wpsc_version', '3.8.8.2' );
786
+
787
+ foreach ( $columns_to_add as $unique_name => $name ) {
788
+
789
+ // We need to add the row. A few cases to check for type. Quick and procedural felt like less overkill than a switch statement
790
+ $type = 'text';
791
+ $type = stristr( $unique_name, 'address' ) ? 'address' : $type;
792
+ $type = stristr( $unique_name, 'city' ) ? 'city' : $type;
793
+ $type = 'billingcountry' == $unique_name ? 'country' : $type;
794
+ $type = 'billingemail' == $unique_name ? 'email' : $type;
795
+ $type = 'shippingcountry' == $unique_name ? 'deliverycountry' : $type;
796
+
797
+ $wpdb->insert( WPSC_TABLE_CHECKOUT_FORMS,
798
+ array( 'unique_name' => $unique_name, 'active' => '0', 'type' => $type, 'name' => $name, 'checkout_set' => '0' ),
799
+ array( '%s', '%d', '%s', '%s', '%d' )
800
+ );
801
+ }
802
+
803
+ // Update option to database to indicate that we have patched this.
804
+ update_option( 'wpsc_version', '3.8.8.2' );
805
+
806
+ }
807
+
808
+ add_action( 'plugins_loaded', 'wpsc_3882_database_updates' );
wpsc-includes/ajax.functions.php CHANGED
@@ -719,11 +719,17 @@ if ( isset( $_REQUEST['wpsc_action'] ) && ($_REQUEST['wpsc_action'] == 'gateway_
719
  add_action( 'init', 'wpsc_gateway_notification' );
720
  }
721
 
722
- if ( isset( $_GET['termsandconds'] ) && ($_GET['termsandconds'] === 'true') ) {
723
- echo wpautop( stripslashes( get_option( 'terms_and_conditions' ) ) );
724
- exit();
725
  }
726
 
 
 
 
 
 
 
 
727
  /**
728
  * wpsc_change_tax function, used through ajax and in normal page loading.
729
  * No parameters, returns nothing
719
  add_action( 'init', 'wpsc_gateway_notification' );
720
  }
721
 
722
+ if ( isset( $_GET['termsandconds'] ) && 'true' == $_GET['termsandconds'] ) {
723
+ add_action( 'init', 'wpsc_show_terms_and_conditions' );
 
724
  }
725
 
726
+ function wpsc_show_terms_and_conditions() {
727
+
728
+ echo wpautop( stripslashes( wp_kses_post( get_option( 'terms_and_conditions' ) ) ) );
729
+ die();
730
+ }
731
+
732
+
733
  /**
734
  * wpsc_change_tax function, used through ajax and in normal page loading.
735
  * No parameters, returns nothing
wpsc-includes/purchaselogs.class.php CHANGED
@@ -329,28 +329,28 @@ function wpsc_purchaselog_details_SKU() {
329
 
330
  function wpsc_purchaselog_details_quantity() {
331
  global $purchlogitem;
332
- return (int)$purchlogitem->purchitem->quantity;
333
  }
334
 
335
  function wpsc_purchaselog_details_price() {
336
  global $purchlogitem;
337
- return (float)$purchlogitem->purchitem->price;
338
  }
339
 
340
  function wpsc_purchaselog_details_shipping() {
341
  global $purchlogitem;
342
- return (int)$purchlogitem->purchitem->pnp;
343
  }
344
 
345
  function wpsc_purchaselog_details_tax() {
346
  global $purchlogitem, $wpsc_cart;
347
 
348
- return (int)$purchlogitem->purchitem->tax_charged;
349
  }
350
 
351
  function wpsc_purchaselog_details_discount() {
352
  global $purchlogitem;
353
- return (float)$purchlogitem->extrainfo->discount_value;
354
  }
355
 
356
  function wpsc_purchaselog_details_date() {
@@ -408,16 +408,21 @@ function wpsc_display_purchlog_discount( $numeric = false ) {
408
  * Returns base shipping should make a function to calculate items shipping as well
409
  */
410
 
411
- function wpsc_display_purchlog_shipping( $numeric = false ) {
412
  global $purchlogitem;
413
  $base_shipping = $purchlogitem->extrainfo->base_shipping;
414
  $per_item_shipping = 0;
415
- foreach ( (array)$purchlogitem->allcartcontent as $cart_item ) {
416
- if ( $cart_item->pnp > 0 ) {
417
- $per_item_shipping += ( $cart_item->pnp );
 
 
 
418
  }
419
  }
 
420
  $total_shipping = $per_item_shipping + $base_shipping;
 
421
  if ( $numeric == true ) {
422
  return $total_shipping;
423
  } else {
329
 
330
  function wpsc_purchaselog_details_quantity() {
331
  global $purchlogitem;
332
+ return (float) $purchlogitem->purchitem->quantity;
333
  }
334
 
335
  function wpsc_purchaselog_details_price() {
336
  global $purchlogitem;
337
+ return (float) $purchlogitem->purchitem->price;
338
  }
339
 
340
  function wpsc_purchaselog_details_shipping() {
341
  global $purchlogitem;
342
+ return (float) $purchlogitem->purchitem->pnp;
343
  }
344
 
345
  function wpsc_purchaselog_details_tax() {
346
  global $purchlogitem, $wpsc_cart;
347
 
348
+ return (float) $purchlogitem->purchitem->tax_charged;
349
  }
350
 
351
  function wpsc_purchaselog_details_discount() {
352
  global $purchlogitem;
353
+ return (float) $purchlogitem->extrainfo->discount_value;
354
  }
355
 
356
  function wpsc_purchaselog_details_date() {
408
  * Returns base shipping should make a function to calculate items shipping as well
409
  */
410
 
411
+ function wpsc_display_purchlog_shipping( $numeric = false, $include_item = false ) {
412
  global $purchlogitem;
413
  $base_shipping = $purchlogitem->extrainfo->base_shipping;
414
  $per_item_shipping = 0;
415
+
416
+ if ( $include_item ) {
417
+ foreach ( (array)$purchlogitem->allcartcontent as $cart_item ) {
418
+ if ( $cart_item->pnp > 0 ) {
419
+ $per_item_shipping += ( $cart_item->pnp );
420
+ }
421
  }
422
  }
423
+
424
  $total_shipping = $per_item_shipping + $base_shipping;
425
+
426
  if ( $numeric == true ) {
427
  return $total_shipping;
428
  } else {
wpsc-includes/theme.functions.php CHANGED
@@ -256,38 +256,31 @@ function wpsc_get_template_file_url( $file = '' ) {
256
  if ( empty( $file ) )
257
  return;
258
 
259
- // No cache, so find one and set it
260
- if ( false === ( $file_url = get_transient( WPEC_TRANSIENT_THEME_URL_PREFIX . $file ) ) ) {
261
- // Look for file in stylesheet
262
- if ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
263
- $file_url = get_stylesheet_directory_uri() . '/' . $file;
264
 
265
- // Look for file in template
266
- } elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
267
- $file_url = get_template_directory_uri() . '/' . $file;
268
 
269
- // Backwards compatibility
270
- } else {
271
- // Look in old theme url
272
- $selected_theme_check = WPSC_OLD_THEMES_PATH . get_option( 'wpsc_selected_theme' ) . '/' . str_ireplace( 'wpsc-', '', $file );
273
- // Check the selected theme
274
- if ( file_exists( $selected_theme_check ) ) {
275
 
276
- $file_url = WPSC_OLD_THEMES_URL . get_option( 'wpsc_selected_theme' ) . '/' . str_ireplace( 'wpsc-', '', $file );
277
- // Use the bundled theme CSS
278
- } else {
279
- $file_url = WPSC_CORE_THEME_URL . $file;
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
 
 
 
 
291
  // Return filtered result
292
  return apply_filters( WPEC_TRANSIENT_THEME_URL_PREFIX . $file, $file_url );
293
  }
@@ -551,6 +544,7 @@ function wpsc_enqueue_user_script_and_css() {
551
  /**
552
  * end of added by xiligroup.dev to be compatible with touchshop
553
  */
 
554
  $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
555
  $category_id = '';
556
  if (isset( $wp_query ) && isset( $wp_query->query_vars['taxonomy'] ) && ('wpsc_product_category' == $wp_query->query_vars['taxonomy'] ) || is_numeric( get_option( 'wpsc_default_category' ) )
@@ -563,15 +557,15 @@ function wpsc_enqueue_user_script_and_css() {
563
  }
564
 
565
  $remote_protocol = is_ssl() ? 'https://' : 'http://';
566
-
567
  if( get_option( 'wpsc_share_this' ) == 1 )
568
  wp_enqueue_script( 'sharethis', $remote_protocol . 'w.sharethis.com/button/buttons.js', array(), false, true );
569
-
570
  wp_enqueue_script( 'jQuery' );
571
  wp_enqueue_script( 'wp-e-commerce', WPSC_CORE_JS_URL . '/wp-e-commerce.js', array( 'jquery' ), $version_identifier );
572
  wp_enqueue_script( 'infieldlabel', WPSC_CORE_JS_URL . '/jquery.infieldlabel.min.js', array( 'jquery' ), $version_identifier );
573
  wp_enqueue_script( 'wp-e-commerce-ajax-legacy', WPSC_CORE_JS_URL . '/ajax.js', false, $version_identifier );
574
- wp_enqueue_script( 'wp-e-commerce-dynamic', site_url( '/index.php?wpsc_user_dynamic_js=true' ), false, $version_identifier );
575
  wp_localize_script( 'wp-e-commerce-dynamic', 'wpsc_ajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
576
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
577
  if( get_option( 'product_ratings' ) == 1 )
@@ -592,7 +586,7 @@ function wpsc_enqueue_user_script_and_css() {
592
  wp_enqueue_style( 'wpsc-theme-css-compatibility', WPSC_CORE_THEME_URL . 'compatibility.css', false, $version_identifier, 'all' );
593
  if( get_option( 'product_ratings' ) == 1 )
594
  wp_enqueue_style( 'wpsc-product-rater', WPSC_CORE_JS_URL . '/product_rater.css', false, $version_identifier, 'all' );
595
- wp_enqueue_style( 'wp-e-commerce-dynamic', site_url( "/index.php?wpsc_user_dynamic_css=true&category=$category_id" ), false, $version_identifier, 'all' );
596
 
597
  }
598
 
256
  if ( empty( $file ) )
257
  return;
258
 
259
+ // Look for file in stylesheet
260
+ if ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
261
+ $file_url = get_stylesheet_directory_uri() . '/' . $file;
 
 
262
 
263
+ // Look for file in template
264
+ } elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
265
+ $file_url = get_template_directory_uri() . '/' . $file;
266
 
267
+ // Backwards compatibility
268
+ } else {
269
+ // Look in old theme url
270
+ $selected_theme_check = WPSC_OLD_THEMES_PATH . get_option( 'wpsc_selected_theme' ) . '/' . str_ireplace( 'wpsc-', '', $file );
271
+ // Check the selected theme
272
+ if ( file_exists( $selected_theme_check ) ) {
273
 
274
+ $file_url = WPSC_OLD_THEMES_URL . get_option( 'wpsc_selected_theme' ) . '/' . str_ireplace( 'wpsc-', '', $file );
275
+ // Use the bundled theme CSS
276
+ } else {
277
+ $file_url = WPSC_CORE_THEME_URL . $file;
 
278
  }
 
 
 
 
 
 
 
279
  }
280
 
281
+ if ( is_ssl() )
282
+ $file_url = str_replace('http://', 'https://', $file_url);
283
+
284
  // Return filtered result
285
  return apply_filters( WPEC_TRANSIENT_THEME_URL_PREFIX . $file, $file_url );
286
  }
544
  /**
545
  * end of added by xiligroup.dev to be compatible with touchshop
546
  */
547
+ $scheme = is_ssl() ? 'https' : 'http';
548
  $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
549
  $category_id = '';
550
  if (isset( $wp_query ) && isset( $wp_query->query_vars['taxonomy'] ) && ('wpsc_product_category' == $wp_query->query_vars['taxonomy'] ) || is_numeric( get_option( 'wpsc_default_category' ) )
557
  }
558
 
559
  $remote_protocol = is_ssl() ? 'https://' : 'http://';
560
+
561
  if( get_option( 'wpsc_share_this' ) == 1 )
562
  wp_enqueue_script( 'sharethis', $remote_protocol . 'w.sharethis.com/button/buttons.js', array(), false, true );
563
+
564
  wp_enqueue_script( 'jQuery' );
565
  wp_enqueue_script( 'wp-e-commerce', WPSC_CORE_JS_URL . '/wp-e-commerce.js', array( 'jquery' ), $version_identifier );
566
  wp_enqueue_script( 'infieldlabel', WPSC_CORE_JS_URL . '/jquery.infieldlabel.min.js', array( 'jquery' ), $version_identifier );
567
  wp_enqueue_script( 'wp-e-commerce-ajax-legacy', WPSC_CORE_JS_URL . '/ajax.js', false, $version_identifier );
568
+ wp_enqueue_script( 'wp-e-commerce-dynamic', home_url( '/index.php?wpsc_user_dynamic_js=true', $scheme ), false, $version_identifier );
569
  wp_localize_script( 'wp-e-commerce-dynamic', 'wpsc_ajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
570
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
571
  if( get_option( 'product_ratings' ) == 1 )
586
  wp_enqueue_style( 'wpsc-theme-css-compatibility', WPSC_CORE_THEME_URL . 'compatibility.css', false, $version_identifier, 'all' );
587
  if( get_option( 'product_ratings' ) == 1 )
588
  wp_enqueue_style( 'wpsc-product-rater', WPSC_CORE_JS_URL . '/product_rater.css', false, $version_identifier, 'all' );
589
+ wp_enqueue_style( 'wp-e-commerce-dynamic', home_url( "/index.php?wpsc_user_dynamic_css=true&category=$category_id", $scheme ), false, $version_identifier, 'all' );
590
 
591
  }
592
 
wpsc-theme/functions/wpsc-transaction_results_functions.php CHANGED
@@ -129,6 +129,9 @@ function transaction_results( $sessionid, $display_to_screen = true, $transactio
129
 
130
  $echo_to_screen = $display_to_screen;
131
 
 
 
 
132
  if ( is_numeric( $sessionid ) ) {
133
  if ( $echo_to_screen )
134
  echo apply_filters( 'wpsc_pre_transaction_results', '' );
@@ -254,7 +257,7 @@ function transaction_results( $sessionid, $display_to_screen = true, $transactio
254
  }
255
 
256
  //add tax if included
257
- if($wpec_taxes_controller->wpec_taxes_isenabled() && $wpec_taxes_controller->wpec_taxes_isincluded())
258
  {
259
  $taxes_text = ' - - '.__('Tax Included', 'wpsc').': '.wpsc_currency_display( $row['tax_charged'], array( 'display_as_html' => false ) )."\n\r";
260
  $taxes_text_html = ' - - '.__('Tax Included', 'wpsc').': '.wpsc_currency_display( $row['tax_charged'] );
@@ -277,8 +280,8 @@ function transaction_results( $sessionid, $display_to_screen = true, $transactio
277
  }
278
  }
279
 
280
- $total_shipping = $wpsc_cart->calculate_total_shipping();
281
- $total = $wpsc_cart->calculate_total_price();
282
 
283
  $total_price_email = '';
284
  $total_price_html = '';
@@ -286,7 +289,7 @@ function transaction_results( $sessionid, $display_to_screen = true, $transactio
286
  $total_tax = '';
287
  $total_shipping_html = '';
288
  $total_shipping_email = '';
289
- if ( wpsc_uses_shipping() )
290
  $total_shipping_email.= sprintf(__( 'Total Shipping: %s
291
  ', 'wpsc' ), wpsc_currency_display( $total_shipping, array( 'display_as_html' => false ) ) );
292
  $total_price_email.= sprintf(__( 'Total: %s
@@ -301,11 +304,11 @@ function transaction_results( $sessionid, $display_to_screen = true, $transactio
301
  }
302
 
303
  //only show total tax if tax is not included
304
- if($wpec_taxes_controller->wpec_taxes_isenabled() && !$wpec_taxes_controller->wpec_taxes_isincluded()){
305
  $total_tax_html .= __('Total Tax', 'wpsc').': '. wpsc_currency_display( $purchase_log['wpec_taxes_total'] )."\n\r";
306
  $total_tax .= __('Total Tax', 'wpsc').': '. wpsc_currency_display( $purchase_log['wpec_taxes_total'] , array( 'display_as_html' => false ) )."\n\r";
307
  }
308
- if ( wpsc_uses_shipping() )
309
  $total_shipping_html.= '<hr>' . sprintf(__( 'Total Shipping: %s
310
  ', 'wpsc' ), wpsc_currency_display( $total_shipping ));
311
  $total_price_html.= sprintf(__( 'Total: %s
@@ -350,9 +353,6 @@ function transaction_results( $sessionid, $display_to_screen = true, $transactio
350
  add_filter( 'wp_mail_from_name', 'wpsc_replace_reply_name', 0 );
351
  $message = apply_filters('wpsc_email_message', $message, $report_id, $product_list, $total_tax, $total_shipping_email, $total_price_email);
352
 
353
- //new variable to check whether function is being called from wpsc_purchlog_resend_email()
354
- $resend_email = isset( $_REQUEST['email_buyer_id'] ) ? true : false;
355
-
356
  if ( ! $is_transaction ) {
357
 
358
  $payment_instructions = strip_tags( stripslashes( get_option( 'payment_instructions' ) ) );
@@ -425,4 +425,24 @@ function transaction_results( $sessionid, $display_to_screen = true, $transactio
425
  }
426
  }
427
 
428
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
  $echo_to_screen = $display_to_screen;
131
 
132
+ //new variable to check whether function is being called from wpsc_purchlog_resend_email()
133
+ $resend_email = isset( $_REQUEST['email_buyer_id'] ) ? true : false;
134
+
135
  if ( is_numeric( $sessionid ) ) {
136
  if ( $echo_to_screen )
137
  echo apply_filters( 'wpsc_pre_transaction_results', '' );
257
  }
258
 
259
  //add tax if included
260
+ if( $wpec_taxes_controller->wpec_taxes_isenabled() && $wpec_taxes_controller->wpec_taxes_isincluded() )
261
  {
262
  $taxes_text = ' - - '.__('Tax Included', 'wpsc').': '.wpsc_currency_display( $row['tax_charged'], array( 'display_as_html' => false ) )."\n\r";
263
  $taxes_text_html = ' - - '.__('Tax Included', 'wpsc').': '.wpsc_currency_display( $row['tax_charged'] );
280
  }
281
  }
282
 
283
+ $total_shipping = wpsc_get_total_shipping( $purchase_log['id'] );
284
+ $total = $purchase_log['totalprice'];
285
 
286
  $total_price_email = '';
287
  $total_price_html = '';
289
  $total_tax = '';
290
  $total_shipping_html = '';
291
  $total_shipping_email = '';
292
+ if ( wpsc_uses_shipping() || ! empty( $purchase_log['base_shipping'] ) )
293
  $total_shipping_email.= sprintf(__( 'Total Shipping: %s
294
  ', 'wpsc' ), wpsc_currency_display( $total_shipping, array( 'display_as_html' => false ) ) );
295
  $total_price_email.= sprintf(__( 'Total: %s
304
  }
305
 
306
  //only show total tax if tax is not included
307
+ if ( ( $wpec_taxes_controller->wpec_taxes_isenabled() && ! $wpec_taxes_controller->wpec_taxes_isincluded() ) ) {
308
  $total_tax_html .= __('Total Tax', 'wpsc').': '. wpsc_currency_display( $purchase_log['wpec_taxes_total'] )."\n\r";
309
  $total_tax .= __('Total Tax', 'wpsc').': '. wpsc_currency_display( $purchase_log['wpec_taxes_total'] , array( 'display_as_html' => false ) )."\n\r";
310
  }
311
+ if ( wpsc_uses_shipping() || ! empty( $purchase_log['base_shipping'] ) )
312
  $total_shipping_html.= '<hr>' . sprintf(__( 'Total Shipping: %s
313
  ', 'wpsc' ), wpsc_currency_display( $total_shipping ));
314
  $total_price_html.= sprintf(__( 'Total: %s
353
  add_filter( 'wp_mail_from_name', 'wpsc_replace_reply_name', 0 );
354
  $message = apply_filters('wpsc_email_message', $message, $report_id, $product_list, $total_tax, $total_shipping_email, $total_price_email);
355
 
 
 
 
356
  if ( ! $is_transaction ) {
357
 
358
  $payment_instructions = strip_tags( stripslashes( get_option( 'payment_instructions' ) ) );
425
  }
426
  }
427
 
428
+ /**
429
+ * New helper function for grabbing the total shipping of a purchase log
430
+ * @param int $purchase_id
431
+ * @return float shipping price
432
+ */
433
+ function wpsc_get_total_shipping( $purchase_id ) {
434
+ global $wpdb;
435
+
436
+ $per_item_shipping = $wpdb->get_col( $wpdb->prepare( 'SELECT pnp FROM ' . WPSC_TABLE_CART_CONTENTS . " WHERE purchaseid = %d", $purchase_id ) );
437
+ $base_shipping = $wpdb->get_var( $wpdb->prepare( 'SELECT base_shipping FROM ' . WPSC_TABLE_PURCHASE_LOGS . " WHERE id = %d", $purchase_id ) );
438
+
439
+ $total_shipping = 0.00;
440
+
441
+ $per_item_shipping = array_sum( $per_item_shipping );
442
+
443
+ $total_shipping = $base_shipping + $per_item_shipping;
444
+
445
+ return $total_shipping;
446
+ }
447
+
448
+ ?>
wpsc-widgets/specials_widget.php CHANGED
@@ -176,26 +176,7 @@ function wpsc_specials( $args = null, $instance ) {
176
  <br />
177
  <span id="special_product_price_<?php echo wpsc_the_product_id(); ?>">
178
  <!-- price display -->
179
- <?php if(wpsc_have_variation_groups()):
180
- while (wpsc_have_variation_groups()) : wpsc_the_variation_group(); ?>
181
- <?php /** the variation HTML and loop */?>
182
- <?php $variation_outputs = Array(); ?>
183
- <?php while (wpsc_have_variations()) : wpsc_the_variation(); ?>
184
- <?php
185
- $variation_outputs[] = '';
186
- $variation_prices[] = wpsc_the_variation_price(true);
187
- endwhile;
188
- // Sort the variations into price order before outputting
189
- $data[] = $variation_outputs;
190
- $data[] = $variation_prices;
191
- array_multisort($data[1],SORT_ASC,SORT_NUMERIC,
192
- $data[0],SORT_ASC,SORT_STRING);?>
193
- <?php endwhile;
194
-
195
- echo __('From', 'wpsc').' : '.wpsc_currency_display( $data[1][0] ); ?>
196
- <?php else: ?>
197
- <?php echo wpsc_currency_display( wpsc_calculate_price( wpsc_the_product_id(),null,true ) ); ?>
198
- <?php endif; ?>
199
  </span><br />
200
  <strong><a class="wpsc_product_title" href="<?php echo wpsc_product_url( wpsc_the_product_id(), false ); ?>"><?php echo wpsc_the_product_title(); ?></a></strong><br />
201
 
176
  <br />
177
  <span id="special_product_price_<?php echo wpsc_the_product_id(); ?>">
178
  <!-- price display -->
179
+ <?php echo wpsc_the_product_price(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  </span><br />
181
  <strong><a class="wpsc_product_title" href="<?php echo wpsc_product_url( wpsc_the_product_id(), false ); ?>"><?php echo wpsc_the_product_title(); ?></a></strong><br />
182