Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2010
    Location
    Milton Keynes, UK
    Posts
    6
    Plugin Contributions
    0

    Default Customising 'order comments' text input box

    Hi,
    I want to customise the 'special instructions or order comments' input box and change it to a multi-field form to collect some specific information from customers as they go through the checkout.

    I already figured out how to simply change the text (in 3 different files) to tell customers what info they need to enter, but it's not really the ideal solution.

    Does anyone know if this can be changed to a form and if so, can you help by pointing me in the right direction?

    Thanks

    Blackmafia

  2. #2
    Join Date
    Sep 2004
    Posts
    1,388
    Plugin Contributions
    4

    Default Re: Customising 'order comments' text input box

    Yes it can, but it's some work. You need to add your form elements alongside the comments box (or replace the the comments box entirely), and then add database fields to store this new information that you're collecting.

    If you found your way through the code to change the label next to the comments field, you're already ahead of the game! Just go back and look at the form alongside that text. Mimic the process to add your own elements.

    Start small, try adding a checkbox next to the textarea. You'll also have a much easier time if you open the source code for the checkout page in question, find the comments input, and then match it to the Zen Cart source.

    Huge question, general answer, I know. But hopefully enough to get started.
    Frank Koehl
    "Cleverly Disguised as a Responsible Adult"

    frankkoehl.com

  3. #3
    Join Date
    Jul 2010
    Location
    Milton Keynes, UK
    Posts
    6
    Plugin Contributions
    0

    Default Re: Customising 'order comments' text input box

    Thanks so much for your reply BlindSide. I didn't really expect any good news, but you've certainly just given me that since now I know that it can be done and how to go about it with the mimicking (don't know why I couldn't think of that myself).

    May I take the liberty of trying to pick your brains concerning adding fields to the database?

    I was looking at the sql code supplied in the install folder to try to identify the table where I would need to add any fields, but unfortunately I couldn't find any clues to any field in any of the tables that looked like it might be used to store customer comments. Maybe that's just me being blinded by the obvious, but I looked it over 2 or 3 times and couldn't see, so my question is, do you know which table I should be dealing with when it comes to adding fields? Not sure if it makes any difference but for the record, I'm using the latest install v1.3.9.d without any add-ons at the moment.

    Kindest regards
    BM

  4. #4
    Join Date
    Sep 2004
    Posts
    1,388
    Plugin Contributions
    4

    Default Re: Customising 'order comments' text input box

    May I take the liberty of trying to pick your brains concerning adding fields to the database?
    Sure
    do you know which table I should be dealing with when it comes to adding fields?
    Well technically speaking, you can add fields to any table you want. However let's look at your intent. You want to collect additional information when people place orders. Assuming that information is order-specific and not product-specific, you'll probably want to add your fields to the `orders` table.

    Alternatively, customer comments are stored as part of the first order status entry in `orders_status_history`, created at the time the order is created. If your data is somehow tied to updating order status, this is another good possibility.

    However you're missing what may be the best option, and that's to simply create your own table from scratch. You don't have to worry about mucking things up when it comes time to upgrade, and you have total freedom to do it however you want. Again, going back to your idea, you would tie your data to the relevant order using the `order_id` (which you would store as a key in your table).

    It's unrelated to your project, but have a look at the Super Orders addon. This is a module I built some time ago (and currently managed by others who were awesome enough to pick it up), utilizing several completely custom tables.

    I don't know how much of a developer you are, but if you're going to do this yourself, you have to think of Zen Cart in less strict terms. It's not a finished building, but a framework that can be modified to suit your needs.
    Frank Koehl
    "Cleverly Disguised as a Responsible Adult"

    frankkoehl.com

  5. #5
    Join Date
    Jul 2010
    Location
    Milton Keynes, UK
    Posts
    6
    Plugin Contributions
    0

    Default Re: Customising 'order comments' text input box

    You've assumed correctly that it's order specific, but it I don't think it needs to be tied to updating the order status. The main thing is having the info sent in the new order notification email and as long as that happens then the info doesn't even need to be saved in the database.

    I did find reference to the customer comments in the database now you mention the correct table. I think I was expecting to find it in a table with a customer_something title.

    I did think maybe a new table would be best, but for some reason I had it in my head that I would have to keep the new fields in the same location as the comments. But it looks like a new table is the way to go then. Must admit it never even occurred to me that upgrades could mess things up.

    Anyway, I think you've probably given me enough of a pointer there for me to go and have a play around now So Thank You very much for your help, it is very much appreciated.

    Btw, I'm not in the developer class. I'm just a poorly paid guy who finds buying the manual and having a go works out more economical than paying top whack for a guru.

  6. #6
    Join Date
    Sep 2004
    Posts
    1,388
    Plugin Contributions
    4

    Default Re: Customising 'order comments' text input box

    Happy to help! As one of those top whack-charging gurus (though I'd hardly consider myself a "guru"), I am always thrilled to see newbies take a shot at it! Most times you can indeed save yourself some money by doing it yourself. If nothing else, you gain a better understanding of the system you work with, which makes you more equipped to layout a project should the time come where you need to hire someone.
    Frank Koehl
    "Cleverly Disguised as a Responsible Adult"

    frankkoehl.com

  7. #7
    Join Date
    Jul 2010
    Location
    Milton Keynes, UK
    Posts
    6
    Plugin Contributions
    0

    Default Re: Customising 'order comments' text input box

    Well I have really surprised myself as I have successfully managed to create the individual form fields and have the entered info pass across from 'checkout_shipping.php' to checkout_payment.php' and then show up on the 'checkout_confirmation.php' page.

    I did create a separate table in the database but then couldn't figure out how I was going to get the info from the form to the database. I decided to expand the 'orders_status_history' table. My thoughts were going along the lines that somewhere amongst all the files, the necessary code was already written to put info into that table and get it out again, so all I would need to do is go through all the files looking for anything to do with 'Comments" and do a bit of a copy and paste operation, editing 'Comments' to put my own field names in.

    I certainly did not find it very easy, and chances are I've not even done it properly, but it works the way it is so I'm happy with that.

    Anyway, I have another problem now which has cost me a new computer and a new window.

    I am really baffled how to get the info sent in the New Order order confirmation email. I have edited the email_template_checkout.html and email_order_status.html files in the emails folder and also in the admin folder I have edited 'invoice.php and orders.php and also admin/includes/languages/english/orders.php and packingslip.php but none of these efforts are getting me anywhere.

    Can anyone help and tell me what I'm missing please?

  8. #8
    Join Date
    Jul 2010
    Location
    Milton Keynes, UK
    Posts
    6
    Plugin Contributions
    0

    Default Re: Customising 'order comments' text input box



    I've done it and it all works!

    But all I have to do now is try to straighten up my form and adjust some of the labels.


    If anyone else needs help let me know and I'll try and give you some instructions. But wait at least a couple of weeks while I get the rest of my store sorted out. (Or messed up )

    And thanks for your help Frank, couldn't have done it without your pointers.

  9. #9
    Join Date
    Sep 2004
    Posts
    1,388
    Plugin Contributions
    4

    Default Re: Customising 'order comments' text input box

    Bravo! All you needed was a push in the right direction.
    Frank Koehl
    "Cleverly Disguised as a Responsible Adult"

    frankkoehl.com

 

 

Similar Threads

  1. Search text input box width (in side box)
    By joshuaholland in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 7 Apr 2010, 01:11 PM
  2. Adding a Text Input Box To an Order total module
    By ladyink in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 30 Aug 2009, 07:44 PM
  3. Default text in Order Comments Text Field?
    By Steven300 in forum General Questions
    Replies: 9
    Last Post: 19 May 2009, 03:19 AM
  4. Multiline input text box?
    By byoriginaldesign in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 7 May 2009, 01:18 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