Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix for Buy Now functionality #396

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions wpsc-includes/ajax.functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ function wpsc_empty_cart() {
global $wpsc_cart;
$wpsc_cart->empty_cart( false );

$output = _wpsc_ajax_get_cart( false );
die( json_encode( $output ) );
if( defined('DOING_AJAX') && DOING_AJAX ){
$output = _wpsc_ajax_get_cart( false );
die( json_encode( $output ) );
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was resolved in 8087d74

}

add_action( 'wp_ajax_empty_cart' , 'wpsc_empty_cart' );
Expand Down Expand Up @@ -221,9 +223,10 @@ function wpsc_update_item_quantity() {
* @return mixed Returns an array of output data, alternatively
*/
function _wpsc_ajax_get_cart( $die = true, $cart_messages = array() ) {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {

$return = array();
$return = array();

if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {

ob_start();
include_once( wpsc_get_template_file_path( 'wpsc-cart_widget.php' ) );
Expand Down Expand Up @@ -258,11 +261,12 @@ function _wpsc_ajax_get_cart( $die = true, $cart_messages = array() ) {
$return['action_output'] = $action_output;
}

if ( $die )
die( $output . $action_output );
else
return $return;
}

if ( $die )
die( $output . $action_output );
else
return $return;
}

// execute on POST and GET
Expand Down
2 changes: 1 addition & 1 deletion wpsc-merchants/paypal-standard.merchant.php
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ function form_paypal_multiple() {
}

function _wpsc_buy_now_callback() {
global $wpsc_cart, $user_ID;
global $wpsc_cart, $user_ID, $paypal_url;

$paypal_url = get_option( 'paypal_multiple_url' );
$_POST['custom_gateway'] = 'wpsc_merchant_paypal_standard';
Expand Down