Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17
  1. #11
    Join Date
    Feb 2019
    Location
    Melbourne Australia
    Posts
    42
    Plugin Contributions
    0

    Default Re: nab_transact payment module has php error when installing to fresh install of zen

    Thank you LAT9 for your answer.

    I don't have a proper PHP file viewer but notepad indicates line 444 should be inside the code shown on the bottom of this post. Now, so far, I've been updating the file to fix errors caused by going from php5.6 to PHP7.
    So far I changed
    function nab_transact_hpp(
    to
    function __construct(

    and
    global $$order_totals[$i]['code'];
    to
    global ${$order_totals[$i]['code']};

    which fixed warnings and errors, thanks to the help of users above. Since this module worked in zencart versions 1.5.6, using PHP5.6 I'm assuming there's either something in zencart 1.5.7 or changes in php7 that is causing this following sections of code to misbehave now. I've recently had a new geotrust SSL certificate installed on my web site but since the NAB servers has processed the payment and returned to my site I'm assuming its not a SSL issue.
    Unfortunately I have no real PHP knowledge. Can anyone quickly glance through the following code and see why the error is occurring, in particular why a string should now be getting written to a variable that only accepts integers? More importantly how I should rewrite it to fix it.





    /**
    * This function is called after the order has been created
    *
    * @param int $order_id
    */
    function after_order_create($order_id) {
    global $order, $amount_paid;

    $customer_ip = $_SESSION['customer_ip'];
    //Write the payment specific values to the order history
    if ($_SERVER['REMOTE_ADDR'] != $customer_ip || empty($customer_ip)){
    $order_status = $order->info['order_status'];
    $payment_status = 'NOT PAID/PARTIALLY PAID';
    //If the full amount has been paid update the order status
    //otherwise leave the status as it is
    if (round((float)$order->info['total'],2) == round((float)$amount_paid, 2)) {
    if (MODULE_PAYMENT_NAB_TRANSACT_HPP_ORDER_STATUS_ID > 0) {
    $order_status = MODULE_PAYMENT_NAB_TRANSACT_HPP_ORDER_STATUS_ID;
    }
    $payment_status = 'PAID IN FULL';
    }
    $sql_data_array = array(
    'orders_id' => $order_id,
    'orders_status_id' => $order_status,
    'date_added' => 'now()',
    'customer_notified' => 0,
    'comments' =>
    '***'.MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_HEADING.'***'.chr(10).
    MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_STATUS.': '.$payment_status.' ('.strtoupper($this->in_test_mode() ? MODULE_PAYMENT_NAB_TRANSACT_CONST_TEST : MODULE_PAYMENT_NAB_TRANSACT_CONST_LIVE).' PAYMENT)'.chr(10).
    MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_AMOUNT.': '.$amount_paid.chr(10).
    MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_CARD.': '.urldecode($_GET[MODULE_PAYMENT_NAB_TRANSACT_QS_PARAM_NAME_CARD_TYPE]).chr(10).
    MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_TXN_REF.'#: '.$_SESSION['nt_hpp_payment_reference'].':'.urldecode($_GET[MODULE_PAYMENT_NAB_TRANSACT_QS_PARAM_NAME_REF_NUM]).chr(10).
    MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_BANK_REF.'#: '.urldecode($_GET[MODULE_PAYMENT_NAB_TRANSACT_QS_PARAM_NAME_BANK_REF]).chr(10)
    );
    zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
    //unregister the session variables
    unset($_SESSION['nt_hpp_payment_reference']);
    unset($_SESSION['customer_ip']);
    } else {
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . MODULE_PAYMENT_NAB_TRANSACT_ERR_UNAUTH_CHECKOUT_CALL, 'NONSSL'));
    }
    return true;
    }


    function after_process() {
    global $insert_id, $db;
    }
    Last edited by p1drobert2; 27 Sep 2020 at 01:56 AM.

  2. #12
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: nab_transact payment module has php error when installing to fresh install of zen

    Quote Originally Posted by p1drobert2 View Post
    I don't have a proper PHP file viewer but notepad ...
    Stop everything and install one of:
    - Visual Studio Code
    - Notepad++

    or another from this list:
    https://docs.zen-cart.com/user/first.../useful_tools/

    There's no reason not to install a suitable text editor. It'll make your life way easier.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #13
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,489
    Plugin Contributions
    88

    Default Re: nab_transact payment module has php error when installing to fresh install of zen

    Quote Originally Posted by p1drobert2 View Post
    Thank you LAT9 for your answer.

    I don't have a proper PHP file viewer but notepad indicates line 444 should be inside the code shown on the bottom of this post. Now, so far, I've been updating the file to fix errors caused by going from php5.6 to PHP7.
    So far I changed
    function nab_transact_hpp(
    to
    function __construct(

    and
    global $$order_totals[$i]['code'];
    to
    global ${$order_totals[$i]['code']};

    which fixed warnings and errors, thanks to the help of users above. Since this module worked in zencart versions 1.5.6, using PHP5.6 I'm assuming there's either something in zencart 1.5.7 or changes in php7 that is causing this following sections of code to misbehave now. I've recently had a new geotrust SSL certificate installed on my web site but since the NAB servers has processed the payment and returned to my site I'm assuming its not a SSL issue.
    Unfortunately I have no real PHP knowledge. Can anyone quickly glance through the following code and see why the error is occurring, in particular why a string should now be getting written to a variable that only accepts integers? More importantly how I should rewrite it to fix it.





    /**
    * This function is called after the order has been created
    *
    * @param int $order_id
    */
    function after_order_create($order_id) {
    global $order, $amount_paid;

    $customer_ip = $_SESSION['customer_ip'];
    //Write the payment specific values to the order history
    if ($_SERVER['REMOTE_ADDR'] != $customer_ip || empty($customer_ip)){
    $order_status = $order->info['order_status'];
    $payment_status = 'NOT PAID/PARTIALLY PAID';
    //If the full amount has been paid update the order status
    //otherwise leave the status as it is
    if (round((float)$order->info['total'],2) == round((float)$amount_paid, 2)) {
    if (MODULE_PAYMENT_NAB_TRANSACT_HPP_ORDER_STATUS_ID > 0) {
    $order_status = MODULE_PAYMENT_NAB_TRANSACT_HPP_ORDER_STATUS_ID;
    }
    $payment_status = 'PAID IN FULL';
    }
    $sql_data_array = array(
    'orders_id' => $order_id,
    'orders_status_id' => $order_status,
    'date_added' => 'now()',
    'customer_notified' => 0,
    'comments' =>
    '***'.MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_HEADING.'***'.chr(10).
    MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_STATUS.': '.$payment_status.' ('.strtoupper($this->in_test_mode() ? MODULE_PAYMENT_NAB_TRANSACT_CONST_TEST : MODULE_PAYMENT_NAB_TRANSACT_CONST_LIVE).' PAYMENT)'.chr(10).
    MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_AMOUNT.': '.$amount_paid.chr(10).
    MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_CARD.': '.urldecode($_GET[MODULE_PAYMENT_NAB_TRANSACT_QS_PARAM_NAME_CARD_TYPE]).chr(10).
    MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_TXN_REF.'#: '.$_SESSION['nt_hpp_payment_reference'].':'.urldecode($_GET[MODULE_PAYMENT_NAB_TRANSACT_QS_PARAM_NAME_REF_NUM]).chr(10).
    MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_BANK_REF.'#: '.urldecode($_GET[MODULE_PAYMENT_NAB_TRANSACT_QS_PARAM_NAME_BANK_REF]).chr(10)
    );
    zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
    //unregister the session variables
    unset($_SESSION['nt_hpp_payment_reference']);
    unset($_SESSION['customer_ip']);
    } else {
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . MODULE_PAYMENT_NAB_TRANSACT_ERR_UNAUTH_CHECKOUT_CALL, 'NONSSL'));
    }
    return true;
    }


    function after_process() {
    global $insert_id, $db;
    }
    Ah, that's due to a zc157-introduced bug whose correction is identified here: https://www.zen-cart.com/showthread....37#post1371437.

    You should really review and apply all those zc157 bugfixes (https://www.zen-cart.com/showthread....v1-5-7-series) to be sure that your site's on a solid footing.

  4. #14
    Join Date
    Feb 2019
    Location
    Melbourne Australia
    Posts
    42
    Plugin Contributions
    0

    Default Re: nab_transact payment module has php error when installing to fresh install of zen

    Quote Originally Posted by lat9 View Post
    Ah, that's due to a zc157-introduced bug whose correction is identified here: https://www.zen-cart.com/showthread....37#post1371437.

    You should really review and apply all those zc157 bugfixes (https://www.zen-cart.com/showthread....v1-5-7-series) to be sure that your site's on a solid footing.

    Allaluya!!!! Thank you very much Lat9, I can finally get my shopping cart back on line weeks after I got hacked.
    Now all I need to worry about are hackers.
    I didn't realize there was a section for bug fixes. I always assumed that any bug fix would immediately go into the latest version ready for download. Will have to log into this forum more regularly I think.

  5. #15
    Join Date
    Feb 2019
    Location
    Melbourne Australia
    Posts
    42
    Plugin Contributions
    0

    Default Re: nab_transact payment module has php error when installing to fresh install of zen

    Quote Originally Posted by DrByte View Post
    Stop everything and install one of:
    - Visual Studio Code
    - Notepad++

    or another from this list:
    https://docs.zen-cart.com/user/first.../useful_tools/

    There's no reason not to install a suitable text editor. It'll make your life way easier.
    Thank you Drbyte. I've downloaded NOTEPAD++, very nice improvement over notepad.

  6. #16
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,151
    Plugin Contributions
    11

    Default Re: nab_transact payment module has php error when installing to fresh install of zen

    Quote Originally Posted by p1drobert2 View Post
    I didn't realize there was a section for bug fixes. I always assumed that any bug fix would immediately go into the latest version ready for download. Will have to log into this forum more regularly I think.
    When you check out the fixes thread, be sure to subscribe (under Thread Tools). Then it will notify you of any new posts.

  7. #17
    Join Date
    Feb 2019
    Location
    Melbourne Australia
    Posts
    42
    Plugin Contributions
    0

    Default Re: nab_transact payment module has php error when installing to fresh install of zen

    Quote Originally Posted by dbltoe View Post
    When you check out the fixes thread, be sure to subscribe (under Thread Tools). Then it will notify you of any new posts.
    thank you. I did not notice that before. Good tip.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Fresh Install: There was a security error when trying to login
    By nuance9 in forum Installing on a Linux/Unix Server
    Replies: 31
    Last Post: 17 Jul 2011, 04:37 AM
  2. Fresh Live install of ZenCart with fatal error
    By arpeggio in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 2 Apr 2007, 05:23 AM
  3. Error When Installing Fresh Zencart
    By zfraz in forum Installing on a Linux/Unix Server
    Replies: 12
    Last Post: 5 Oct 2006, 12:50 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