Magento Forum

   
Check out error on custom payment module
 
felo
Jr. Member
 
Total Posts:  25
Joined:  2010-11-10
Durham, NC
 

I am in the process of creating a custom payment module based on the original PayPal module.
The module works offsite (meaning that the customer is redirected to an external site and then returns to Magento with the success/failure notice).
At the time the module is working fine until the customer comes back to my Magento and then I get a fatal error saying:
Fatal error: Call to a member function getMethodInstance() on a non-object in C:\xampp\htdocs\plaza2\app\code\core\Mage\Payment\Model\Observer.php on line 46

I have followed down the problem until I found that once I load the order with the ID that is returned from the merchant, it has no payment module asocieted with it.

I believe that the problem might be at the moment the onepage checkout saves the payment method to the order but I can’t find out why....

I can upload the code of my module if anyone is willing to help me out here.

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

You are right, it looks as though the payment method was not saved properly.  Possible sources

1.  the payment was not assigned to the quote model. You can easily check this in the table sales_flat_quote_payment

2.  the payment method is declared in /etc/config.xml and adminhtml.xml, make sure the payment method is iterated in Mage_Checkout_Block_Onepage_Payment_Methods. You can easily check this using Firefox/Firebug in the checkout payment step, look for the hidden input under the <dt> tag, you should see the name of your payment method in the value attribute

3.  look at the table sales_flat_order_payment, the column method should registered the name of your payment method, which is likely to be missing

HTH

 
Magento Community Magento Community
Magento Community
Magento Community
 
felo
Jr. Member
 
Total Posts:  25
Joined:  2010-11-10
Durham, NC
 

Thanks kiatng.

Lucky for me I found the problem layed in the order Id returned by the merchant. Hence the order was never propperly loaded and obviously wouldn’t find the payment method.

Cheers.

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

Hi,

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 doing 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 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