Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2012
    Posts
    407
    Plugin Contributions
    0

    Default Undefined index payment

    Received the following error when changing the billing address on the payment method selection page:
    [21-Sep-2021 11:31:01 America/New_York] PHP Notice: Undefined index: payment in .../includes/modules/checkout_new_address.php on line 181
    Normal checkout until reaching the payment method selection page. Clicked "Change Address" button. Selected one of the address book entries and clicked the "Continue" button. PHP notice appeared. The payment method had not yet been selected. Relevant code lines 177-185 follow:
    Code:
          case 'billto':
          $reset_payment = false;
          if ($_SESSION['billto']) {
            if ($_SESSION['billto'] != $_POST['address']) {
              if ($_SESSION['payment']) {
                $reset_payment = true;
              }
            }
          }
    I think $_SESSION['payment'] needs a test to see if it's set. I'm working to get set up on GitHub and will submit a PR when I'm set up.
    Dave
    zc157c, PHP 7.3.x, standard checkout

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,669
    Plugin Contributions
    9

    Default Re: Undefined index payment

    apparently i ran across that same issue.

    if you are running php7.0, you can use the ?? operator (which i did):

    PHP Code:
    if ($_SESSION['payment'] ?? false) { 
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    Jul 2012
    Posts
    16,719
    Plugin Contributions
    17

    Default Re: Undefined index payment

    Quote Originally Posted by Dave224 View Post
    Received the following error when changing the billing address on the payment method selection page:

    Normal checkout until reaching the payment method selection page. Clicked "Change Address" button. Selected one of the address book entries and clicked the "Continue" button. PHP notice appeared. The payment method had not yet been selected. Relevant code lines 177-185 follow:
    Code:
          case 'billto':
          $reset_payment = false;
          if ($_SESSION['billto']) {
            if ($_SESSION['billto'] != $_POST['address']) {
              if ($_SESSION['payment']) {
                $reset_payment = true;
              }
            }
          }
    I think $_SESSION['payment'] needs a test to see if it's set. I'm working to get set up on GitHub and will submit a PR when I'm set up.
    Dave
    zc157c, PHP 7.3.x, standard checkout
    Quote Originally Posted by carlwhat View Post
    apparently i ran across that same issue.

    if you are running php7.0, you can use the ?? operator (which i did):

    PHP Code:
    if ($_SESSION['payment'] ?? false) { 
    Note that since ZC 1.5.7 is expected to "support" PHP 5.6, a solution functional pre PHP 7.0 should be suggested for a change to 1.5.7 (in the PR). ZC 1.5.8 is a different animal. :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Jun 2012
    Posts
    407
    Plugin Contributions
    0

    Default Re: Undefined index payment

    Note that since ZC 1.5.7 is expected to "support" PHP 5.6, a solution functional pre PHP 7.0 should be suggested for a change to 1.5.7 (in the PR). ZC 1.5.8 is a different animal. :)
    I'm going with:
    Code:
    if (isset($_SESSION['payment'])) {
    Dave

 

 

Similar Threads

  1. Undefined Index: Telephone
    By Webskipper in forum Upgrading to 1.5.x
    Replies: 9
    Last Post: 12 Jul 2021, 05:32 PM
  2. v157 tax_rate undefined index
    By Dave224 in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 4
    Last Post: 22 May 2021, 07:36 PM
  3. v157 PHP Notice: Undefined index
    By yueli7 in forum Upgrading to 1.5.x
    Replies: 1
    Last Post: 24 Jul 2020, 06:56 PM
  4. v155 Undefined index: shipping in classes/order.php
    By torvista in forum Bug Reports
    Replies: 3
    Last Post: 11 Sep 2017, 04:09 PM
  5. Replies: 0
    Last Post: 2 Feb 2014, 03:12 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