3
votes

i've a problem with paypal integration in magento. If i choose paypal standard payment and confirm order, i'm correctly redirect to paypal site for payment, but if i press back button on the browser i am redirected in /checkout/cart (that is empty) and in my backend my order was placed and in PENDING status (it's not shown in customers order list)... This happens because the order were placed before payment processing... In OnepageController.php saveOrderAction method i can see

$this->getOnepage()->getQuote()->save();
    /**
     * when there is redirect to third party, we don't want to save order yet.
     * we will save the order in return action.
     */
    if (isset($redirectUrl)) {
        $result['redirect'] = $redirectUrl;
    }

What does it mean? It is exactly what i want "Don't want to save order yet....", unfortunatly few rows before...

$this->getOnepage()->saveOrder();

$redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();

And the order were already placed....

I hate editing core file, but i've tried to comment the line above, but an exception shows me that order information are used inside paypal module itself (Standard.php file method getStandardCheckoutFormFields). So i can't modify core file easily.... What am I missing?

Thanks a lot and excuse me for my bad english.

2

2 Answers

0
votes

You can use for this purpose PayPal express checkout. It works the way you want.

0
votes

I'm dealing with exactly same problem as you were.

For now i'm thinking of rewriting onePage Model and saveOrder action in my module. What Im thinking of is to remove part where session is cleared and make an event to observer after receive payment method response. No idea if it'll work but well.