Magento Forum

   
Magento Payu error
 
snehas
Jr. Member
 
Total Posts:  6
Joined:  2013-01-01
 

Hi all,

We are using pay u for our magento site,
after installing pay u when user redirects to pay u site and click on browser back button without dong payment magento shows error like

“Fatal error: Call to a member function getMethodInstance() on a non-object in /app/code/core/Mage/Payment/Model/Observer.php on line 46”
but order is already placed with status as ‘processing’ and after clicking on back button it goes to checkout page showing products in shopping cart. That menas order is placed and shopping cart is not empty.
After resolving that issue of observer.php
like replaced function
public function salesOrderBeforeSave($observer)
{
$order = $observer->getEvent()->getOrder();
if ($order->getPayment()->getMethodInstance()->getCode() != ‘free’) {
return $this;
}
if ($order->canUnhold()) {
return $this;
}

if ($order->isCanceled() || $order->getState() === Mage_Sales_Model_Order::STATE_CLOSED) {
return $this;
}

if (!$order->hasForcedCanCreditmemo()) {
$order->setForcedCanCreditmemo(true);
}
with :
public function salesOrderBeforeSave($observer)
{
$order = $observer->getEvent()->getOrder();
if($order->getPayment())
{
if ($order->getPayment()->getMethodInstance()->getCode() != ‘free’) {
return $this;
}
}
if ($order->canUnhold()) {
return $this;
}

if ($order->isCanceled() || $order->getState() === Mage_Sales_Model_Order::STATE_CLOSED) {
return $this;
}
/**
* Allow forced creditmemo just in case if it wasn’t defined before
*/
if (!$order->hasForcedCanCreditmemo()) {
$order->setForcedCanCreditmemo(true);
}
return $this;
}

magento places order twice once with ‘processing’ status and one empty order. Kindly help with this.

Thanks & Regards, Sneha

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top