Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,401
    Plugin Contributions
    87

    Default Payment method messages not reset in tpl_checkout_success_default.php

    If a payment method (like authorizenet_aim) sets a value into the session variable 'payment_method_messages', those messages are displayed on the checkout success page. If a message was set by one payment method and the customer, during the same session, chose to create another order using a different payment method then those same messages would be displayed to the customer at the conclusion of the second order ... since the session variable is never reset.

    Current code fragment in tpl_checkout_success_default.php:
    Code:
    <!-- bof payment-method-alerts -->
    <?php
    if (isset($_SESSION['payment_method_messages']) && $_SESSION['payment_method_messages'] != '') {
    ?>
      <div class="content">
      <?php echo $_SESSION['payment_method_messages']; ?>
      </div>
    <?php
    }
    ?>
    <!-- eof payment-method-alerts -->
    Proposed addition in red:
    Code:
    <!-- bof payment-method-alerts -->
    <?php
    if (isset($_SESSION['payment_method_messages']) && $_SESSION['payment_method_messages'] != '') {
    ?>
      <div class="content">
      <?php echo $_SESSION['payment_method_messages']; ?>
      </div>
    <?php
      unset($_SESSION['payment_method_messages']);
    }
    ?>
    <!-- eof payment-method-alerts -->

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

    Default Re: Payment method messages not reset in tpl_checkout_success_default.php

    Good catch of a rare scenario.

    As far as fixing, rather than add more business logic to the template, it's probably better to change it like this:

    - add to the header_php file:
    Code:
    $additional_payment_messages = '';
    if (isset($_SESSION['payment_method_messages']) && $_SESSION['payment_method_messages'] != '') {
      $additional_payment_messages = $_SESSION['payment_method_messages'];
      unset($_SESSION['payment_method_messages']);
    }
    - edit the template file:
    Code:
    <!-- bof payment-method-alerts -->
    <?php
    if (isset($additional_payment_messages) && $additional_payment_messages != '') {
    ?>
      <div class="content">
      <?php echo $additional_payment_messages; ?>
      </div>
    <?php
    }
    ?>
    <!-- eof payment-method-alerts -->
    .

    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. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,401
    Plugin Contributions
    87

    Default Re: Payment method messages not reset in tpl_checkout_success_default.php

    Thanks, DrByte, I was just being lazy in my proposed fix.

 

 

Similar Threads

  1. Replies: 1
    Last Post: 11 Jul 2014, 01:35 PM
  2. v139b what loads tpl_checkout_success_default.php
    By nullx8 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 28 Aug 2012, 09:42 PM
  3. Replies: 5
    Last Post: 2 Jun 2008, 10:38 AM
  4. tpl_checkout_success_default.php File Location?
    By ClixCustCare in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 18 Apr 2007, 03:44 AM
  5. Error for the payment method dirbank.php
    By skilaq in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 29 Mar 2007, 12:41 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