Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 2 of 5
Shopping cart empty after canceling external payment provider (like paypal)
 
benjib98
Jr. Member
 
Total Posts:  12
Joined:  2010-06-03
 

I just upgraded from 1.4.0.1 to 1.4.1.1 today and it breaks all the redirected payment methods. I have tried the above solution, but the cart is still being emptied. I have also set
protected $_shouldInactivateQuote = false;
but without a joy. I have payment methods like PayPal, where the payments are completed on a hosted payment form after which the customer is redirected back to the Magento webshop for finishing the order, but the cart is always empty. Any news on this issue?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Nijhof Internet Media
Member
 
Avatar
Total Posts:  32
Joined:  2008-07-04
Netherlands
 

benjib98, PM me your current app/code/core/Mage/Checkout/controllers/OnepageController.php file, then I’ll have a look.
Make sure to undo the other changes because that will not work.

 
Magento Community Magento Community
Magento Community
Magento Community
 
soisita
Jr. Member
 
Avatar
Total Posts:  18
Joined:  2009-11-17
 

Hi all,

Same issue for me, with 1.4.1.1, Ogone payment and official ogone extension, but http://www.magentocommerce.com/boards/viewthread/199053/#t258536 didn’t help :-(

In addition to the described scenario, my cart is emptied as soon as I get on the PSP redirection page, meaning :
- checkout page : cart ok
- proceed -> go to redirection page
- back (browser action) : empty cart

exactly same as if I performed the process til the payment page and cancelled the transaction.

Had a cookie time problem (expiration time was 1 hour before current time whereas my server time is ok - Paris Time- and magento time zone was set to Romance Standard Time / Europe/Paris), so in order to be sure my payment problems were not due to that, I changed the lifetime to 1 day (not good, but for testing, it is ok)

Just wondering if the problem comes from magento or from the psp…

If anyone has THE solution… grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
Nick Rigby
Member
 
Total Posts:  57
Joined:  2007-09-03
 

This fox doesn’t work for version 1.4.1.0, and I’m presuming this is because there were quite a few changes for the upgrade to 1.4.1.1. Has anyone managed to fix this for 1.4.1.0?

Cheers,
Nick.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Track 23
Member
 
Total Posts:  50
Joined:  2008-03-19
 

I ran into this problem when testing Google Checkout on Magento 1.4.1.1. I implemented the fix described above by Nijhof and it seems to work only if you click \’Edit Order\’ or some other \"return to site\” button in Google because the redirect value exists, but if I just click the back button in my browser then the redirect value is missing and the cart is emptied. Any more ideas?

Thanks to Nijhof and others for all your efforts thus far.

Edit: It sounds like soisita found the same issue.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MarieK
Jr. Member
 
Total Posts:  2
Joined:  2010-10-01
 

Hello,

has anyone fixed the problem for google checkout? I tried it the whole day, to fix it, but it still doesn’t work.

For Paypal it works, but in case of Google Checkout canceling, the cart is empty :(

Thanks for every help…

Marie

 
Magento Community Magento Community
Magento Community
Magento Community
 
fresh
Jr. Member
 
Total Posts:  7
Joined:  2010-03-25
 

Hi everyone, still no solution for this? I’m running 1.4.1.1 and I’m using Paypal (IPN) for Checkout. I have also this problem, that the cart ist empty when canceling the order in Paypal. Thanks for any solutions about it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
fresh
Jr. Member
 
Total Posts:  7
Joined:  2010-03-25
 

Hi everyone, still no solution for this? I’m running 1.4.1.1 and I’m using Paypal (IPN) for Checkout. I have the same problem, that the cart is empty when canceling the order in Paypal. But the order will be submited correctly although the payment is not done! This is very confusing to the costumer!

Thanks for any solutions about it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
soisita
Jr. Member
 
Avatar
Total Posts:  18
Joined:  2009-11-17
 

Hi again,

It is very strange there is no more reply : many of the magento websites running ogone official extension I’ve checked have the same behaviour…

To me, it is a bug and not a weakness:
It happens many times customers come to cart, then to payment page, and before filling in their credit card number, want to check the cart again to be sure it is ok.
So when they come back through cancellation or by hitting back button, if the cart is empty, it is pretty sure these customers will not go back to products pages and add to cart again -> Lost customers :-(

Seems Ogone official extension has been developped by Varien
Shall we wait for a magento release ? an ogone extension release ? a patch ?

Up then wink

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
aronchi
Member
 
Avatar
Total Posts:  49
Joined:  2009-05-20
Reggio Emilia - Italy
 

Hi all,
this is how I solved the problem on Magento v 1.4.1.1, maybe it can be of some interest for some of you.

I created a Mymodule under Mypackage in order to override the submitOrder method in Mage_Sales_Model_Service_Quote.
Here is the class containing overridden method:

class Mypackage_Mymodule_Model_Service_Quote extends Mage_Sales_Model_Service_Quote
{
    
public function submitOrder()
    
{
        $order 
parent::submitOrder();
        
        
// Prevent the cart to be emptied before payment response 
        
$this->_quote->setIsActive(true);
        
        return 
$order;
    
}
}

Don’t forget to declare the override in Mymodule config.xml file in the following way:

...
<global>
...
<
models>
  <
mymodule>
    <
sales>
      <
rewrite>
        <
service_quote>Mypackage_Mymodule_Model_Service_Quote</service_quote>
      </
rewrite>
    </
sales>
  </
mymodule>
</
models>
...
</global>
...

Best regards, Alessandro

 
Magento Community Magento Community
Magento Community
Magento Community
 
Track 23
Member
 
Total Posts:  50
Joined:  2008-03-19
 

Alessandro,

Is that different from this similar fix that’s already been tried?

 
Magento Community Magento Community
Magento Community
Magento Community
 
aronchi
Member
 
Avatar
Total Posts:  49
Joined:  2009-05-20
Reggio Emilia - Italy
 

@Track23 Hi, yes it is basically the same solution applied without touching the core.
Regards, Alessandro

 
Magento Community Magento Community
Magento Community
Magento Community
 
lakirarodricks
Jr. Member
 
Total Posts:  7
Joined:  2010-10-28
 

Update to version 1.4.1.1 is fixed for me. I use the PayPal module and the Dutch PSP (multisafepay) and in both cases, when the transaction is canceled cart is not empty. So for me this is solved 1.4.1.1

 
Magento Community Magento Community
Magento Community
Magento Community
 
fresh
Jr. Member
 
Total Posts:  7
Joined:  2010-03-25
 

Hi everyone, thanks very much. This fixed it for us. But the problem is now, that if the user cancel in PayPal, the order will still be processed in magento. So the cart stays full but the order is processed and the customer gets the confirmation mail. But the order is in this case not payed!! This is very confused for the customer? Is there any solution for this?

Thanks very much
Dan

 
Magento Community Magento Community
Magento Community
Magento Community
 
soisita
Jr. Member
 
Avatar
Total Posts:  18
Joined:  2009-11-17
 

Hi all,

It sounds like I’ve found a work-around to solve the issue of empty cart using Ogone official extension…

Juste as a reminder, I had 2 problems with the shopping cart (and seems many of magento users with that extension have the same) :

The scenario is about a customer going to the payment page, then coming back to the site without having paid (for example to be sure his cart contains the good products) :

The 1st problem was with the cancel button on ogone page, & the 2nd one was with the “back” button of the browser.
In both cases, the shopping cart was empty.

- checkout page : cart ok
- proceed -> go to redirection page
- back (browser action) or cancel payment button : empty cart :-(

I found the 1st solution thanks to Boutik Circus post ( http://www.magentocommerce.com/boards/viewthread/205132/ )

The problem is that the cart is emptied as soon as we click on “checkout” button
So we have to repopulate the cart before redirecting to it…

vim ./app/code/core/Mage/Ogone/controllers/ApiController.php

add just before

$this->_redirect('checkout/cart');

in _processDirectSale, _processAuthorize, declineAction, cancelAction, _cancelOrder functions

####################################
    $session Mage::getSingleton('checkout/session');
    
$cart Mage::getSingleton('checkout/cart');

    
$items $order->getItemsCollection();
    foreach (
$items as $item{
      
try {
          $cart
->addOrderItem($item,$item->getQty());
      
}
      
catch (Mage_Core_Exception $e){
        
if (Mage::getSingleton('checkout/session')->getUseNotice(true)) {
            Mage
::getSingleton('checkout/session')->addNotice($e->getMessage());
        
}
        
else {
            Mage
::getSingleton('checkout/session')->addError($e->getMessage());
        
}
      }
      
catch (Exception $e{
        Mage
::getSingleton('checkout/session')->addException($e,
            
Mage::helper('checkout')->__('Cannot add the item to shopping cart.')
        );
      
}
    }

    $cart
->save();
####################################

This will solve the problem for cancel button issue

Then for the back button issue:

my first intention was to get rid off with the noItems.phtml template (choosen in the chooseTemplate function), but this solution is not correct as we go back to noItems.phtml template even if the payment is ok
so we keep the noItems.phtml template, and proceed to tests within on ogone status:
- being on the noItems template while ogone status is pending means payment hasn’t been processed, thus, we repopulate the cart with the code we used in the controller and redirect in javascript (may be we could do it in the chooseTemplate function, but this works) to cart.phtml
- if ogone status is “processed” or other, we display congrats or error messages…

thus, here is my code for app/design/frontend/default/[YOUR_TEMPLATE]/template/checkout/cart/noItems.phtml

<?php
$order 
Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
$status $order->getStatus();

switch(
$status){
        
case Mage_Ogone_Model_Api::PENDING_OGONE_STATUS :
        case 
Mage_Ogone_Model_Api::CANCEL_OGONE_STATUS :
                
$session Mage::getSingleton('checkout/session');
                
$cart Mage::getSingleton('checkout/cart');

                
$items $order->getItemsCollection();
                foreach (
$items as $item{
                  
try {
                    $cart
->addOrderItem($item,$item->getQty());
                  
}
                  
catch (Mage_Core_Exception $e){
                    
if (Mage::getSingleton('checkout/session')->getUseNotice(true)) {
                      Mage
::getSingleton('checkout/session')->addNotice($e->getMessage());
                    
}
                    
else {
                      Mage
::getSingleton('checkout/session')->addError($e->getMessage());
                    
}
                  }
                  
catch (Exception $e{
                    Mage
::getSingleton('checkout/session')->addException($e,Mage::helper('checkout')->__('Cannot add the item to shopping cart.'));
                  
}
                }

                $cart
->save();
?>
<div class="page-title">
    <
h1><?php echo $this->__('Redirection to Cart'?></h1>
</
div>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<p><?php echo $this->__('You will be redirected to your cart in a few seconds'?></p>
<
p><?php echo $this->__('Click <a href="%s">here</a> to continue shopping.'$this->getContinueShoppingUrl()) ?></p>

<
script>[removed].reload()</script>

<?php
                
break;
        case 
Mage_Ogone_Model_Api::PROCESSED_OGONE_STATUS :
        case 
Mage_Ogone_Model_Api::PROCESSING_OGONE_STATUS :
        case 
Mage_Ogone_Model_Api::WAITING_AUTHORIZATION :
?>
<div class="page-title">
    <
h1><?php echo $this->__('Transaction ok'?></h1>
</
div>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<p><?php echo $this->__('Thank you for your purchase'?></p>
<
p><?php echo $this->__('Click <a href="%s">here</a> to continue shopping.'$this->getContinueShoppingUrl()) ?></p>

<?php
                
break;
        case 
Mage_Ogone_Model_Api::DECLINE_OGONE_STATUS:
?>
<div class="page-title">
    <
h1><?php echo $this->__('Transaction declined'?></h1>
</
div>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<p><?php echo $this->__('It seems there has been a problem with your transaction'?></p>
<
p><?php echo $this->__('Click <a href="%s">here</a> to continue shopping.'$this->getContinueShoppingUrl()) ?></p>


<?php
                
break;
        case 
Mage_Ogone_Model_Api::OGONE_AUTH_UKNKOWN_STATUS:
        case 
Mage_Ogone_Model_Api::OGONE_PAYMENT_UNCERTAIN_STATUS:
?>
<div class="page-title">
    <
h1><?php echo $this->__('Technical problem'?></h1>
</
div>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<p><?php echo $this->__('It seems there has been a technical problem with our payment service provider'?></p>
<
p><?php echo $this->__('Click <a href="%s">here</a> to continue shopping.'$this->getContinueShoppingUrl()) ?></p>


<?php

                
break;
        default:
?>
<div class="page-title">
    <
h1><?php echo $this->__('Shopping Cart is Empty'?></h1>
</
div>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<p><?php echo $this->__('You have no items in your shopping cart.'?></p>
<
p><?php echo $this->__('Click <a href="%s">here</a> to continue shopping.'$this->getContinueShoppingUrl()) ?></p>

<?php

                
break;
}

?>

Just BE AWARE that the [removed] tag (due to the forum editor) has to be replaced with “window . l o c a t i o n .” (without any spaces wink )

Hope this helps

Best

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 5