Page 5 of 5 FirstFirst ... 345
Results 41 to 46 of 46
  1. #41
    Join Date
    Mar 2006
    Posts
    4
    Plugin Contributions
    0

    Default Re: Purchase order module

    Quote Originally Posted by WaterSlide View Post
    First off, thanks to those who have posted code changes (HTML_POST_VARS to _POST, flakrats suggestion for changing the Order.php email section). I just spent 6 hours with these two old modules on a Zencart v1.3.9d install.

    They are both too old to try and install right onto a newer version of Zencart - replacing core files may seem to work at first, but you may find that they will not show the Account Name, Account Number, or PO Number - they won't even save in the database. Just don't bother.

    If you have a good text file comparison tool like Beyond Compare, you can quickly look at what this module is trying to do compared to the new way that Zencart works. You will also see that replacing core files will not work. From here you must edit the NEWER zencart files so that they will perform as desired, only copying that which is necessary for the Purchase Order Module. All of the other non-core files may simply be copied over.

    I'm not a real good PHP programmer, but I'll go ahead and post the file changes under Knuckle's version - it may be a starting point for some of you, at the very least the three bits of data, Account Name, Account Number, and PO Number save and the emails work so it is still useful.
    I just installed the latest Purchase Order Module and it works well....

    .... however if you use a PO longer than 12 Characters the SQL has a fit and errors out. The easy fix was to increase the size of the po_number field in the orders table (via MySqlAdmin) but you may want to edit the SQL patch to match whatever the code says is acceptable in terms of field length :-)

  2. #42
    Join Date
    Mar 2006
    Posts
    4
    Plugin Contributions
    0

    Default Re: Purchase order module

    Quote Originally Posted by otaraia View Post
    I just installed the latest Purchase Order Module and it works well....

    .... however if you use a PO longer than 12 Characters the SQL has a fit and errors out. The easy fix was to increase the size of the po_number field in the orders table (via MySqlAdmin) but you may want to edit the SQL patch to match whatever the code says is acceptable in terms of field length :-)
    I just made the following change to the po.php located in includes.modules.payment to limit the max PO Size to 14 Characters and not to check for an Account Number :-

    // class methods
    function javascript_validation() {
    $validation_string = 'if (payment_value == "' . $this->code . '") {' . "\n" .
    ' var account_name = document.checkout_payment.account_name.value;' . "\n" .
    ' var account_number = document.checkout_payment.account_number.value;' . "\n" .
    ' var po_number = document.checkout_payment.po_number.value;' . "\n" .
    ' if (account_name.length == 0) {' . "\n" .
    ' error_message = error_message + "' . MODULE_PAYMENT_PO_TEXT_JS_ACC_NAME . ' ";' . "\n" .
    ' error = 1;' . "\n" .
    ' }' . "\n" .
    ' if (po_number.length == 0) {' . "\n" .
    ' error_message = error_message + "' . MODULE_PAYMENT_PO_TEXT_JS_PO_NUMBER . '";' . "\n" .
    ' error = 1;' . "\n" .
    ' }' . "\n" .
    ' if (po_number.length >= 15) {' . "\n" .
    ' error_message = error_message + "' . MODULE_PAYMENT_PO_TEXT_JS_PO_NUMBER_MAX . '";' . "\n" .
    ' error = 1;' . "\n" .
    ' }' . "\n" .
    '}' . "\n";
    return $validation_string;
    }

    And then in includes.languages.english.modules.payment po.php I added a new line to describe the "Exceeds 14 Characters"

    /*
    $Id: po.php,v 1.2 2002/11/27 12:00:00 olby Exp $

    osCommerce, Open Source E-Commerce Solutions
    http://www.oscommerce.com

    Copyright (c) 2002 osCommerce

    Released under the GNU General Public License
    */

    define('MODULE_PAYMENT_PO_TEXT_TITLE', 'Purchase Order');
    define('MODULE_PAYMENT_PO_TEXT_DESCRIPTION', 'Will you accept Purchase Order?');
    define('MODULE_PAYMENT_PO_TEXT_ACCOUNT_NAME', 'Account name:');
    define('MODULE_PAYMENT_PO_TEXT_ACCOUNT_NUMBER', 'Account number:');
    define('MODULE_PAYMENT_PO_TEXT_PO_NUMBER', 'Purchase Order Nr:');
    define('MODULE_PAYMENT_PO_TEXT_EMAIL_FOOTER', 'with the following information:');
    define('MODULE_PAYMENT_PO_TEXT_JS_ACC_NAME', 'You forgot to enter the account name (Company).');
    define('MODULE_PAYMENT_PO_TEXT_JS_ACC_NUMBER', 'You forgot to enter the your Account Number.');
    define('MODULE_PAYMENT_PO_TEXT_JS_PO_NUMBER', 'You forgot to enter your Purchase Order number.');
    define('MODULE_PAYMENT_PO_TEXT_JS_PO_NUMBER_MAX', 'Your PO Number Exceeds 14 Characters.');
    ?>
    Last edited by otaraia; 17 Aug 2011 at 06:15 AM. Reason: more detail

  3. #43
    Join Date
    Jul 2011
    Posts
    23
    Plugin Contributions
    0

    Default Re: Purchase order module

    I just installed this module to give it a shot and it works perfectly. My only issue is that when the email is sent through it doesn't include the Account Number and I actually do need that.

    I've searched through the code and it all seems fine and I can't figure out why it doesn't populate it in the email. I haven't changed anything from the files that were included with the module.

    Any hints or ideas of where I should look next are very appreciated

    EDIT: actually the only thing I've changed is add an ID to the input fields to add css styling. Other than that nothing has been changed.

    Code:
    function selection() {
    
          $selection = array('id' => $this->code,
                             'module' => $this->title,
                             'fields' => array(array('title' => MODULE_PAYMENT_PO_TEXT_ACCOUNT_NAME,
                                                     'field' => zen_draw_input_field('account_name' , '' , 'id="poCompanyName"')),
                                               array('title' => MODULE_PAYMENT_PO_TEXT_ACCOUNT_NUMBER,
                                                     'field' => zen_draw_input_field('account_number' , '' , 'id="poAccountNumber"')),
                                               array('title' => MODULE_PAYMENT_PO_TEXT_PO_NUMBER,
                                                     'field' => zen_draw_input_field('po_number' , '' , 'id="poPurchaseOrderNumber"'))));

  4. #44
    Join Date
    Jul 2011
    Posts
    23
    Plugin Contributions
    0

    Default Re: Purchase order module

    Nevermind guys I found the issue. Under the order.php file (\includes\classes\order.php) the account number was nixed for some reason.

    Original Code
    PHP Code:
    $email_order .= ($GLOBALS[$payment_class]->email_footer) ? $GLOBALS[$payment_class]->email_footer "\n" "Account: " $this->info['account_name'] . "\n"  "PO #: " $this->info['po_number'] . "\n\n" ''
    PHP Code:
    if ($GLOBALS[$payment_class]->title == 'Purchase Order') {
    $html_msg['PAYMENT_METHOD_FOOTER'] = (is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->email_footer "<br>" "Account: " $this->info['account_name'] . "<br>" "PO #: " $this->info['po_number'] : ''); 
    My code
    PHP Code:
    $email_order .= ($GLOBALS[$payment_class]->email_footer) ? $GLOBALS[$payment_class]->email_footer "\n" "Company Name: " $this->info['account_name'] . "\n" "Account Number: " $this->info['account_number'] . "\n" "PO #: " $this->info['po_number'] . "\n\n" ''
    PHP Code:
    if ($GLOBALS[$payment_class]->title == 'Purchase Order') {
    $html_msg['PAYMENT_METHOD_FOOTER'] = (is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->email_footer "<br>" "Company Name: " $this->info['account_name'] . "<br>" "Account Number: "$this->info['account_number'] . "<br>" "PO #: " $this->info['po_number'] : ''); 
    I changed the "Account:" to "Company Name:" because it makes more sense for me. I also changed it under the defining PHP files so it would make more sense for our clients.

    I can't believe I didn't see it two hours ago when I went over the damn code. Thanks anyway guys!

  5. #45
    Join Date
    Jan 2006
    Posts
    13
    Plugin Contributions
    0

    Default Re: Purchase order module

    any word if someone is rewriting this for 1.5? I think there are a lot of folks left hanging...

  6. #46
    Join Date
    May 2005
    Location
    Pennsylvania
    Posts
    38
    Plugin Contributions
    1

    Default Re: Purchase order module

    I just created a working Purchase Order Module for Zen-Cart
    http://www.zen-cart.com/forum/showth...22#post1095622
    My modules: Purchase Order Basic
    Mike

 

 
Page 5 of 5 FirstFirst ... 345

Similar Threads

  1. Purchase Module - Purchase Order Payment Module Problem
    By keewong in forum Addon Payment Modules
    Replies: 15
    Last Post: 14 Dec 2010, 12:19 AM
  2. Replies: 0
    Last Post: 23 Jan 2009, 09:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR