Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Apr 2010
    Posts
    39
    Plugin Contributions
    0

    Default Custom Field in database and backend but not in emails

    I have a few custom fields added to our customer account section that they provide when they create their account. The information they enter does find it's way into the correct database fields and is displayed in the admin section, however, it is not passed through in the email confirmations either when an account is created or when an order is placed by the customer.

    How do I pass the custom field info along in the emails?

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Custom Field in database and backend but not in emails

    You'll have to edit the code that builds the email content so that it includes the data you wish to add to it. The order.php class and your custom create_account.php module are key places to start with that.
    .

    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
    Apr 2010
    Posts
    39
    Plugin Contributions
    0

    Default Re: Custom Field in database and backend but not in emails

    Thanks for the fast response. Yes I've been in there for a while but cannot for the life of me get it to follow though to the email. I used your suggestions for a different thread but I couldn't get it working.

    I think it might be because rather than put the fields in the $this->info = array(); a new one was created for the custom fields called $this->customer_extra_info = array();

    This has been added around line 241

    function get_customer_extra_info() {
    global $db;
    $customer_extra_info_query = "select customers_fax, customers_taxid, customers_lmnum
    from " . TABLE_CUSTOMERS . "
    where customers_id = '" . (int) $this->customer['id'] . "'";

    $customer_extra_info = $db->Execute($customer_extra_info_query);

    $this->customer_extra_info = array('fax' => $customer_extra_info->fields['customers_fax'],
    'taxid' => $customer_extra_info->fields['customers_taxid'],
    'lmnum' => $customer_extra_info->fields['customers_lmnum']);
    }


    And in the Order Confirmation emails (for example) the following was added to pull the info in the Office Only section but it doesn't come through:

    // send additional emails
    if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
    $this->get_customer_extra_info();
    $extra_info=email_collect_extra_info('','', $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $this->customer['telephone'], $this->customer_extra_info['fax'], $this->customer_extra_info['taxid'], $this->customer_extra_info['lmnum']);
    $html_msg['EXTRA_INFO'] = $extra_info['HTML'];


    Am I missing something?

  4. #4
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Custom Field in database and backend but not in emails

    If you're trying to stuff the output into the office-use-only section, then you'll need to alter the email_collect_extra_info() function to know what to do with the extra data you're passing to it.
    .

    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
    Apr 2010
    Posts
    39
    Plugin Contributions
    0

    Default Re: Custom Field in database and backend but not in emails

    Yes I did

    $extra_info=email_collect_extra_info('','', $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $this->customer['telephone'], $this->customer_extra_info['fax'], $this->customer_extra_info['taxid'], $this->customer_extra_info['lmnum']);

  6. #6
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Custom Field in database and backend but not in emails

    No, that's passing data TO the function. You haven't updated the function itself to handle the extra parameters you're passing to it. So it's just spitting out the stuff it knows to do, and ignoring your extra parameters.
    .

    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. Replies: 0
    Last Post: 22 Aug 2014, 01:47 AM
  2. Shipping Module Is Working, but Does not Appear in Backend
    By todoonada in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 4 Jun 2014, 10:52 AM
  3. v150 Adding Custom Field to Invoice from Admin (Backend)
    By futurist71 in forum Upgrading to 1.5.x
    Replies: 0
    Last Post: 11 Jul 2012, 10:11 PM
  4. Replies: 4
    Last Post: 19 Jun 2011, 12:08 AM
  5. Replies: 7
    Last Post: 1 May 2007, 10:16 PM

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