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

Already on GitHub? Sign in to your account

Hotfix for Buy Now functionality #396

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

1bigidea commented May 6, 2013

There are two errors related to wrapping conditions with DOING_AJAX that 1) cause a fatal error (since no value is returned if we aren't DOING_AJAX) and 2) wpsc_empty_cart shouldn't die if we aren't DOING_AJAX

1bigidea added some commits May 6, 2013

Operand error on line 112 of wpsc-includes/ajax-functions.php when us…
…ing Buy Now

_wpsc_ajax_get_cart returns NULL when called via BUY NOW (since this is
NOT an ajax call)

@JustinSainton JustinSainton commented on the diff May 6, 2013

wpsc-includes/ajax.functions.php
@@ -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 ) );
+ }
@JustinSainton

JustinSainton May 6, 2013

Owner

This was resolved in 8087d74

Contributor

1bigidea commented May 6, 2013

I was testing my Buy Now with Variations pull against the master I pulled earlier today. It wasn't working so I dug in to figure out why. Appears we were working parallel. I am closing this as a dupe.

@1bigidea 1bigidea closed this May 6, 2013

Owner

JustinSainton commented May 6, 2013

Not entirely duplicate, actually - as the commit I referred to did not place the $return array outside of the AJAX condition.

@JustinSainton JustinSainton reopened this May 6, 2013

Contributor

1bigidea commented May 6, 2013

We have to return an empty array. Otherwise it returns a NULL which then causes a fatal.

Owner

JustinSainton commented May 6, 2013

Right, I'm agreeing with you :)

Owner

JustinSainton commented May 6, 2013

This bit committed and fixed in 47178bd. Still have some work to do elsewhere (See #395) Thanks Tom!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment