Version Description
- Fix: Reverted pre_get_posts hook. See #1444. This was causing issues with template redirection and selection on search templates.
- Fix: Shipping conflict with target market restrictions on specific categories. See #1711.
- Fix: Taxes were broken following some refactoring of the admin saving callbacks.
- Fix: Quick edit was overwriting variation SKUs and sale prices.
- Fix: RSS Feed error.
- Fix: Ensure flat rates settings are pre-populated by default, to avoid notices on new installs.
- Fix: Forcing SSL when no SSL certificate is installed caused some core post type admin pages to fail to load.
- Fix: In some circumstances, the javascript for country/region selection would fail. See #1404
Download this release
Release Info
| Developer | JustinSainton |
| Plugin | |
| Version | 3.9.2 |
| Comparing to | |
| See all releases | |
Code changes from version 3.9.1 to 3.9.2
- readme.txt +12 -1
- wp-shopping-cart.php +1 -1
- wpsc-admin/admin.php +1 -1
- wpsc-admin/includes/display-items-functions.php +61 -41
- wpsc-components/theme-engine-v1/helpers/ajax.php +33 -26
- wpsc-components/theme-engine-v1/helpers/query.php +8 -6
- wpsc-core/js/wp-e-commerce.js +5 -1
- wpsc-core/wpsc-constants.php +7 -4
- wpsc-shipping/flatrate.php +12 -12
- wpsc-taxes/controllers/taxes_controller.class.php +15 -15
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: https://wpecommerce.org
|
|
| 4 |
Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
|
| 5 |
Requires at least: 3.9
|
| 6 |
Tested up to: 4.1
|
| 7 |
-
Stable tag: 3.9.
|
| 8 |
|
| 9 |
WP eCommerce is a free, powerful plugin that empowers you to sell anything online, quickly and easily.
|
| 10 |
|
|
@@ -36,6 +36,17 @@ After upgrading from earlier versions look for link "Update Store". This will up
|
|
| 36 |
|
| 37 |
== Changelog ==
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
= 3.9.1 =
|
| 40 |
|
| 41 |
* Fix: Disable 3.0 payment gateway API gateways. Will be re-enabled after more vigorous testing.
|
| 4 |
Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
|
| 5 |
Requires at least: 3.9
|
| 6 |
Tested up to: 4.1
|
| 7 |
+
Stable tag: 3.9.2
|
| 8 |
|
| 9 |
WP eCommerce is a free, powerful plugin that empowers you to sell anything online, quickly and easily.
|
| 10 |
|
| 36 |
|
| 37 |
== Changelog ==
|
| 38 |
|
| 39 |
+
= 3.9.2 =
|
| 40 |
+
|
| 41 |
+
* Fix: Reverted pre_get_posts hook. See [#1444](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1444). This was causing issues with template redirection and selection on search templates.
|
| 42 |
+
* Fix: Shipping conflict with target market restrictions on specific categories. See [#1711](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1711).
|
| 43 |
+
* Fix: Taxes were broken following some refactoring of the admin saving callbacks.
|
| 44 |
+
* Fix: Quick edit was overwriting variation SKUs and sale prices.
|
| 45 |
+
* Fix: RSS Feed error.
|
| 46 |
+
* Fix: Ensure flat rates settings are pre-populated by default, to avoid notices on new installs.
|
| 47 |
+
* Fix: Forcing SSL when no SSL certificate is installed caused some core post type admin pages to fail to load.
|
| 48 |
+
* Fix: In some circumstances, the javascript for country/region selection would fail. See [#1404](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1404)
|
| 49 |
+
|
| 50 |
= 3.9.1 =
|
| 51 |
|
| 52 |
* Fix: Disable 3.0 payment gateway API gateways. Will be re-enabled after more vigorous testing.
|
wp-shopping-cart.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
* Plugin Name: WP eCommerce
|
| 4 |
* Plugin URI: http://wpecommerce.org/
|
| 5 |
* Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://wpecommerce.org" target="_blank">WPeCommerce.org</a> | <a href="https://wordpress.org/support/plugin/wp-e-commerce/" target="_blank">Support Forum</a> | <a href="http://docs.wpecommerce.org/" target="_blank">Documentation</a>
|
| 6 |
-
* Version: 3.9.
|
| 7 |
* Author: WP eCommerce
|
| 8 |
* Author URI: http://wpecommerce.org/
|
| 9 |
**/
|
| 3 |
* Plugin Name: WP eCommerce
|
| 4 |
* Plugin URI: http://wpecommerce.org/
|
| 5 |
* Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://wpecommerce.org" target="_blank">WPeCommerce.org</a> | <a href="https://wordpress.org/support/plugin/wp-e-commerce/" target="_blank">Support Forum</a> | <a href="http://docs.wpecommerce.org/" target="_blank">Documentation</a>
|
| 6 |
+
* Version: 3.9.2
|
| 7 |
* Author: WP eCommerce
|
| 8 |
* Author URI: http://wpecommerce.org/
|
| 9 |
**/
|
wpsc-admin/admin.php
CHANGED
|
@@ -911,7 +911,7 @@ add_action( 'wp_dashboard_setup', 'wpsc_dashboard_widget_setup' );
|
|
| 911 |
* @uses wp_widget_rss_output() Display the RSS entries in a list
|
| 912 |
*/
|
| 913 |
function wpsc_dashboard_news() {
|
| 914 |
-
$rss = fetch_feed( '
|
| 915 |
$args = array( 'show_author' => 1, 'show_date' => 1, 'show_summary' => 1, 'items' => 3 );
|
| 916 |
wp_widget_rss_output( $rss, $args );
|
| 917 |
|
| 911 |
* @uses wp_widget_rss_output() Display the RSS entries in a list
|
| 912 |
*/
|
| 913 |
function wpsc_dashboard_news() {
|
| 914 |
+
$rss = fetch_feed( 'http://wpecommerce.org/feed/?category_name=news' );
|
| 915 |
$args = array( 'show_author' => 1, 'show_date' => 1, 'show_summary' => 1, 'items' => 3 );
|
| 916 |
wp_widget_rss_output( $rss, $args );
|
| 917 |
|
wpsc-admin/includes/display-items-functions.php
CHANGED
|
@@ -1238,82 +1238,101 @@ function wpsc_save_attachment_fields( $post, $attachment ) {
|
|
| 1238 |
}
|
| 1239 |
|
| 1240 |
/**
|
| 1241 |
-
*
|
| 1242 |
-
* Saves input for the various meta in the quick edit boxes
|
| 1243 |
*
|
| 1244 |
-
*
|
| 1245 |
-
*
|
| 1246 |
-
* @todo
|
| 1247 |
-
* @
|
|
|
|
|
|
|
|
|
|
| 1248 |
*/
|
| 1249 |
-
|
| 1250 |
function wpsc_save_quickedit_box( $post_id ) {
|
|
|
|
| 1251 |
global $doaction;
|
| 1252 |
|
| 1253 |
-
|
|
|
|
| 1254 |
return;
|
|
|
|
| 1255 |
|
| 1256 |
-
$bulk = isset( $doaction ) && $doaction =='edit';
|
| 1257 |
|
|
|
|
| 1258 |
$custom_fields = array(
|
| 1259 |
-
'weight'
|
| 1260 |
-
'stock'
|
| 1261 |
-
'price'
|
| 1262 |
'sale_price' => 'special_price',
|
| 1263 |
-
'sku'
|
| 1264 |
);
|
| 1265 |
|
| 1266 |
-
|
| 1267 |
-
|
| 1268 |
-
|
| 1269 |
-
|
| 1270 |
-
|
| 1271 |
-
|
| 1272 |
-
$is_parent = (bool)$children;
|
|
|
|
| 1273 |
foreach ( $custom_fields as $post_key => $meta_key ) {
|
| 1274 |
-
|
| 1275 |
-
//
|
| 1276 |
-
if ( ! isset( $_REQUEST[$post_key] ) || ( $bulk && empty( $_REQUEST[$post_key] ) )
|
| 1277 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1278 |
continue;
|
| 1279 |
}
|
| 1280 |
|
| 1281 |
-
|
| 1282 |
-
|
| 1283 |
-
|
| 1284 |
-
|
|
|
|
| 1285 |
}
|
| 1286 |
|
| 1287 |
-
foreach($products as $
|
| 1288 |
-
$value = $_REQUEST[$post_key];
|
| 1289 |
-
|
| 1290 |
-
|
| 1291 |
switch ( $post_key ) {
|
|
|
|
| 1292 |
case 'weight':
|
| 1293 |
$product_meta = get_post_meta( $post_id, '_wpsc_product_metadata', true );
|
| 1294 |
-
if ( ! is_array( $product_meta ) )
|
| 1295 |
$product_meta = array();
|
| 1296 |
-
|
| 1297 |
-
$weight_unit = isset( $product_meta["weight_unit"] ) ? $product_meta["weight_unit"] : 'pound';
|
| 1298 |
-
$weight = wpsc_convert_weight( $value, $weight_unit, "pound", true );
|
| 1299 |
|
| 1300 |
-
|
| 1301 |
-
|
|
|
|
| 1302 |
|
| 1303 |
-
$product_meta[
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1304 |
|
| 1305 |
$value = $product_meta;
|
| 1306 |
break;
|
| 1307 |
|
| 1308 |
case 'stock':
|
| 1309 |
-
if ( ! is_numeric( $value ) )
|
| 1310 |
$value = '';
|
|
|
|
| 1311 |
break;
|
| 1312 |
|
| 1313 |
case 'sku':
|
| 1314 |
-
if ( $value == __( 'N/A', 'wpsc' ) )
|
| 1315 |
$value = '';
|
|
|
|
| 1316 |
break;
|
|
|
|
| 1317 |
}
|
| 1318 |
|
| 1319 |
update_post_meta( $post_id, "_wpsc_{$meta_key}", $value );
|
|
@@ -1321,6 +1340,7 @@ function wpsc_save_quickedit_box( $post_id ) {
|
|
| 1321 |
}
|
| 1322 |
|
| 1323 |
return $post_id;
|
|
|
|
| 1324 |
}
|
| 1325 |
|
| 1326 |
/**
|
| 1238 |
}
|
| 1239 |
|
| 1240 |
/**
|
| 1241 |
+
* Save Product Quick Edit Box
|
|
|
|
| 1242 |
*
|
| 1243 |
+
* Saves input for the various meta in the quick edit boxes.
|
| 1244 |
+
*
|
| 1245 |
+
* @todo UI.
|
| 1246 |
+
* @todo Data validation / sanitization / security.
|
| 1247 |
+
* @todo AJAX should probably return weight unit.
|
| 1248 |
+
*
|
| 1249 |
+
* @return int $post_id Post ID.
|
| 1250 |
*/
|
|
|
|
| 1251 |
function wpsc_save_quickedit_box( $post_id ) {
|
| 1252 |
+
|
| 1253 |
global $doaction;
|
| 1254 |
|
| 1255 |
+
// Only save product if saving (not autosaving) via AJAX.
|
| 1256 |
+
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || get_post_type( $post_id ) != 'wpsc-product' ) {
|
| 1257 |
return;
|
| 1258 |
+
}
|
| 1259 |
|
| 1260 |
+
$bulk = isset( $doaction ) && $doaction == 'edit';
|
| 1261 |
|
| 1262 |
+
// Map post field to meta key.
|
| 1263 |
$custom_fields = array(
|
| 1264 |
+
'weight' => 'product_metadata',
|
| 1265 |
+
'stock' => 'stock',
|
| 1266 |
+
'price' => 'price',
|
| 1267 |
'sale_price' => 'special_price',
|
| 1268 |
+
'sku' => 'sku'
|
| 1269 |
);
|
| 1270 |
|
| 1271 |
+
// Get product variations (if any).
|
| 1272 |
+
$children = get_children( array(
|
| 1273 |
+
'post_parent' => $post_id,
|
| 1274 |
+
'post_type' => 'wpsc-product',
|
| 1275 |
+
'post_status' => 'inherit'
|
| 1276 |
+
) );
|
| 1277 |
+
$is_parent = (bool) $children;
|
| 1278 |
+
|
| 1279 |
foreach ( $custom_fields as $post_key => $meta_key ) {
|
| 1280 |
+
|
| 1281 |
+
// Don't update if field is not set or we're bulk updating and the field is left blank.
|
| 1282 |
+
if ( ! isset( $_REQUEST[ $post_key ] ) || ( $bulk && empty( $_REQUEST[ $post_key ] ) ) ) {
|
| 1283 |
+
continue;
|
| 1284 |
+
}
|
| 1285 |
+
|
| 1286 |
+
// Don't update if the product has variations and the field is one of the defined custom fields (unless overridden).
|
| 1287 |
+
$override_variant = isset( $_REQUEST[ $post_key . '_variant' ] ) && $_REQUEST[ $post_key . '_variant' ] == 'on';
|
| 1288 |
+
if ( $is_parent && ! $override_variant && in_array( $post_key, array_keys( $custom_fields ) ) ) {
|
| 1289 |
continue;
|
| 1290 |
}
|
| 1291 |
|
| 1292 |
+
// Select single product or variation IDs.
|
| 1293 |
+
if ( $is_parent && count( $children ) > 0 ) {
|
| 1294 |
+
$products = wp_list_pluck( $children, 'ID' );
|
| 1295 |
+
} else {
|
| 1296 |
+
$products = array( $post_id );
|
| 1297 |
}
|
| 1298 |
|
| 1299 |
+
foreach ( $products as $post_id ) {
|
| 1300 |
+
$value = $_REQUEST[ $post_key ];
|
| 1301 |
+
|
| 1302 |
+
// Validate custom field values
|
| 1303 |
switch ( $post_key ) {
|
| 1304 |
+
|
| 1305 |
case 'weight':
|
| 1306 |
$product_meta = get_post_meta( $post_id, '_wpsc_product_metadata', true );
|
| 1307 |
+
if ( ! is_array( $product_meta ) ) {
|
| 1308 |
$product_meta = array();
|
| 1309 |
+
}
|
|
|
|
|
|
|
| 1310 |
|
| 1311 |
+
// Draft products don't have product metadata set yet
|
| 1312 |
+
$weight_unit = isset( $product_meta['weight_unit'] ) ? $product_meta['weight_unit'] : 'pound';
|
| 1313 |
+
$weight = wpsc_convert_weight( $value, $weight_unit, 'pound', true );
|
| 1314 |
|
| 1315 |
+
if ( isset( $product_meta['weight'] ) ) {
|
| 1316 |
+
unset( $product_meta['weight'] );
|
| 1317 |
+
}
|
| 1318 |
+
|
| 1319 |
+
$product_meta['weight'] = $weight;
|
| 1320 |
|
| 1321 |
$value = $product_meta;
|
| 1322 |
break;
|
| 1323 |
|
| 1324 |
case 'stock':
|
| 1325 |
+
if ( ! is_numeric( $value ) ) {
|
| 1326 |
$value = '';
|
| 1327 |
+
}
|
| 1328 |
break;
|
| 1329 |
|
| 1330 |
case 'sku':
|
| 1331 |
+
if ( $value == __( 'N/A', 'wpsc' ) ) {
|
| 1332 |
$value = '';
|
| 1333 |
+
}
|
| 1334 |
break;
|
| 1335 |
+
|
| 1336 |
}
|
| 1337 |
|
| 1338 |
update_post_meta( $post_id, "_wpsc_{$meta_key}", $value );
|
| 1340 |
}
|
| 1341 |
|
| 1342 |
return $post_id;
|
| 1343 |
+
|
| 1344 |
}
|
| 1345 |
|
| 1346 |
/**
|
wpsc-components/theme-engine-v1/helpers/ajax.php
CHANGED
|
@@ -599,35 +599,42 @@ function wpsc_submit_checkout( $collected_data = true ) {
|
|
| 599 |
$error_messages = array();
|
| 600 |
}
|
| 601 |
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
$countries = wpsc_get_meta( $catid[0], 'target_market', 'wpsc_category' );
|
| 612 |
-
else
|
| 613 |
-
$countries = wpsc_get_meta( $catid, 'target_market', 'wpsc_category' );
|
| 614 |
-
|
| 615 |
-
if ( ! empty($countries) && ! in_array( $country_id, (array)$countries ) ) {
|
| 616 |
-
$errormessage = sprintf( __( '%s cannot be shipped to %s. To continue with your transaction please remove this product from the list below.', 'wpsc' ), $cartitem->get_title(), $country_name );
|
| 617 |
-
wpsc_update_customer_meta( 'category_shipping_conflict', $errormessage );
|
| 618 |
-
$is_valid = false;
|
| 619 |
}
|
| 620 |
-
}
|
| 621 |
|
| 622 |
-
|
| 623 |
-
$num_items++;
|
| 624 |
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
|
|
|
| 630 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 631 |
}
|
| 632 |
|
| 633 |
// check to see if the current gateway is in the list of available gateways
|
|
@@ -680,7 +687,7 @@ function wpsc_submit_checkout( $collected_data = true ) {
|
|
| 680 |
$delivery_country = $wpsc_cart->delivery_country;
|
| 681 |
$delivery_region = $wpsc_cart->delivery_region;
|
| 682 |
|
| 683 |
-
if ( wpsc_uses_shipping(
|
| 684 |
$shipping_method = $wpsc_cart->selected_shipping_method;
|
| 685 |
$shipping_option = $wpsc_cart->selected_shipping_option;
|
| 686 |
} else {
|
| 599 |
$error_messages = array();
|
| 600 |
}
|
| 601 |
|
| 602 |
+
if ( wpsc_uses_shipping() ) {
|
| 603 |
+
$wpsc_country = new WPSC_Country( wpsc_get_customer_meta( 'shippingcountry' ) );
|
| 604 |
+
$country_id = $wpsc_country->get_id();
|
| 605 |
+
$country_name = $wpsc_country->get_name();
|
| 606 |
+
|
| 607 |
+
foreach ( $wpsc_cart->cart_items as $cartitem ) {
|
| 608 |
+
|
| 609 |
+
if ( ! empty( $cartitem->meta[0]['no_shipping'] ) ) {
|
| 610 |
+
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 611 |
}
|
|
|
|
| 612 |
|
| 613 |
+
$category_ids = $cartitem->category_id_list;
|
|
|
|
| 614 |
|
| 615 |
+
foreach ( (array) $category_ids as $catid ) {
|
| 616 |
+
if ( is_array( $catid ) ) {
|
| 617 |
+
$countries = wpsc_get_meta( $catid[0], 'target_market', 'wpsc_category' );
|
| 618 |
+
} else {
|
| 619 |
+
$countries = wpsc_get_meta( $catid, 'target_market', 'wpsc_category' );
|
| 620 |
+
}
|
| 621 |
|
| 622 |
+
if ( ! empty( $countries ) && ! in_array( $country_id, (array) $countries ) ) {
|
| 623 |
+
$errormessage = sprintf( __( '%s cannot be shipped to %s. To continue with your transaction please remove this product from the list below.', 'wpsc' ), $cartitem->get_title(), $country_name );
|
| 624 |
+
wpsc_update_customer_meta( 'category_shipping_conflict', $errormessage );
|
| 625 |
+
$is_valid = false;
|
| 626 |
+
}
|
| 627 |
+
}
|
| 628 |
+
|
| 629 |
+
//count number of items, and number of items using shipping
|
| 630 |
+
$num_items++;
|
| 631 |
+
|
| 632 |
+
if ( $cartitem->uses_shipping != 1 ) {
|
| 633 |
+
$disregard_shipping++;
|
| 634 |
+
} else {
|
| 635 |
+
$use_shipping++;
|
| 636 |
+
}
|
| 637 |
+
}
|
| 638 |
}
|
| 639 |
|
| 640 |
// check to see if the current gateway is in the list of available gateways
|
| 687 |
$delivery_country = $wpsc_cart->delivery_country;
|
| 688 |
$delivery_region = $wpsc_cart->delivery_region;
|
| 689 |
|
| 690 |
+
if ( wpsc_uses_shipping() ) {
|
| 691 |
$shipping_method = $wpsc_cart->selected_shipping_method;
|
| 692 |
$shipping_option = $wpsc_cart->selected_shipping_option;
|
| 693 |
} else {
|
wpsc-components/theme-engine-v1/helpers/query.php
CHANGED
|
@@ -14,8 +14,6 @@ if ( is_ssl() ) {
|
|
| 14 |
add_filter( 'wp_nav_menu_args', 'wpsc_switch_the_query', 99 );
|
| 15 |
add_filter( 'request', 'wpsc_filter_query_request' );
|
| 16 |
add_filter( 'pre_get_posts', 'wpsc_split_the_query', 8 );
|
| 17 |
-
// Prevent later hooks from being skipped. See #1444.
|
| 18 |
-
add_filter( 'pre_get_posts', '__return_null', 8 );
|
| 19 |
add_filter( 'parse_query', 'wpsc_mark_product_query', 12 );
|
| 20 |
add_filter( 'query_vars', 'wpsc_query_vars' );
|
| 21 |
|
|
@@ -585,14 +583,18 @@ function wpsc_filter_request( $q ) {
|
|
| 585 |
* if the user is on a checkout page, force SSL if that option is so set
|
| 586 |
*/
|
| 587 |
function wpsc_force_ssl() {
|
|
|
|
| 588 |
global $wp_query;
|
| 589 |
-
|
|
|
|
|
|
|
|
|
|
| 590 |
! is_ssl() &&
|
| 591 |
! empty ( $wp_query->post->post_content ) &&
|
| 592 |
false !== strpos( $wp_query->post->post_content, '[shoppingcart]' ) ) {
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
|
| 596 |
}
|
| 597 |
}
|
| 598 |
|
| 14 |
add_filter( 'wp_nav_menu_args', 'wpsc_switch_the_query', 99 );
|
| 15 |
add_filter( 'request', 'wpsc_filter_query_request' );
|
| 16 |
add_filter( 'pre_get_posts', 'wpsc_split_the_query', 8 );
|
|
|
|
|
|
|
| 17 |
add_filter( 'parse_query', 'wpsc_mark_product_query', 12 );
|
| 18 |
add_filter( 'query_vars', 'wpsc_query_vars' );
|
| 19 |
|
| 583 |
* if the user is on a checkout page, force SSL if that option is so set
|
| 584 |
*/
|
| 585 |
function wpsc_force_ssl() {
|
| 586 |
+
|
| 587 |
global $wp_query;
|
| 588 |
+
|
| 589 |
+
if (
|
| 590 |
+
! is_admin() &&
|
| 591 |
+
'1' == get_option( 'wpsc_force_ssl' ) &&
|
| 592 |
! is_ssl() &&
|
| 593 |
! empty ( $wp_query->post->post_content ) &&
|
| 594 |
false !== strpos( $wp_query->post->post_content, '[shoppingcart]' ) ) {
|
| 595 |
+
$sslurl = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
| 596 |
+
wp_redirect( $sslurl );
|
| 597 |
+
exit;
|
| 598 |
}
|
| 599 |
}
|
| 600 |
|
wpsc-core/js/wp-e-commerce.js
CHANGED
|
@@ -922,7 +922,11 @@ function wpsc_get_value_from_wpsc_meta_element( meta ) {
|
|
| 922 |
meta_value = '';
|
| 923 |
}
|
| 924 |
} else if ( element.is('select') ) {
|
| 925 |
-
meta_value = element.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 926 |
} else {
|
| 927 |
meta_value = element.val();
|
| 928 |
}
|
| 922 |
meta_value = '';
|
| 923 |
}
|
| 924 |
} else if ( element.is('select') ) {
|
| 925 |
+
meta_value = element.val();
|
| 926 |
+
if ( ! meta_value && 'none' == element.css('display') ) {
|
| 927 |
+
meta_value = element.find( 'option[selected]' ).val();
|
| 928 |
+
}
|
| 929 |
+
|
| 930 |
} else {
|
| 931 |
meta_value = element.val();
|
| 932 |
}
|
wpsc-core/wpsc-constants.php
CHANGED
|
@@ -53,15 +53,15 @@ function wpsc_core_constants() {
|
|
| 53 |
|
| 54 |
// Define Plugin version
|
| 55 |
if ( ! defined( 'WPSC_VERSION' ) ) {
|
| 56 |
-
define( 'WPSC_VERSION' , '3.9.
|
| 57 |
}
|
| 58 |
|
| 59 |
if ( ! defined( 'WPSC_MINOR_VERSION' ) ) {
|
| 60 |
-
define( 'WPSC_MINOR_VERSION' , '
|
| 61 |
}
|
| 62 |
|
| 63 |
if ( ! defined( 'WPSC_PRESENTABLE_VERSION' ) ) {
|
| 64 |
-
define( 'WPSC_PRESENTABLE_VERSION', '3.9.
|
| 65 |
}
|
| 66 |
|
| 67 |
// Define a salt to use when we hash, WPSC_SALT may be defined for us in our config file, so check first
|
|
@@ -93,10 +93,13 @@ function wpsc_core_constants() {
|
|
| 93 |
define( 'WPSC_CORE_JS_URL' , WPSC_URL . '/wpsc-core/js' );
|
| 94 |
define( 'WPSC_CORE_JS_PATH', WPSC_FILE_PATH . '/wpsc-core/js' );
|
| 95 |
|
|
|
|
| 96 |
// Require loading of deprecated functions for now. We will ween WPEC off
|
| 97 |
// of this in future versions.
|
| 98 |
if ( ! defined( 'WPEC_LOAD_DEPRECATED' ) ) {
|
| 99 |
-
|
|
|
|
|
|
|
| 100 |
}
|
| 101 |
|
| 102 |
// Do not require loading of deprecated JS of this in future versions.
|
| 53 |
|
| 54 |
// Define Plugin version
|
| 55 |
if ( ! defined( 'WPSC_VERSION' ) ) {
|
| 56 |
+
define( 'WPSC_VERSION' , '3.9.2' );
|
| 57 |
}
|
| 58 |
|
| 59 |
if ( ! defined( 'WPSC_MINOR_VERSION' ) ) {
|
| 60 |
+
define( 'WPSC_MINOR_VERSION' , '7fdd6de' );
|
| 61 |
}
|
| 62 |
|
| 63 |
if ( ! defined( 'WPSC_PRESENTABLE_VERSION' ) ) {
|
| 64 |
+
define( 'WPSC_PRESENTABLE_VERSION', '3.9.2' );
|
| 65 |
}
|
| 66 |
|
| 67 |
// Define a salt to use when we hash, WPSC_SALT may be defined for us in our config file, so check first
|
| 93 |
define( 'WPSC_CORE_JS_URL' , WPSC_URL . '/wpsc-core/js' );
|
| 94 |
define( 'WPSC_CORE_JS_PATH', WPSC_FILE_PATH . '/wpsc-core/js' );
|
| 95 |
|
| 96 |
+
|
| 97 |
// Require loading of deprecated functions for now. We will ween WPEC off
|
| 98 |
// of this in future versions.
|
| 99 |
if ( ! defined( 'WPEC_LOAD_DEPRECATED' ) ) {
|
| 100 |
+
// use a filter so that themes can turn this off without editing config or code,
|
| 101 |
+
$load_deprecated = apply_filters( 'wpsc_load_deprecated', true );
|
| 102 |
+
define( 'WPEC_LOAD_DEPRECATED', $load_deprecated );
|
| 103 |
}
|
| 104 |
|
| 105 |
// Do not require loading of deprecated JS of this in future versions.
|
wpsc-shipping/flatrate.php
CHANGED
|
@@ -179,31 +179,31 @@ class flatrate {
|
|
| 179 |
|
| 180 |
} else {
|
| 181 |
|
| 182 |
-
$flatrates = get_option('flat_rates');
|
| 183 |
$shipping_quotes = array();
|
| 184 |
|
| 185 |
-
switch ($country) {
|
| 186 |
case 'NZ':
|
| 187 |
-
if (strlen($flatrates['northisland']) > 0) {
|
| 188 |
-
$shipping_quotes[__( 'North Island', 'wpsc' )] = esc_attr($flatrates['northisland']);
|
| 189 |
}
|
| 190 |
-
if (strlen($flatrates['southisland']) > 0) {
|
| 191 |
-
$shipping_quotes[__( 'South Island', 'wpsc' )] = esc_attr($flatrates['southisland']);
|
| 192 |
}
|
| 193 |
break;
|
| 194 |
|
| 195 |
case 'US':
|
| 196 |
-
if (strlen($flatrates['continental']) > 0) {
|
| 197 |
-
$shipping_quotes[__( 'Continental 48 States', 'wpsc' )] = esc_attr($flatrates['continental']);
|
| 198 |
}
|
| 199 |
-
if (strlen($flatrates['all']) > 0) {
|
| 200 |
-
$shipping_quotes[__( 'All 50 States', 'wpsc' )] = esc_attr($flatrates['all']);
|
| 201 |
}
|
| 202 |
break;
|
| 203 |
|
| 204 |
default:
|
| 205 |
-
if (strlen($flatrates['local']) > 0) {
|
| 206 |
-
$shipping_quotes[__( 'Local Shipping', 'wpsc' )] = esc_attr($flatrates['local']);
|
| 207 |
}
|
| 208 |
break;
|
| 209 |
}
|
| 179 |
|
| 180 |
} else {
|
| 181 |
|
| 182 |
+
$flatrates = get_option( 'flat_rates' );
|
| 183 |
$shipping_quotes = array();
|
| 184 |
|
| 185 |
+
switch ( $country ) {
|
| 186 |
case 'NZ':
|
| 187 |
+
if ( isset( $flatrates['northisland'] ) && strlen( $flatrates['northisland'] ) > 0 ) {
|
| 188 |
+
$shipping_quotes[ __( 'North Island', 'wpsc' ) ] = esc_attr( $flatrates['northisland'] );
|
| 189 |
}
|
| 190 |
+
if ( isset( $flatrates['southisland'] ) && strlen( $flatrates['southisland'] ) > 0 ) {
|
| 191 |
+
$shipping_quotes[ __( 'South Island', 'wpsc' ) ] = esc_attr( $flatrates['southisland'] );
|
| 192 |
}
|
| 193 |
break;
|
| 194 |
|
| 195 |
case 'US':
|
| 196 |
+
if ( isset( $flatrates['continental'] ) && strlen( $flatrates['continental'] ) > 0 ) {
|
| 197 |
+
$shipping_quotes[ __( 'Continental 48 States', 'wpsc' ) ] = esc_attr( $flatrates['continental'] );
|
| 198 |
}
|
| 199 |
+
if ( isset( $flatrates['all'] ) && strlen( $flatrates['all'] ) > 0 ) {
|
| 200 |
+
$shipping_quotes[ __( 'All 50 States', 'wpsc' ) ] = esc_attr( $flatrates['all'] );
|
| 201 |
}
|
| 202 |
break;
|
| 203 |
|
| 204 |
default:
|
| 205 |
+
if ( isset( $flatrates['local'] ) && strlen( $flatrates['local'] ) > 0 ) {
|
| 206 |
+
$shipping_quotes[ __( 'Local Shipping', 'wpsc' ) ] = esc_attr( $flatrates['local'] );
|
| 207 |
}
|
| 208 |
break;
|
| 209 |
}
|
wpsc-taxes/controllers/taxes_controller.class.php
CHANGED
|
@@ -146,22 +146,22 @@ class wpec_taxes_controller {
|
|
| 146 |
$returnable = false;
|
| 147 |
|
| 148 |
//do not calculate tax for this item if it is not taxable
|
| 149 |
-
if ( ! isset( $cart_item->meta[0]['wpec_taxes_taxable'] ) ) {
|
| 150 |
if ( $this->wpec_taxes_run_logic() ) {
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
}
|
| 166 |
|
| 167 |
return $returnable;
|
|
@@ -179,7 +179,7 @@ class wpec_taxes_controller {
|
|
| 179 |
global $wpsc_cart;
|
| 180 |
$returnable = false;
|
| 181 |
//do not calculate tax for this item if it is not taxable
|
| 182 |
-
if ( ! isset( $cart_item->meta[0]['wpec_taxes_taxable'] ) ) {
|
| 183 |
if ( $this->wpec_taxes_run_logic() ) {
|
| 184 |
$wpec_base_country = $this->wpec_taxes_retrieve_selected_country();
|
| 185 |
$region = $this->wpec_taxes_retrieve_region();
|
| 146 |
$returnable = false;
|
| 147 |
|
| 148 |
//do not calculate tax for this item if it is not taxable
|
| 149 |
+
if ( ! isset( $cart_item->meta[0]['wpec_taxes_taxable'] ) || empty( $cart_item->meta[0]['wpec_taxes_taxable'] ) ) {
|
| 150 |
if ( $this->wpec_taxes_run_logic() ) {
|
| 151 |
+
//get the taxable amount
|
| 152 |
+
if ( isset( $cart_item->meta[0]['wpec_taxes_taxable_amount'] ) && ! empty( $cart_item->meta[0]['wpec_taxes_taxable_amount'] ) ) {
|
| 153 |
+
//if there is a taxable amount defined for this product use this to calculate taxes
|
| 154 |
+
$taxable_amount = $cart_item->meta[0]['wpec_taxes_taxable_amount'];
|
| 155 |
+
} else {
|
| 156 |
+
// there is no taxable amount found - use the unit price
|
| 157 |
+
$taxable_amount = $cart_item->unit_price;
|
| 158 |
+
}
|
| 159 |
+
// get the taxable price - unit price multiplied by qty
|
| 160 |
+
$taxable_price = $taxable_amount * $cart_item->quantity;
|
| 161 |
|
| 162 |
+
// calculate tax
|
| 163 |
+
$returnable = array( 'tax' => $this->wpec_taxes_calculate_tax( $taxable_price, $tax_rate['rate'] ), 'rate' => $tax_rate['rate'] );
|
| 164 |
+
}
|
| 165 |
}
|
| 166 |
|
| 167 |
return $returnable;
|
| 179 |
global $wpsc_cart;
|
| 180 |
$returnable = false;
|
| 181 |
//do not calculate tax for this item if it is not taxable
|
| 182 |
+
if ( ! isset( $cart_item->meta[0]['wpec_taxes_taxable'] ) || empty( $cart_item->meta[0]['wpec_taxes_taxable'] ) ) {
|
| 183 |
if ( $this->wpec_taxes_run_logic() ) {
|
| 184 |
$wpec_base_country = $this->wpec_taxes_retrieve_selected_country();
|
| 185 |
$region = $this->wpec_taxes_retrieve_region();
|
