Cancelled Paypal orders not showing in Magento admin -


i have configured magento 1.9 community store , orders payment made through paypal or other payment methods (like cash on delivery), showing in backend.

however, when checkout selecting paypal gateway, cancel order on paypal page , return website - order not showing in admin. isn't supposed show cancelled order.

since store migrated shopify, had manually create 100 orders , change dates in database manually. can reason unexpected behaviour?

edit 1: no order info displayed in grid if paypal window closed instead of clicking in cancel many answers suggesting.

this obvious because when (as customer) cancel order in paypal payment page automatically destroys (unset) order , order quote before redirecting shop - not confused famous: cancelled order name suggests shown actual orders have been done , cancelled.

depending on paypal method using can treated differently.

in standard paypal can find in controller:

\magento\app\code\core\mage\paypal\controllers\standardcontroller.php

when cancel order, cancelaction(), first cancels order:

    public function cancelaction() {     $session = mage::getsingleton('checkout/session');     $session->setquoteid($session->getpaypalstandardquoteid(true));     if ($session->getlastrealorderid()) {         $order = mage::getmodel('sales/order')->loadbyincrementid($session->getlastrealorderid());         if ($order->getid()) {             $order->cancel()->save();         }         mage::helper('paypal/checkout')->restorequote();     }     $this->_redirect('checkout/cart'); } 

and redirectaction() unset quote before redirecting cart page:

    public function redirectaction() {     $session = mage::getsingleton('checkout/session');     $session->setpaypalstandardquoteid($session->getquoteid());     $this->getresponse()->setbody($this->getlayout()->createblock('paypal/standard_redirect')->tohtml());     $session->unsquoteid();     $session->unsredirecturl(); } 

on other hand in paypal express, cancel operation triggered in controller:

\app\code\core\mage\paypal\controller\express\abstract.php

    public function cancelaction() {     try {         $this->_inittoken(false);         // todo verify if logic of order cancelation deprecated         // if there order - cancel         $orderid = $this->_getcheckoutsession()->getlastorderid();         $order = ($orderid) ? mage::getmodel('sales/order')->load($orderid) : false;         if ($order && $order->getid() && $order->getquoteid() == $this->_getcheckoutsession()->getquoteid()) {             $order->cancel()->save();             $this->_getcheckoutsession()                 ->unslastquoteid()                 ->unslastsuccessquoteid()                 ->unslastorderid()                 ->unslastrealorderid()                 ->addsuccess($this->__('express checkout , order have been canceled.'))             ;         } else {             $this->_getcheckoutsession()->addsuccess($this->__('express checkout has been canceled.'));         }     } catch (mage_core_exception $e) {         $this->_getcheckoutsession()->adderror($e->getmessage());     } catch (exception $e) {         $this->_getcheckoutsession()->adderror($this->__('unable cancel express checkout.'));         mage::logexception($e);     }      $this->_redirect('checkout/cart'); } 

where unset in same place.

so in case if need keep quote (which suppose have been exploiting in custom module) have change behavior of paypal module.

please remember if going not modify original core files, instead extend these classes in custom module , apply changes there.


Comments