Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sign in to follow this  
PCGUY

Purchase Order (PO) Payment Module Question

Recommended Posts

I currently have this mod running on an internal warehouse shopping website for a company.

 

http://addons.oscommerce.com/info/5710

 

I installed this mod since we use PO's to pay for everything. A PO is the only payment option I have available, but due to the way this mod is written there is no way to set that a PO number is required! We are having visitors make orders and leaving the PO number box blank on accident.

 

How can I make it stop a visitor from checking out without something filled in the PO box? :huh:

 

Thanks.

Share this post


Link to post
Share on other sites
I currently have this mod running on an internal warehouse shopping website for a company.

 

http://addons.oscommerce.com/info/5710

 

I installed this mod since we use PO's to pay for everything. A PO is the only payment option I have available, but due to the way this mod is written there is no way to set that a PO number is required! We are having visitors make orders and leaving the PO number box blank on accident.

 

How can I make it stop a visitor from checking out without something filled in the PO box? :huh:

 

Thanks.

 

Find this in catalog/includes/modules/payment/po.php

 

    function before_process() {
     global $HTTP_POST_VARS, $order;

 

Add this directly after

      $error = '';
     if (strlen($_POST['po_owner']) < 1) {
       $error = 'Please enter a valid Company Name';
    } elseif(strlen($_POST['po_number']) < 1){
       $error = 'Please enter a valid Purchase Order Number';
     }

     if ($error != '') {
       $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error);
       tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
     }

 

I'll set it up with language file support and upload it to the contributions in the morning. I'll also add the cronjob that reminds people to send a hardcopy.

Share this post


Link to post
Share on other sites

Thank you very much for the help!

 

I am still having a small issue however. It seems that it does indeed not let someone checkout when they have not filled out the PO number, however it seems that the error message never pops up anywhere, it just reloads the page. I am not sure how the error message was intended to show, but I suggest making it a javascript alert to match the rest of the character length check errors in oscommerce.

Share this post


Link to post
Share on other sites
Thank you very much for the help!

 

I am still having a small issue however. It seems that it does indeed not let someone checkout when they have not filled out the PO number, however it seems that the error message never pops up anywhere, it just reloads the page. I am not sure how the error message was intended to show, but I suggest making it a javascript alert to match the rest of the character length check errors in oscommerce.

 

It should bring you back to the page where you select your payment method (checkout_payment.php) - and the message shows at the top of the page like all the other payment modules.

Share this post


Link to post
Share on other sites

Humm, maybe this is not working for me since I have the Simple Template System installed? Any idea on how to make it compatible? I have looked through your code and I see where the error message is called for, and where it is in the language file, but I do not understand how it is displayed.

Share this post


Link to post
Share on other sites
Humm, maybe this is not working for me since I have the Simple Template System installed? Any idea on how to make it compatible? I have looked through your code and I see where the error message is called for, and where it is in the language file, but I do not understand how it is displayed.

 

It may be because of STS - I am unfamiliar with that contribution. Do payment errors work on any payment modules for you? If so, you should see how they are displayed with the the module.

 

This module uses the stock oscommerce way of displaying the error with this code:

      if ($error != '') {
       $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error);
       tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
     }

 

It redirects the user to the page where you select the payment options, and displays the error text at the top of the page.

Share this post


Link to post
Share on other sites

Ah, apparently none of my payment modules will product errors. I installed something that makes it skip past the Payment Options screen and just puts the place for the PO number on the confirmation page, and this apparently will not produce any error messages now that I have done that.

 

Thanks for your help!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×