If this is your first visit, check our documentation. To post, register or login.
Forums / Managing Customers and Orders / Adding new fields to order process

Adding new fields to order process

Locked

Started by bonheddwr on 14 Jul 2007, 11:37 PM · Views: 3,234

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
14 Jul 2007, 11:37 PM
#1
bonheddwr avatar

bonheddwr

Zen Follower

Join Date:
Jun 2007
Location:
Cymru
Posts:
124
Plugin Contributions:
0

Adding new fields to order process

Is there any way of adding extra fields to the order process? I want to add a box where customers can leave text for a note to go with the order if they are sending it as a gift + I want to add one field asking how the customer found the website i.e. search, promotional email etc.

15 Jul 2007, 3:22 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Adding new fields to order process

Wouldn't that be better added to the Product so that Grandma can get little Tiny Tim a new crutch and his brother Tommy a new skateboard on the same order? :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

15 Jul 2007, 11:13 AM
#3
bonheddwr avatar

bonheddwr

Zen Follower

Join Date:
Jun 2007
Location:
Cymru
Posts:
124
Plugin Contributions:
0

Re: Adding new fields to order process

I see hwat you mean. I tried that at first, but it looked rather confusing. But I would still like t add an extra field to the order process asking how they found the site. I think there is a way of adding extra fields when a customer signs up to the site, but is there any way of adding extra fields to the actual order process?

Cheers.

15 Jul 2007, 1:44 PM
#4
bonheddwr avatar

bonheddwr

Zen Follower

Join Date:
Jun 2007
Location:
Cymru
Posts:
124
Plugin Contributions:
0

Re: Adding new fields to order process

What I want to do is to add 2 new fields to the 1st step of the checkout process - checkout_shipping.html.

It already asks you to confirm the delivery address, Choose Shipping method & put any special instructions in the box, but I'd also like to add a box asking:

"If you want to send your order as a gift, and would like to include a note with the gift, please insert the text and any instructions in the following box."

And a dropdown menu asking:

How did you find our Site?

Search Engine
Other Site
Promotional Email
Word of Mouth
I am a previous Customer

15 Jul 2007, 1:59 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Adding new fields to order process

I would follow the comment throughout all of the checkout_blah files ...

You will find referrences to:
comment
$comments
$_SESSION['comments']

Then in the orders class you would do the same ...

If you do a search on comments in the Developers Tool Kit in the Admin ... Tools ... you should be able to locate all referrences to this and then clone how this is managed ...

NOTE: not all of these references to comment are of value, example:
/includes/modules/payments

But using:
$comments
$_SESSION['comments']

will narrow it down for you better ... and help you locate important files ...

Be aware that many of the references do change as you move through the checkout to things like:
$this->info['comments']
$_POST['comments']

Take your time as you address these files and you can work your way through them all ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

15 Jul 2007, 7:46 PM
#6
bonheddwr avatar

bonheddwr

Zen Follower

Join Date:
Jun 2007
Location:
Cymru
Posts:
124
Plugin Contributions:
0

Re: Adding new fields to order process

Thank you VERY much for that. I am a beginner, and therefore before I make so many changes I would just like to run by you a few things if that's OK? When you talk about cloning, does this mean making a copy of each relevant line within each relevant file, and renaming from 'comments' to 'comments1' for example?

If so, where in the files do I put the copy, immediately after each original line in each original file? If there are a group of lines together in a file, do I clone the whole group, or one line at a time? Sorry, these questions might sound just dumb to you, but for me in Wild West Wales things aren't quite as obvious! :D

The lines or references that I think are relevant after getting rid of the ones you advised are as follows. If anything looks wrong, please let me know. Many Thanks:

[B]/var/www/html/includes/classes/order.php[/B]

Line #341 : 'comments' => (isset($_SESSION['comments']) ? $_SESSION['comments'] : ''),

Line #633 : 'comments' => $this->info['comments']);

Line #897 : //comments area

Line #898 : if ($this->info['comments']) {

Line #899 : $email_order .= zen_db_output($this->info['comments']) . "\n\n";

Line #900 : $html_msg['ORDER_COMMENTS'] = nl2br(zen_db_output($this->info['comments']));

Line #902 : $html_msg['ORDER_COMMENTS'] = '';
 
[B]/var/www/html/includes/languages/cymraeg/checkout_confirmation.php[/B]

Line #20 : define('HEADING_ORDER_COMMENTS', 'Cyfarwyddiadau Arbennig neu sylwadau Archeb');

Line #21 : // no comments entered

Line #22 : define('NO_COMMENTS_TEXT', 'Dim');
 
[B]/var/www/html/includes/languages/cymraeg/checkout_payment.php[/B]

Line #22 : define('TABLE_HEADING_COMMENTS', 'Cyfarwyddiadau arbennig neu Sylwadau Archeb');
 
[B]/var/www/html/includes/languages/cymraeg/checkout_shipping.php[/B]

Line #25 : define('TABLE_HEADING_COMMENTS', 'Cyfarwyddiadau Arbennig neu sylwadau ynglyn a\'ch archeb');
 
[B]/var/www/html/includes/languages/cymraeg/checkout_success.php[/B]

Line #20 : define('TABLE_HEADING_COMMENTS', '');
 
[B]/var/www/html/includes/languages/english/checkout_confirmation.php[/B]

Line #20 : define('HEADING_ORDER_COMMENTS', 'Special Instructions or Order Comments');

Line #21 : // no comments entered

Line #22 : define('NO_COMMENTS_TEXT', 'None');
 
[B]/var/www/html/includes/languages/english/checkout_payment.php[/B]

Line #24 : define('TABLE_HEADING_COMMENTS', 'Special Instructions or Order Comments');
 
[B]/var/www/html/includes/languages/english/checkout_shipping.php[/B]

Line #25 : define('TABLE_HEADING_COMMENTS', 'Special Instructions or Comments About Your Order');
 
[B]/var/www/html/includes/languages/english/checkout_success.php[/B]

Line #20 : define('TABLE_HEADING_COMMENTS', '');

[B]/var/www/html/includes/modules/pages/checkout_confirmation/header_php.php[/B]

Line #44 : $_SESSION['comments'] = zen_db_prepare_input($_POST['comments']);
 
[B]/var/www/html/includes/modules/pages/checkout_payment/header_php.php[/B]

Line #90 : // $_SESSION['comments'] = '';

Line #91 : $comments = $_SESSION['comments'];
 
[B]/var/www/html/includes/modules/pages/checkout_process/header_php.php[/B]

Line #25 : unset($_SESSION['comments']);
 
[B]/var/www/html/includes/modules/pages/checkout_shipping/header_php.php[/B]

Line #122 : if (isset($_SESSION['comments'])) {

Line #123 : $comments = $_SESSION['comments'];

Line #129 : if (zen_not_null($_POST['comments'])) {

Line #130 : $_SESSION['comments'] = zen_db_prepare_input($_POST['comments']);

Line #132 : $comments = $_SESSION['comments'];
 
[B]/var/www/html/includes/templates/classic/templates/tpl_checkout_confirmation_default.php[/B]

Line #87 : // always show comments

Line #88 : // if ($order->info['comments']) {

Line #91 : <h2 id="checkoutConfirmDefaultHeadingComments"><?php echo HEADING_ORDER_COMMENTS; ?></h2>

Line #93 : <div><?php echo (empty($order->info['comments']) ? NO_COMMENTS_TEXT : nl2br(zen_output_string_protected($order->info['comments'])) . zen_draw_hidden_field('comments', $order->info['comments'])); ?></div>
 
[B]/var/www/html/includes/templates/classic/templates/tpl_checkout_payment_default.php[/B]

Line #200 : <legend><?php echo TABLE_HEADING_COMMENTS; ?></legend>

Line #201 : <?php echo zen_draw_textarea_field('comments', '45', '3'); ?>
 
[B]/var/www/html/includes/templates/classic/templates/tpl_checkout_shipping_default.php[/B]

Line #118 : <fieldset class="shipping" id="comments">

Line #119 : <legend><?php echo TABLE_HEADING_COMMENTS; ?></legend>

Line #120 : <?php echo zen_draw_textarea_field('comments', '45', '3'); ?>
 
[B]/var/www/html/includes/templates/template_default/templates/tpl_checkout_confirmation_default.php[/B]

Line #87 : // always show comments

Line #88 : // if ($order->info['comments']) {

Line #91 : <h2 id="checkoutConfirmDefaultHeadingComments"><?php echo HEADING_ORDER_COMMENTS; ?></h2>

Line #93 : <div><?php echo (empty($order->info['comments']) ? NO_COMMENTS_TEXT : nl2br(zen_output_string_protected($order->info['comments'])) . zen_draw_hidden_field('comments', $order->info['comments'])); ?></div>
 
[B]/var/www/html/includes/templates/template_default/templates/tpl_checkout_payment_default.php[/B]

Line #200 : <legend><?php echo TABLE_HEADING_COMMENTS; ?></legend>

Line #201 : <?php echo zen_draw_textarea_field('comments', '45', '3'); ?>
 
[B]/var/www/html/includes/templates/template_default/templates/tpl_checkout_shipping_default.php[/B]

Line #118 : <fieldset class="shipping" id="comments">

Line #119 : <legend><?php echo TABLE_HEADING_COMMENTS; ?></legend>

Line #120 : <?php echo zen_draw_textarea_field('comments', '45', '3'); ?>
16 Jul 2007, 2:07 AM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Adding new fields to order process

If you have not done a lot of work with php ... you may wish to consider the Commercial Help Wanted ...

I would have to write the code for you in order to get this all listed and working ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 Jul 2007, 10:15 PM
#8
bonheddwr avatar

bonheddwr

Zen Follower

Join Date:
Jun 2007
Location:
Cymru
Posts:
124
Plugin Contributions:
0

Re: Adding new fields to order process

Ajeh:

If you have not done a lot of work with php ... you may wish to consider the Commercial Help Wanted ...

I would have to write the code for you in order to get this all listed and working ... :cool:

Thanks Ajeh. I may need to go down that root to be honest, but I'm trying to learn, so maybe that would be the easiest way out! :smartalec:

I thought that many people would want to ask their cutsomers how they found the website. Is there another (easier) way of getting this info?

16 Jul 2007, 10:16 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Adding new fields to order process

There should be an add-on for during the create account to enter this information vs during the check out ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

23 Jul 2007, 1:24 PM
#10
bonheddwr avatar

bonheddwr

Zen Follower

Join Date:
Jun 2007
Location:
Cymru
Posts:
124
Plugin Contributions:
0

Re: Adding new fields to order process

Ajeh:

If you have not done a lot of work with php ... you may wish to consider the Commercial Help Wanted ...

I would have to write the code for you in order to get this all listed and working ... :cool:

I tried this, but no replies whatsoever! :dontgetit For any subscribers to the 'Commercial Help Wanted' section, the thread is: http://www.zen-cart.com/forum/showthread.php?p=407250