I recently developed a custom osCommerce Payment Module, and although I have developed payment modules for osCommerce based stores in the past, it was first time that I had to submit the form using the GET method to merchant website for further processing of the order.
The issue got further complicated due to the fact there were multiple payment modules and this could not have been hard coded in the checkout_confirmation.php file function call to draw form using tep_draw_form using get method.
After a bit of work, solution turned out to be very simple. just define a new variable form_method in the constructor class of the payment module underneath the form_action_url variable in the payment module file.
$this->form_action_url = 'https://secure.merchant.website-url/';
// set form method to use, default is post
$this->form_method = 'get';
Now you need one more addition and it’s in the catalog/checkout_confirmation.php file.
Make the following addition in the catalog/checkout_confirmation.phpfile:
Find:
if (isset($$payment->form_action_url)) {
$form_action_url = $$payment->form_action_url;
} else {
$form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
}
Add following:
if (isset($$payment->form_method)) {
$form_method = $$payment->form_method;
} else {
$form_method = 'post';
}
Also make the following change in the same catalog/checkout_confirmation.php
//find this
echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');
//replace it with this
echo tep_draw_form('checkout_confirmation', $form_action_url, $form_method);
This will allow you to submit the form using the method of your choice. osCommerce uses only post method to submit payment information to third party merchants for procesisng, but not every merchant accepts post method for form submission, at least mine did not and which resulted in this blog post.
Hope that helps.
Cheers!
Thanks, that has been helpful!