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.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
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);
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.