Results 1 to 6 of 6
  1. #1

    Default How to override header_php.php or how to add a new field to order confirmation email

    This is really a smaller part of a bigger question. I have another threat about adding a field to a payment module http://zen-cart.com/forum/showthread.php?t=85766

    I have successfully added the field, made it required and validated it (its format, not its actual existance). It also passes to the confirmation page and displays, but it doesn't get included in the Order Confirmation Email. So far my efforts to get this in the email have been futile, but now I am looking to edit the header_php.php file in the checkout_confirmation page to set the value of the accountNum that is passed into the page to a SESSION variable that can be referenced in the order.php class file.

    I am not sure how to override this file though. It's original path is
    includes\modules\pages\checkout_confirmation

    I have tried using
    includes\modules\MYTEMPLATE\pages\checkout_confirmation
    includes\modules\pages\MYTEMPLATE\checkout_confirmation
    includes\modules\pages\checkout_confirmation\MYTEMPLATE

    but it doesn't read the new file. Can you override these files, or do you need to edit them directly? If you can't override them, my guess is that I don't need to edit the file to get the custom field passed into the Order Confirmation email in the first place.

    If that is the case, if someone could point me in the right direction to get that info passed to the email I would appreciate it. I figured it was all contained in the payment module itself, but I haven't been able to get it to work out of there so far.
    Of course I went mad with power. Have you ever tried going mad without power? It's boring. No one listens to you.

  2. #2
    Join Date
    May 2006
    Posts
    31
    Plugin Contributions
    0

    Default Re: How to override header_php.php or how to add a new field to order confirmation em

    The override works like this for the file

    /includes/templates/YOUR_TEMPLATE/checkout_confirmation/header_php.php

  3. #3

    Default Re: How to override header_php.php or how to add a new field to order confirmation em

    Thanks for that tip. Is this necessary to add a field to the email? I am going to try it, but I am not sure if I am on the right path or not.
    Of course I went mad with power. Have you ever tried going mad without power? It's boring. No one listens to you.

  4. #4

    Default Re: How to override header_php.php or how to add a new field to order confirmation em

    Thanks for that tip. Is this necessary to add a field to the email? I am going to try it, but I am not sure if I am on the right path or not.

    Quote Originally Posted by yapliren View Post
    The override works like this for the file

    /includes/templates/YOUR_TEMPLATE/checkout_confirmation/header_php.php
    That doesn't seem to be working either...
    Of course I went mad with power. Have you ever tried going mad without power? It's boring. No one listens to you.

  5. #5

    Default Re: How to override header_php.php or how to add a new field to order confirmation em

    Thanks for that tip. Is this necessary to add a field to the email? I am going to try it, but I am not sure if I am on the right path or not.
    Of course I went mad with power. Have you ever tried going mad without power? It's boring. No one listens to you.

  6. #6

    Default Re: How to override header_php.php or how to add a new field to order confirmation em

    Ok, I got the new field sent in the email. Here are the steps I took. Feedback is appreciated on if I am leaving anything out or if I am doing something "wrong". Also, I didn't override the order.php class file. I backed up the original and overwrote the file. Can you override this file?


    In the Payment Module file I added/edited the following code:

    PHP Code:
        function process_button() {
        
    $process_button_string zen_draw_hidden_field('accountNum'$_POST['accountNum']);
          return 
    $process_button_string;
        } 
    and

    PHP Code:
        function before_process() {
            global 
    $order;
            
    $order->info['accountNum'] = $_POST['accountNum'];
        } 
    and

    PHP Code:
        function confirmation() {
        
        
    $confirmation = array('id' => $this->code,
                       
    'module' => $this->title,
                       
    'fields' => array(array('title' => MODULE_PAYMENT_ACCOUNTHOLDER_ACCOUNTNUMBER_TITLE,
                                               
    'field' => ': ' $_POST['accountNum'])           
                           ));
        
            
        return 
    $confirmation;
        } 
    and

    PHP Code:
        function selection() {
        global 
    $order;
                
    $selection = array('id' => $this->code,
                       
    'module' => $this->title,
                       
    'fields' => array(array('title' => MODULE_PAYMENT_ACCOUNTHOLDER_ACCOUNTNUMBER_TITLE,
                                               
    'field' => zen_draw_input_field('accountNum''''id="accountNum"' $onFocus))

                                            
                           ));
        
        
          return 
    $selection;
        } 

    In the order.php class file I added:

    PHP Code:
        //addresses area: Billing **** CODE ADDED IN THIS SECTION ****
    ...
         
    //ADD THE ACCOUNT NUMBER IF IT EXISTS
        
    if ($this->info['accountNum'])
        
    $email_order .= $this->info['accountNum'] . "\n\n";
    ... 
    and

    PHP Code:
        $this->info = array('currency' => $order->fields['currency'],
                            
    'currency_value' => $order->fields['currency_value'],
                            
    'payment_method' => $order->fields['payment_method'],
                            
    'payment_module_code' => $order->fields['payment_module_code'],
                            
    'shipping_method' => $order->fields['shipping_method'],
                            
    'shipping_module_code' => $order->fields['shipping_module_code'],
                            
    'coupon_code' => $order->fields['coupon_code'],
            
    /*added this line */    'accountNum' => $order->fields['accountNum'],
                            
    'cc_type' => $order->fields['cc_type'],
                            
    'cc_owner' => $order->fields['cc_owner'],
                            
    'cc_number' => $order->fields['cc_number'],
                            
    'cc_expires' => $order->fields['cc_expires'],
                            
    'date_purchased' => $order->fields['date_purchased'],
                            
    'orders_status' => $order_status->fields['orders_status_name'],
                            
    'last_modified' => $order->fields['last_modified'],
                            
    'total' => $order->fields['order_total'],
                            
    'tax' => $order->fields['order_tax'],
                            
    'ip_address' => $order->fields['ip_address']
                            ); 
    Of course I went mad with power. Have you ever tried going mad without power? It's boring. No one listens to you.

 

 

Similar Threads

  1. How to add a field to the Confirmation Email?
    By kbradley in forum General Questions
    Replies: 4
    Last Post: 19 May 2010, 03:08 AM
  2. How did you hear about us field in Order Confirmation Email
    By zepher in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 23 Mar 2010, 02:47 PM
  3. How to add content to order confirmation email?
    By Ralf Skirr in forum Templates, Stylesheets, Page Layout
    Replies: 12
    Last Post: 3 Dec 2009, 10:37 AM
  4. how to override includes > modules > pages > page_folder > header_php.php
    By monkeytown in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 1 Feb 2008, 05:45 PM
  5. Help regarding how to add telephone field to order confirmation
    By signus in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 4 Sep 2007, 07:47 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