Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Posts
    15
    Plugin Contributions
    0

    Default Getting Customer Name & Email Via PHP

    Can someone tell me how to access a customer's name and email address via PHP on the checkout success page? I can't seem to figure it out.... I've tried:


    echo $account->fields['customers_lastname'];

    -and-

    echo $account->fields['customers_email_address'];


    But these are obviously wrong. I've looked around in the code for another way / place they are stored, but can't find it.

    Any help would be appreciated. Thanks........
    Andrew

    Right Channel Radios
    http://www.RightChannelRadios.com

  2. #2
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Getting Customer Name & Email Via PHP

    Why ?
    .

    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
    Feb 2008
    Posts
    15
    Plugin Contributions
    0

    Default Re: Getting Customer Name & Email Via PHP

    Because after a customer finishes a purchase, I'd like to offer the option to enroll in an a follow-up service email list. I'd like to be able to populate the name and email fields automatically so that the customer doesn't need to re-type them in.
    Andrew

    Right Channel Radios
    http://www.RightChannelRadios.com

  4. #4
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Getting Customer Name & Email Via PHP

    You'll have to manually re-query the data from the database, as it's not extracted for that page's output since it's not normally used there.

    /includes/modules/pages/checkout_success/header_php.php

    Insert the following at the end of the file, before the closing ?>
    Code:
    $sql = "SELECT customers_firstname, customers_lastname, customers_email_address FROM   " . TABLE_CUSTOMERS . "
                      WHERE  customers_id = :customersID:";
    
    $sql = $db->bindVars($sql, ':customersID:', $_SESSION['customer_id'], 'integer');
    $cust = $db->Execute($sql);
    Then in your template file, you can reference the info like this:
    $cust->fields['customers_firstname']
    $cust->fields['customers_lastname']
    $cust->fields['customers_email_address']
    .

    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.

  5. #5
    Join Date
    Feb 2008
    Posts
    15
    Plugin Contributions
    0

    Default Re: Getting Customer Name & Email Via PHP

    Fantastic! That was exactly what I needed. Thank you.......
    Andrew

    Right Channel Radios
    http://www.RightChannelRadios.com

 

 

Similar Threads

  1. Mail via PHP gives email error
    By moenanie in forum General Questions
    Replies: 7
    Last Post: 29 Aug 2011, 09:40 PM
  2. Getting the language name with PHP
    By Sacauntos in forum Addon Sideboxes
    Replies: 0
    Last Post: 12 Apr 2011, 04:30 PM
  3. reinstall php via yum, now getting this error in zencart
    By bangsters in forum General Questions
    Replies: 1
    Last Post: 31 Aug 2009, 03:52 AM

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