Results 1 to 10 of 84

Hybrid View

  1. #1
    Join Date
    Jul 2009
    Posts
    495
    Plugin Contributions
    0

    Default Re: Adding Field to Checkout

    Quote Originally Posted by Absolute View Post
    There are a couple of ways you can achieve this. Firstly, do you offer frequent buyer discount? If so, the best thing to do is to create a new order_total module, which checks the card validity, and if valid, gives a discount. But thats another topic, related, but different.

    Ok, so adding the fields to the checkout.

    BACKUP EVERYTHING BEFORE EDITTING ANY OF THESE FILES

    Firstly, you need to decide which page you are going to add the field to. If its the shipping page, then edit includes/templates/YOUR ACTIVE TEMPLATE/templates/tpl_checkout_shipping_default.php . If its the payment page, then edit tpl_checkout_payment_default.php in the same folder. Here you just need to add the field.

    The field needs to be as follows:
    <?php echo zen_draw_input_field('frequent_code'); ?>

    Next is the difficult bit.

    Firstly, you need to add a new column to the orders database table. Use phpmyadmin, and navigate to the table. Add a new column called order_frequent_code.

    Next, alter the order.php class file, found in includes/classes/order.php
    There are a fair number of bits to add, but bare with me:

    Line 43, add order_frequent_code, to the sql statement.

    Line 114, before 'ip_address' insert the following line:
    'frequent_code' => $order->fields['order_frequent_code'],

    Line 343, before 'ip_address' insert the following line:
    'frequent_code' => $_SESSION['frequent_code'],

    Line 587, before 'ip_address', insert the following line:
    'order_frequent_code' => $this->info['frequent_code'],

    Ok, nearly there. So far, we've added the field to the template, added the column to the database, and editted the order class to record the value. We now need to get the input and pass it to the order class.


    All you need to do now is work out how to display the extra information where you need it. If you want it on the orders page in the admin, then you will need to edit admin/orders.php as a starter.

    Good luck and hope it helps

    Absolute
    PS - I have used this before, but just to let you know its not a direct copy and paste, so I may have missed a ';' or two. If you have any issues, let me know
    hey there, right iv copied the steps up to the end of "order class"
    the box i required is now showing on the "checkout_payment" page
    but it is not showing on the order confirmation.....how do i get this data to be sent to me via the email....


    also, how do i make it so that this field HAS to be filled to complete the order?
    i may not know how yet, but i soon will....i hope :)

  2. #2
    Join Date
    Jul 2009
    Posts
    495
    Plugin Contributions
    0

    Default Re: Adding Field to Checkout

    ok well iv set it up exactly as mentioned, but i still cant seem to get it to show on the order confirmation page or the email


    PLEASE HELP MEEEEE!!!
    i may not know how yet, but i soon will....i hope :)

 

 

Similar Threads

  1. v151 Adding custom field during checkout
    By hues in forum General Questions
    Replies: 1
    Last Post: 9 Nov 2012, 10:39 PM
  2. Adding Field to Checkout
    By earlygrayte in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 17 Feb 2012, 03:00 PM
  3. Adding select field to checkout
    By ETbyrne in forum Managing Customers and Orders
    Replies: 1
    Last Post: 22 Aug 2008, 02:34 AM
  4. adding a field to checkout and db
    By StevenB in forum General Questions
    Replies: 0
    Last Post: 20 May 2007, 12:57 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