Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,586
    Plugin Contributions
    30

    Default using the payment module function get_error

    While investigating this, I see it is used only by /pages/checkout_payment/header_php.php,
    for example
    In the header:
    PHP Code:
    if (isset($_GET['payment_error']) && is_object(${$_GET['payment_error']}) && ($error = ${$_GET['payment_error']}->get_error())) {  $messageStack->add('checkout_payment'$error['error'], 'error');} 
    In the payment module:
    PHP Code:
      function get_error() {
     
    $error = array(
    'title' => MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_ERROR
    'error' => stripslashes(urldecode($_GET['error'])));
    return 
    $error;

    I am assuming this is a way to show a relevant error message to the user when an (offsite?) payment fails and they are redirected back to the checkout_payment page by the gateway.

    I cannot get this to work, I assume that the url should have something like:
    ?payment_error=the_module_name&error=message
    but this just goes to page not found.

    I find no mention of this anywhere so can someone please explain how to use it.
    thanks
    Steve
    Last edited by torvista; 22 Feb 2016 at 10:45 PM. Reason: low energy lightbulb/brain warmed up
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  2. #2
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: using the payment module function get_error

    So here's how I see it working, first of all there needs to be a main_page= which the prefix to that is typically the question mark as it is the first parameter following the page (index.php), then somewhere as a parameter whether first, last or indifferent, is a value x such as parameter_error=x where $x is a variable/object in the define of the code up to that point. Also on that url is a parameter error of value y such that error=y.

    If the above parameter list is "correct" then it would seem as if the main_page= part was missing. Of course all necessary information would have to be present to make it up to and including the line provided above from the checkout_payment header file plus whatever other validation is needed to continue processing on, whether posted data, other parameters on the uri, etc...

    That's my take on it anyways without too much other "magic" happening outside of that.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,586
    Plugin Contributions
    30

    Default Re: using the payment module function get_error

    It works as expected.
    Using
    www.shop.com/index.php?main_page=checkout_payment&payment_error=payment_module_name&error=PAY MENT DENIED
    you get the text "PAYMENT DENIED" in a red block under the breadcrumb.

    The bit I missed was in the payment module:
    function get_error() {
    $error = array('title' => 'REDSYS ERROR',
    'error' => stripslashes(urldecode($_GET['error'])));
    return $error;
    }
    I didn't initially spot the change of the default return "false" to the array name.

    Obviously this function can be further modified to return language-specific and error-specific messages.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

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

    Default Re: using the payment module function get_error

    The get_error() function is rapidly being deprecated in favour of simply doing direct $messageStack->addSession() calls from within the payment module instead.

    There are presently no plans to retain it moving forward past the v1.5.x series.
    .

    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.

 

 

Similar Threads

  1. v138a How can i have two languages using the sermepa payment module?
    By zand in forum Addon Payment Modules
    Replies: 1
    Last Post: 13 Jun 2012, 11:56 PM
  2. Undefined function get_error()
    By pdprenty in forum General Questions
    Replies: 5
    Last Post: 29 Aug 2007, 06:58 AM
  3. which is the best payment module for US payments using v 1.3 ?
    By metamp in forum Built-in Shipping and Payment Modules
    Replies: 12
    Last Post: 18 Apr 2007, 09:54 AM

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