0

I have purchase order set as the only active payment method. Checkout throws the "requested method not available" error. I want to force set the payment method when it doesn't have a method set.

I'd like to do this in the theme, not the core.

0

You will need to update code, of course do not modify core files directly.

This is the base file: core/Mage/Checkout/controllers/OnepageController.php

This is the function that sets the payment method: function savePaymentAction()

Change this line:

$data = $this->getRequest()->getPost('payment', array());

To something like this:

$data = array('method'=>'purchase_order');

You will need to check whether the name 'purchase_order' is correct.

If you are trying to skip the payment section then you can put the code earlier in the process, making sure to save the data: $result = $this->getOnepage()->savePayment($data);

| improve this answer | |
  • I modified OnepageController.php to see if it worked. It did not. It threw the error prior to the order review, instead of after, and it didn't submit the order. Thoughts? – whakawaehere Mar 2 '16 at 18:47
  • Did you check whether 'purchase_order' is the correct name? Inspect the page for something like: <input id="p_method_cashondelivery" value="cashondelivery" type="radio" name="payment[method]" title="Cash On Delivery" onclick="payment.switchMethod('cashondelivery')" autocomplete="off"> Here the name would be 'cashondelivery' – William Oakley Mar 3 '16 at 9:25
  • I did check - purchaseorder (no underscore separator) is the correct method name. Using purchaseorder, it still throws the "not available" error. – whakawaehere Mar 3 '16 at 16:00
  • Does this option come up in the checkout? Can you select in manually and progress? Could you link to the site? – William Oakley Mar 3 '16 at 16:03
  • Purchase order option does come up in checkout. And processes the order. It is submitted, as pending, correctly and shows in admin. However, rather than a success message, it shows "method not available error" triggered in /core/Mage/Payment/Model/Info.php – whakawaehere Mar 3 '16 at 16:13
0

I found and ended up using the answer from this post: The requested Payment Method is not available to "remind" the checkout process that the payment method is purchaseorder. This allowed the order to proceed, generate notification emails, and redirect to the success page.

NOTE: I used this as a temporary fix. I will be moving a copy of the site to a dev server, and finding the actual issue and resolving it without modifying the core files.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.