Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
omarabid committed Mar 26, 2015
2 parents 953181f + 1c82f30 commit 2796cdc
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 37 deletions.
10 changes: 9 additions & 1 deletion readme.txt
Expand Up @@ -4,7 +4,7 @@ Donate link: https://wpecommerce.org
Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
Requires at least: 3.9
Tested up to: 4.1
Stable tag: 4.0-dev
Stable tag: 3.9.2

WP eCommerce is a free, powerful plugin that empowers you to sell anything online, quickly and easily.

Expand Down Expand Up @@ -36,6 +36,14 @@ After upgrading from earlier versions look for link "Update Store". This will up

== Changelog ==

= 3.9.2 =

* 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.
* Fix: Shipping conflict with target market restrictions on specific categories. See [#1711](https://github.com/wp-e-commerce/WP-e-Commerce/issues/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.

= 3.9.1 =

* Fix: Disable 3.0 payment gateway API gateways. Will be re-enabled after more vigorous testing.
Expand Down
2 changes: 1 addition & 1 deletion wp-shopping-cart.php
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WP eCommerce
* Plugin URI: http://wpecommerce.org/
* 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>
* Version: 4.0-dev
* Version: 3.9.2
* Author: WP eCommerce
* Author URI: http://wpecommerce.org/
**/
Expand Down
Expand Up @@ -460,7 +460,7 @@ public function display() {
<?php
if ( ! function_exists( 'product_display_grid' ) ) {
?>
<a href='http://wpecommerce.org/store/premium-plugins/'><?php esc_html_e( 'Purchase unavailable options', 'wpsc' ); ?></a>
<a href='http://wpecommerce.org/store/premium-plugins/gold-cart/'><?php esc_html_e( 'Purchase unavailable options', 'wpsc' ); ?></a>
<?php
}
?>
Expand Down Expand Up @@ -1234,4 +1234,4 @@ public function display() {
</table>
<?php
}
}
}
59 changes: 33 additions & 26 deletions wpsc-components/theme-engine-v1/helpers/ajax.php
Expand Up @@ -599,35 +599,42 @@ function wpsc_submit_checkout( $collected_data = true ) {
$error_messages = array();
}

$wpsc_country = new WPSC_Country( wpsc_get_customer_meta( 'shippingcountry' ) );
$country_id = $wpsc_country->get_id();
$country_name = $wpsc_country->get_name();

foreach ( $wpsc_cart->cart_items as $cartitem ) {
if ( ! empty( $cartitem->meta[0]['no_shipping'] ) ) continue;
$categoriesIDs = $cartitem->category_id_list;
foreach ( (array)$categoriesIDs as $catid ) {
if ( is_array( $catid ) )
$countries = wpsc_get_meta( $catid[0], 'target_market', 'wpsc_category' );
else
$countries = wpsc_get_meta( $catid, 'target_market', 'wpsc_category' );

if ( ! empty($countries) && ! in_array( $country_id, (array)$countries ) ) {
$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 );
wpsc_update_customer_meta( 'category_shipping_conflict', $errormessage );
$is_valid = false;
if ( wpsc_uses_shipping() ) {
$wpsc_country = new WPSC_Country( wpsc_get_customer_meta( 'shippingcountry' ) );
$country_id = $wpsc_country->get_id();
$country_name = $wpsc_country->get_name();

foreach ( $wpsc_cart->cart_items as $cartitem ) {

if ( ! empty( $cartitem->meta[0]['no_shipping'] ) ) {
continue;
}
}

//count number of items, and number of items using shipping
$num_items++;
$category_ids = $cartitem->category_id_list;

if ( $cartitem->uses_shipping != 1 ) {
$disregard_shipping++;
} else {
$use_shipping++;
}
foreach ( (array) $category_ids as $catid ) {
if ( is_array( $catid ) ) {
$countries = wpsc_get_meta( $catid[0], 'target_market', 'wpsc_category' );
} else {
$countries = wpsc_get_meta( $catid, 'target_market', 'wpsc_category' );
}

if ( ! empty( $countries ) && ! in_array( $country_id, (array) $countries ) ) {
$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 );
wpsc_update_customer_meta( 'category_shipping_conflict', $errormessage );
$is_valid = false;
}
}

//count number of items, and number of items using shipping
$num_items++;

if ( $cartitem->uses_shipping != 1 ) {
$disregard_shipping++;
} else {
$use_shipping++;
}
}
}

// check to see if the current gateway is in the list of available gateways
Expand Down Expand Up @@ -680,7 +687,7 @@ function wpsc_submit_checkout( $collected_data = true ) {
$delivery_country = $wpsc_cart->delivery_country;
$delivery_region = $wpsc_cart->delivery_region;

if ( wpsc_uses_shipping( ) ) {
if ( wpsc_uses_shipping() ) {
$shipping_method = $wpsc_cart->selected_shipping_method;
$shipping_option = $wpsc_cart->selected_shipping_option;
} else {
Expand Down
2 changes: 0 additions & 2 deletions wpsc-components/theme-engine-v1/helpers/query.php
Expand Up @@ -14,8 +14,6 @@
add_filter( 'wp_nav_menu_args', 'wpsc_switch_the_query', 99 );
add_filter( 'request', 'wpsc_filter_query_request' );
add_filter( 'pre_get_posts', 'wpsc_split_the_query', 8 );
// Prevent later hooks from being skipped. See #1444.
add_filter( 'pre_get_posts', '__return_null', 8 );
add_filter( 'parse_query', 'wpsc_mark_product_query', 12 );
add_filter( 'query_vars', 'wpsc_query_vars' );

Expand Down
6 changes: 3 additions & 3 deletions wpsc-core/wpsc-constants.php
Expand Up @@ -53,15 +53,15 @@ function wpsc_core_constants() {

// Define Plugin version
if ( ! defined( 'WPSC_VERSION' ) ) {
define( 'WPSC_VERSION' , '4.0-dev' );
define( 'WPSC_VERSION' , '3.9.2' );
}

if ( ! defined( 'WPSC_MINOR_VERSION' ) ) {
define( 'WPSC_MINOR_VERSION' , '66518b9' );
define( 'WPSC_MINOR_VERSION' , '7fdd6de' );
}

if ( ! defined( 'WPSC_PRESENTABLE_VERSION' ) ) {
define( 'WPSC_PRESENTABLE_VERSION', '4.0-dev' );
define( 'WPSC_PRESENTABLE_VERSION', '3.9.2' );
}

// Define a salt to use when we hash, WPSC_SALT may be defined for us in our config file, so check first
Expand Down
10 changes: 10 additions & 0 deletions wpsc-includes/processing.functions.php
Expand Up @@ -173,6 +173,16 @@ function wpsc_get_currency_symbol(){
return $wpsc_currency_data;
}

/**
* wpsc_get_currency_code
*
* @param does not receive anything
* @return returns the currency code used for the shop
*/
function wpsc_get_currency_code(){
return WPSC_Countries::get_currency_code( get_option( 'currency_type' ) );
}

/**
* All the code below here needs commenting and looking at to see if it needs to be altered or disposed of.
* Correspondingly, all the code above here has been commented, uses the wpsc prefix, and has been made for or modified to work with the object oriented cart code.
Expand Down
5 changes: 3 additions & 2 deletions wpsc-includes/purchase-log.helpers.php
Expand Up @@ -230,9 +230,10 @@ function wpsc_send_admin_email( $purchase_log, $force = false ) {
}

function wpsc_get_transaction_html_output( $purchase_log ) {
if ( ! is_object( $purchase_log ) )
$purchase_log = new WPSC_Purchase_Log( $purchase_log );

if ( ! is_object( $purchase_log ) ) {
$purchase_log = new WPSC_Purchase_Log( $purchase_log );
}

$notification = new WPSC_Purchase_Log_Customer_HTML_Notification( $purchase_log );
$output = $notification->get_html_message();
Expand Down

0 comments on commit 2796cdc

Please sign in to comment.