Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Purchase Order (PO) Payment Module Question


PCGUY

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.

Link to comment
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.

Link to comment
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.

Link to comment
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.

Link to comment
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.

Link to comment
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.

Link to comment
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!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...