OSCOMMERCE SUPPORT CALL 702-453-3332

 

Help - Search - Members - Calendar
Full Version: Adding Custom Fields to Customer Details
osCommerce Community Support Forums > osCommerce Online Merchant v2.x > Tips and Tricks
Pages: 1, 2
Rusyn
Adding Custom Fields to Customer Details

So you need to know some extra info about your customers? This tutorial will explain how to add extra text fields to Customer Details. I will be using the example of HEIGHT, but this can be changed to any piece of info you need to know.

You will have to edit the following FIVE files:

catalog/create_account.php
catalog/account_edit.php
catalog/includes/languages/english.php

catalog/admin/customers.php
catalog/admin/includes/languages/english.php


So basically you add fields and commands to write to the database in the files, and add the text label (Height, Weight, etc.) in the language files. You have to do the account_edit so your customers can ... edit their account wink.gif, and in case you want to see/change their info in the Admin, you will have to change stuff in their too.

But first you will need to add a new field to the database in phpMyAdmin. Click on customers, scroll down to the bottom and look for "Add New Field". Add 1 field At End of Table. Enter "height" into the Field name, make sure VARCHAR is selected, and make the Length 3 (this could be any lenth, the default is 32 in oSc, but for my purposes height rarely exceeds 999cms wink.gif) Hit OKAY and you are done!


Now, here we go to the hard part:


1. Open up catalog/includes/languages/english.php

Add your category and your label text. For this example I will be making a category called Sizing, with one entry called Height:

CODE
define('CATEGORY_SIZE', 'Sizing');

CODE
define('ENTRY_CUSTOMER_HEIGHT','Height');


Now, I wanted to put a little centimeters beside the field so people knew what kind of measure ments to put in. So I added another define:

CODE
define('ENTRY_CENTIMETERS_TEXT', 'centimeters');


This can be ANY text you want.

SAVE


2. Open up catalog/create_account.php

What I did here was copy and paste an entire CATEGORY. If you are looking in Dreamweaver, go to around line 500 until you see <?php echo CATEGORY_CONTACT; ?>. Now copy this cell, the one above it (tep_draw_seperator), and the cell below it which contains a table that has telephone and fax info. Then paste these three cells where you want your category to appear.

Select the <?php echo CATEGORY_CONTACT; ?> and change it to <?php echo CATEGORY_SIZE; ?>

Then go one cell down and get rid of the Telephone cells. Select the <?php echo ENTRY_FAX_NUMBER; ?> and change it to <?php echo ENTRY_CUSTOMER_HEIGHT; ?> There is your label done.

The next php block is for drawing the actual form field. Change:

CODE
<?php echo tep_draw_input_field('fax') . '&nbsp;' . (tep_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?>


CODE
<?php echo tep_draw_input_field('height','','maxlength="3"' . 'style="width: 50"') . '&nbsp;' . (tep_not_null(ENTRY_CENTIMETERS_TEXT) ? '<span class="caption">' . ENTRY_CENTIMETERS_TEXT . '</span>': ''); ?>


So now the actual form is done. Notice that I have put a character maxlength and a style width on the field? Adjust these as you wish. Also, notice that our centimeters text is going to fall in there real nice. See the special CSS style I gave the centimeter text so it would look nice?

So that is the table are done, but we are going to have to make two more additions.

We are going to need to make a variable, so insert the following around LINE 45:
CODE
   $height = tep_db_prepare_input($HTTP_POST_VARS['height']);

Next search for
CODE
$sql_data_array = array('customers_firstname' => $firstname,

Add in
CODE
'customers_height' => $height,
somewhere in the array. There are TWO arrays, make sure that this is changed in only the first one.

Now whatever is written in the field will be entered into the database.

SAVE


3.Open up catalog/account_edit.php

Here we are going to pull the same trick as above and copy the "My Details" CATEGORY, then edit it to our needs. On line 185 you will see <?php echo MY_ACCOUNT_TITLE; ?>, so basically copy that cell, the one above and the one below. It is from about LINE 174 to LINE 243 in total. Then paste it in below. Again, delete all the unnecessary blocks except for the fax number. Select the <?php echo ENTRY_FAX_NUMBER; ?> and change it to <?php echo ENTRY_CUSTOMER_HEIGHT; ?>. Label finished, now for the field.

Replace:
CODE
<?php echo tep_draw_input_field('fax', $account['customers_fax']) . '&nbsp;' . (tep_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?>

with
CODE
<?php echo tep_draw_input_field('height', $account ['customers_height'],'maxlength="3"' . 'style="width: 50"') . '&nbsp;' . (tep_not_null(ENTRY_CENTIMETERS_TEXT) ? '<span class="caption">' . ENTRY_CENTIMETERS_TEXT . '</span>': ''); ?>


There is your table done. Notice that the input field is retrieving info from the database?

Now to make it writable. Add in your variable around LINE 30:
CODE
    $height =

tep_db_prepare_input($HTTP_POST_VARS['height']);


Search for
CODE
$sql_data_array = array('customers_firstname' => $firstname,

and add in
CODE
'customers_height' => $height,
somewhere in the array. Make sure to do this only to the TOP one.

Next, search for
CODE
$account_query = tep_db_query

You will have to enter your database field name in here too, so it knows where to look to retrieve the customers data. Here is an example of what MY query looks like:
CODE
$account_query = tep_db_query("select customers_gender, customers_firstname, customers_lastname, customers_dob, customers_email_address, customers_height, customers_telephone, customers_fax from "


All done. Now the customer will be able to view their information in My Account, and update the values if they grow a few cms. wink.gif

SAVE

4. Open up catalog/admin/includes/languages/english.php

Okay, this one is easy. You just do here exactly what you did in step one and add these three chunks:

CODE
define('CATEGORY_SIZE', 'Sizing');

CODE
define('ENTRY_CUSTOMER_HEIGHT','Height');

CODE
define('ENTRY_CENTIMETERS_TEXT', 'centimeters');


SAVE

5. Open up catalog/admin/customers.php

This one gets a little tricky. We are going to copy and paste the Contact CATEGORY, just like what we did to the files over in the catalog. Then rename <?php echo ENTRY_FAX_NUMBER; ?> to <?php echo ENTRY_CUSTOMER_HEIGHT; ?>.

Now, the field is a little tricky. Replace:
CODE
<?php
 if ($processed == true) {
   echo $cInfo->customers_fax . tep_draw_hidden_field('customers_fax');
 } else {
   echo tep_draw_input_field('customers_fax', $cInfo->customers_fax, 'maxlength="32"');
 }
?>


with
CODE
<?php
 if ($processed == true) {
   echo $cInfo->customers_height . tep_draw_hidden_field('customers_height');
 } else {
   echo tep_draw_input_field('customers_height', $cInfo->customers_height, 'maxlength="3"' . 'style="width: 50"');
 }
?>


A little different than what we have done before. Notice the maxlength and the style width.

You will also notice the cInfo, don't worry I don't know what this is for either. Hafta consult a php guy.

One thing we are missing though is the cms after the field. This is simply because I haven't figured out how to get that text in there. Once again, we'll have to consult a PHP guy.

In any case, the table is set up, now we have to do our database stuff again, so insert our variable at around LINE 30
CODE
$customers_height = tep_db_prepare_input($HTTP_POST_VARS[

'customers_height']);


Search for:
CODE
$sql_data_array = array('customers_firstname' => $customers_firstname,


and enter in below:
CODE
'customers_height' => $customers_height,


Remember to do this only on the top sql query.

Find the $customers_query and enter in c.customers_height. Notice the difference from step 3. Here is an example of what MY query looks like:
CODE
$customers_query = tep_db_query("select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, c.customers_height, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_address_id from "


Now we are DONE!!!


SAVE!!!!

Adjust at will, put those 5 files on the server and give it a go. All should be fine.

Good luck!!
WS Evolution
Thanks Rusyn this has been very useful. I have successfully added three new custom fields for a wholesale members only shop. This has probably saved me many hours, searching through the code.

Many thanks, smile.gif
WS Evolution
If you what to add a "text area" this is how to do it.....



In catalog/admin/customers.php



CODE
    <tr>
                      <td class="main"><?php echo CUSTOMER_COMMENTS; ?></td>
                      <td class="main"><?php echo tep_draw_textarea_field('comments', 'soft', 50, 15, $cInfo->comments); ?></td>
 
              </tr>


In catalog/create_account.php


CODE
<tr class="infoBoxContents">

           <td><table border="0" cellspacing="2" cellpadding="2">

             <tr>

               <td class="main"><?php echo CUSTOMER_COMMENTS; ?></td>

               <td class="main"><?php echo  tep_draw_textarea_field('comments', 'soft', 50, 15) . '&nbsp;' . (tep_not_null(CUSTOMER_COMMENTS_TEXT) ? '<span class="inputRequirement"><br>' . CUSTOMER_COMMENTS_TEXT . '</span>': ''); ?></td>

             </tr>

           </table></td>

         </tr>
gal1264
Yeah....this worked out GREAT and is really helpful.
nscmonkey
One note:

QUOTE
Enter "height" into the Field name, make sure VARCHAR is selected, and make the Length 3...

I think this should read:

QUOTE
Enter "customers_height" into the Field name, make sure VARCHAR is selected, and make the Length 3 ...

It's the only way it would work for me.
tcjay
They should add this to the knowledge base because it explains exactly the steps needed to add new fields andcreate forms to edit, retreive and save information in the new fields, to the database.
kittidid
I just added all the above to add a alt phone field. All went fine. Except now when I create an account, add products to cart, checkout.....I am suppose to be taken to the shipping page first, but it skips over it and goes straight to the payment page. And when I submit the order the shipping address is blank in my emails.

What do I correct to fix this.

Kitti
kittidid
Got it! I was missing some code that I was suppose to enter.

Kitti
annuxx
Could this also add these fields to the address book by editing /catalog/address_book.php and /catalog/address_book_process.php? Can this be displayed in shipping info?

The shopping cart address book are used by our customers to hold their clients info for rewards and gifts.

E.G. I would add fields DOB, Spending Limit and Occassion to be used by customers to indicate to us how much a gift would cost, when it should be recieved, and for what type of occassion.

Im running to a bit of trouble with my added fields just wondering if your solution would work.
sayguh
Hi All,

I have added my custom field successfully..


Is anyone able to tell me how to make a custom field be REQUIRED?

Thanks!
sayguh
kristymichelle
I have sucessfully added custom fields to my customer information. I have some fields that need to be required. I looked in the form_check.js.php file but I can't figure out how to make it come up with an error if the person doesn't enter anything in.
Also, I am trying to figure out how to add this new information to the invioice. Any one have any sugestions?? Thanks.
mrsC2003
So what if you want to add something in the admin that is just for you.

Example:

You buy something that cost $15 (your price) and you want to sell it for say $25 (retail price).

You don't want your price to show in the store, but you do want it to show in the admin in the catelog section when you add a product, as well as the selling price.
Druide
QUOTE (mrsC2003 @ Aug 13 2004, 06:56 PM)
So what if you want to add something in the admin that is just for you.

Example:

You buy something that cost $15 (your price) and you want to sell it for say $25 (retail price).

You don't want your price to show in the store, but you do want it to show in the admin in the catelog section when you add a product, as well as the selling price.

you did reply in the wrong thread mrsC2003
mrsC2003
well since the person was giving a tutorial on add things I though I would ask if they would mind showing us how to do something different....sorry

Kel
Destral
Great tutorial!!!
But....
Now I have a Problem:

How can I make that specific data (height=Client Internal Code) to show on Invoices and Orders follow up??
I've been trying and the text shows quite well the ENTRY_STUFF but the user info doesn't.
I guess I have to retrieve the data from the DB first for it to show... like in the example (customer_stuff$) but I really don't have any idea where or how to do this.

Any help will be very much appreciated biggrin.gif

Regards,

Mike
martinmacca
Ive followed this guide to add a 2nd line for the address field. Its writing to the database correctly, but it isnt showing in the customer address summary. In the 1st pic you can see the extra field which works fine when the customer edits their account address, but in the rest of the catalog the field isnt included as in pic 2. Any ideas how to get the new field included in the primary address ?

martinmacca
sorted cool.gif
chardae
crying.gif There Are several changes needed to accomplish the task of adding a second address line. These changes include the Admin side. After all if a customer adds additional address information you need that information to process the order properly. For example if the customer uses the second address line to add his/her apartment number, you surely need that information for proper delivery of products.

I have accomplished this task in full on my site that is still in development.

Unfortunatly I did not log the changes that I did make as I added them. This means That I will need to back track and find all files needing changes and log the process. Give me a few days and I will package up the changes needed and contribute it as a mod.

martinmacca I pm'd you a little more info on this subject. Will post when I finished logging the changes. Any one wanting to test this out LET ME KNOW!
chardae
I believe I have the entire instructions complete. I need a few people to test it out for errors. Willing parties can email/pm me to let me know how It installs. Please be specific if errors are found. You download it at the contributions.

Extra Address Line Contribution
ElLeonBlanco
I find the instructions are very well written for this contrib. But... I seem to have fallen into the pit of: "I can't quite get this one thing to work." I can get the text fields to work perfectly. When I enter data it updates and displays in the customer's information.

Now here is my problem:

I have added several radio buttons to my customer information. When you select Yes or No it updates the database columns that correspond to the input. But when I go to account edit I can not seem to get the existing selection to display and I end up with all blank radio buttons. (text fields are working) I have tried to figure it out by looking at the code for the gender button which works. I am sure I have overlooked something fairly obvious. pinch.gif

Any ideas?
ElLeonBlanco
QUOTE (ElLeonBlanco @ Oct 5 2004, 08:08 AM)
I find the instructions are very well written for this contrib.  But... I seem to have fallen into the pit of: "I can't quite get this one thing to work."  I can get the text fields to work perfectly. When I enter data it updates and displays in the customer's information. 

Now here is my problem:

I have added several radio buttons to my customer information. When you select Yes or No it updates the database columns that correspond to the input. But when I go to account edit I can not seem to get the existing selection to display and I end up with all blank radio buttons. (text fields are working) I have tried to figure it out by looking at the code for the gender button which works. I am sure I have overlooked something fairly obvious. pinch.gif

Any ideas?
*


Well... it wasn't so obvious.. but as usual persistance and a lot of trial and error paid off. biggrin.gif
PopTheTop
It would be WONDERFUL if there were something in the osC Admin for Admin Notes.

Like a text box that gets saved into the database. When you add something and hit submit, it will be forever saved in the database until you update it or clear the notes contents.

Does anyone know of a contribution (I looked and did not find anything) or how to do this?

I have installed a TON of MODs and some have problems. I do not want to rip them out so I need to make notes about them.

Then if I need to change something and then change it back on the site, I need to make a note about it.

Then if I need to make myself a quick note about an order or supplier, then I need to do that as well.

Basically, I want my notes to be in the osC Admin instead of on a bunch of pieces of paper on my desk and this way, I will have access to my notes on other computers like when I am at work or whatever.

This is really important to me if it can be done.
RobinsonDixon
QUOTE (PopTheTop @ Oct 20 2004, 12:11 AM)
It would be WONDERFUL if there were something in the osC Admin for Admin Notes.

Like a text box that gets saved into the database. When you add something and hit submit, it will be forever saved in the database until you update it or clear the notes contents.

Does anyone know of a contribution (I looked and did not find anything) or how to do this?

I have installed a TON of MODs and some have problems. I do not want to rip them out so I need to make notes about them.

Then if I need to change something and then change it back on the site, I need to make a note about it.

Then if I need to make myself a quick note about an order or supplier, then I need to do that as well.

Basically, I want my notes to be in the osC Admin instead of on a bunch of pieces of paper on my desk and this way, I will have access to my notes on other computers like when I am at work or whatever.

This is really important to me if it can be done.
*


---TIP QUICK AND DIRTY---

for a simple an easy solution install define mainpage and dont install it to php files in your catalog, just add the define mainpage file to your language folder.
if you allready have define mainpage running on your site, open the file and rename all defines to note. that should do the trick

greetz john
PopTheTop
Thanks, but actually I am lost reading your reply. I am not a programmer and just learning as I go while installing various MODs. Can you be more specific as to what you said and then, how do I use it?
PopTheTop
I have decided to tackle this one on my own. Go HERE to get it

Admin Notes v1.0

Works great!
siavash
QUOTE (PopTheTop @ Nov 6 2004, 11:34 AM)
I have decided to tackle this one on my own. Go HERE to get it

Admin Notes v1.0

Works great!
*


very interesting! well done.

how do you think it is possible to interface it or sync what you've done with MS outlook for instance! since a mail client like outloo is in common use it might be helpful to be able to synchronize with it. jus a thought!
PopTheTop
Actually, I do not know. I know nothing about MS Outlook. I use MS Outlook Express.
rg8970
If i were to add fields like Pet Name, Pet Name2, Pet Name3, Pet Breed, Pet Species, how would the code look like in create_account.php, i cant seem to figure this part out, sorry , it's getting late over here crying.gif
Thanks in advance
RG
bmac
Hey all--

I've gone ahead and added about five extra fields to the customer info. However, how do I get this info to show up in the Order Confirmation E-mail that gets sent to both the customer and the store admin? Any help would be MUCH appreciated! Thanks,

Brian
julia
Hey..that is exactly what I just did for my store, but I lumbered through and figured it out without your great instructions.
However, now I want to split up the customer details in create account so it is over 2 pages. I'm a bit nervous about trying, as I know the basics in SQL and a very very little php. If I just make it two pages will I loose the info on the first page?
Do I need a submit button on each page, or can I pass along the info with a continue button, and only have the info on the 2nd page.
What if I want to let them have an option of submitting after the first page, or going on to the 2nd page?
That's what I'm about to tackle. If you have any great advice I'm all ears!
Julie
PopTheTop
QUOTE (julia @ Jun 1 2005, 11:32 AM)
Hey..that is exactly what I just did for my store, but I lumbered through and figured it out without your great instructions. 
However, now I want to split up the customer details in create account so it is over 2 pages.  I'm a bit nervous about trying, as I know the basics in SQL and a very very little php.  If I just make it two pages will I loose the info on the first page?
Do I need a submit button on each page, or can I pass along the info with a continue button, and only have the info on the 2nd page. 
What if I want to let them have an option of submitting after the first page, or going on to the 2nd page? 
That's what I'm about to tackle.  If you have any great advice I'm all ears!
Julie
*



Use a continue button to load the 2nd page and save all the filled in form fields as hidden fields, then when they submit that page, all the form fields will be passed on to the account.
julia
QUOTE (PopTheTop @ Jun 2 2005, 09:09 AM)
Use a continue button to load the 2nd page and save all the filled in form fields as hidden fields, then when they submit that page, all the form fields will be passed on to the account.
*


That is exactly what I'm thinking, and I know this is probably a dumb questiion, but do I replace the continue button which is a submit button


<?php echo tep_draw_separator('pixel_tranphp echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
<td width="10">
WITH

<?php echo '<a href="' . tep_href_link(FILENAME_CREATE_MEASURE, '', 'SSL') . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?>

Will the values from the Create_Account.php feed into the create_measure.php page?

Its the coding I'm not sure of....veeerrry sketchy on the PHP.

Oh..and what about this piece of code

tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
Does that need to be altered also?

Thanks
Julie
brijo.com
Thanks for this code, It works great!, below your quote is how I added TEXT to the right of the inputs for the admin like on the customer forms:

QUOTE (Rusyn @ May 17 2004, 09:49 PM)
5. Open up catalog/admin/customers.php

<snip>

One thing we are missing though is the cms after the field. This is simply because I haven't figured out how to get that text in there.  Once again, we'll have to consult a PHP guy.


5. Open up catalog/admin/customers.php

Replace:
CODE
<?php
 if ($processed == true) {
   echo $cInfo->customers_fax . tep_draw_hidden_field('customers_fax');
 } else {
   echo tep_draw_input_field('customers_fax', $cInfo->customers_fax, 'maxlength="32"');
 }
?>


with
CODE
<?php
 if ($processed == true) {
   echo $cInfo->customers_height . tep_draw_hidden_field('customers_height');
 } else {
   echo tep_draw_input_field('customers_height', $cInfo->customers_height, 'maxlength="3"' . 'style="width: 50"');
 }
 echo '&nbsp;<span class="fieldRequired">' . ENTRY_CENTIMETERS_TEXT . '</span>'; ?>
wine
Anybody knows how to add custom field with selection of one of three radiobuttons?

and how to add search by letters if I want to display the whole alphabet?
julia
QUOTE (wine @ Jun 30 2005, 11:31 PM)
Anybody knows how to add custom field with selection of one of three radiobuttons?

and how to add search by letters if I want to display the whole alphabet?
*


I'm not a php person, but I just added custom fields with a drop down using
this contribution

http://www.oscommerce.com/community/contri...ll/search,title

You could probably modify it easily for the radio buttons. Its a little more complicated than using text because the field needs to have its own table.
As far as the alphabet thing goes.. sorry. I've seen that feature alot on sites, and its very useful. If you find and answer, let me know!
Julie
schiuma
1054 - Unknown column 'cvv_number' in 'field list'

insert into orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, cvv_number, issue_number, date_purchased, orders_status, currency, currency_value) values ('2', 'Edgar Fernandez', '', 'soga gorriga 1', 'concolo', 'caguas', '00725', 'puerto rico', 'Puerto Rico', '7874621580', 'jelousy@hotmail.com', '1', 'Edgar Fernandez', '', 'soga gorriga 1', 'concolo', 'caguas', '00725', 'puerto rico', 'Puerto Rico', '1', 'Edgar Fernandez', '', 'soga gorriga 1', 'concolo', 'caguas', '00725', 'puerto rico', 'Puerto Rico', '1', 'Cash on Delivery', '', '', '', '', '', '', now(), '1', 'USD', '1.00000000')

[TEP STOP]

i added some customs fields as the tutorial instructed now im having this error...
julia
I got this error alot when I was adding my custom fields, and it was usually something easy like a spelling mistake. Make sure that you have added that field to the database. I'm not a php person, but that might be the first place to start.
Julie
markschaef
hey guys!
i really have an odd problem with adding new custom fields in
the ACCOUNT_EDIT.php

they only work and update the database if i add:

$mpass = "hallo"
$muser = "hehe"
....-> DB update....


if i do it like that:

$mpass = tep_db_prepare_input($HTTP_POST_VARS['mpass']);
...
array('customers_firstname' => $firstname,
'customers_lastname' => $lastname,
'customers_email_address' => $email_address,
'customers_telephone' => $telephone,
'muser' => $muser,
'customers_fax' => $fax);


the database fields gettin' cleared.
I think that my fields are correct, but the $POST doesnt work.
these are my fields:

<?php echo tep_draw_input_field('muser', $account['muser']) . '&nbsp;'.....
they display the database content, but on submit they loose it due to wrong update (of course with both empty!!)

what can i do?
thx Mark
sassybot
i tryed this it didnt work i know it was my mistake i could see it was going to work but god knows what i did wrong

QUOTE (Rusyn @ May 18 2004, 11:49 AM)
Adding Custom Fields to Customer Details

So you need to know some extra info about your customers?  This tutorial will explain how to add extra text fields to Customer Details. I will be using the example of HEIGHT, but this can be changed to any piece of info you need to know. 

You will have to edit the following FIVE files:

catalog/create_account.php
catalog/account_edit.php
catalog/includes/languages/english.php

catalog/admin/customers.php
catalog/admin/includes/languages/english.php


So basically you add fields and commands to write to the database in the files, and add the text label (Height, Weight, etc.) in the language files.  You have to do the account_edit so your customers can ... edit their account wink.gif, and in case you want to see/change their info in the Admin, you will have to change stuff in their too.

But first you will need to add a new field to the database in phpMyAdmin.  Click on customers, scroll down to the bottom and look for "Add New Field".  Add 1 field At End of Table. Enter "height" into the Field name, make sure VARCHAR is selected, and make the Length 3 (this could be any lenth, the default is 32 in oSc, but for my purposes height rarely exceeds 999cms wink.gif) Hit OKAY and you are done!
Now, here we go to the hard part:
1. Open up catalog/includes/languages/english.php

Add your category and your label text.  For this example I will be making a category called Sizing, with one entry called Height:

CODE
define('CATEGORY_SIZE', 'Sizing');

CODE
define('ENTRY_CUSTOMER_HEIGHT','Height');


Now, I wanted to put a little centimeters beside the field so people knew what kind of measure ments to put in.  So I added another define:

CODE
define('ENTRY_CENTIMETERS_TEXT', 'centimeters');


This can be ANY text you want.

SAVE
2. Open up catalog/create_account.php

What I did here was copy and paste an entire CATEGORY.  If you are looking in Dreamweaver, go to around line 500 until you see <?php echo CATEGORY_CONTACT; ?>.  Now copy this cell, the one above it (tep_draw_seperator), and the cell below it which contains a table that has telephone and fax info.  Then paste these three cells where you want your category to appear. 

Select the <?php echo CATEGORY_CONTACT; ?> and change it to <?php echo CATEGORY_SIZE; ?>

Then go one cell down and get rid of the Telephone cells.  Select the <?php echo ENTRY_FAX_NUMBER; ?> and change it to <?php echo ENTRY_CUSTOMER_HEIGHT; ?> There is your label done.

The next php block is for drawing the actual form field.  Change:

CODE
<?php echo tep_draw_input_field('fax') . '&nbsp;' . (tep_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?>


CODE
<?php echo tep_draw_input_field('height','','maxlength="3"' . 'style="width: 50"') . '&nbsp;' . (tep_not_null(ENTRY_CENTIMETERS_TEXT) ? '<span class="caption">' . ENTRY_CENTIMETERS_TEXT . '</span>': ''); ?>


So now the actual form is done.  Notice that I have put a character maxlength and a style width on the field?  Adjust these as you wish.  Also, notice that our centimeters text is going to fall in there real nice.  See the special CSS style I gave the centimeter text so it would look nice?

So that is the table are done, but we are going to have to make two more additions.

We are going to need to make a variable, so insert the following around LINE 45:
CODE
   $height = tep_db_prepare_input($HTTP_POST_VARS['height']);

Next search for
CODE
$sql_data_array = array('customers_firstname' => $firstname,

Add in
CODE
'customers_height' => $height,
somewhere in the array.  There are TWO arrays, make sure that this is changed in only the first one.

Now whatever is written in the field will be entered into the database.

SAVE
3.Open up catalog/account_edit.php

Here we are going to pull the same trick as above and copy the "My Details" CATEGORY, then edit it to our needs.  On line 185 you will see <?php echo MY_ACCOUNT_TITLE; ?>, so basically copy that cell, the one above and the one below.  It is from about LINE 174 to LINE 243 in total. Then paste it in below. Again, delete all the unnecessary blocks except for the fax number.  Select the <?php echo ENTRY_FAX_NUMBER; ?> and change it to <?php echo ENTRY_CUSTOMER_HEIGHT; ?>. Label finished, now for the field.

Replace:
CODE
<?php echo tep_draw_input_field('fax', $account['customers_fax']) . '&nbsp;' . (tep_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?>

with
CODE
<?php echo tep_draw_input_field('height', $account ['customers_height'],'maxlength="3"' . 'style="width: 50"') . '&nbsp;' . (tep_not_null(ENTRY_CENTIMETERS_TEXT) ? '<span class="caption">' . ENTRY_CENTIMETERS_TEXT . '</span>': ''); ?>


There is your table done. Notice that the input field is retrieving info from the database?

Now to make it writable.  Add in your variable around LINE 30:
CODE
    $height =

tep_db_prepare_input($HTTP_POST_VARS['height']);


Search for
CODE
$sql_data_array = array('customers_firstname' => $firstname,

and add in
CODE
'customers_height' => $height,
somewhere in the array. Make sure to do this only to the TOP one.

Next, search for
CODE
$account_query = tep_db_query

You will have to enter your database field name in here too, so it knows where to look to retrieve the customers data.  Here is an example of what MY query looks like:
CODE
$account_query = tep_db_query("select customers_gender, customers_firstname, customers_lastname, customers_dob, customers_email_address, customers_height, customers_telephone, customers_fax from "


All done.  Now the customer will be able to view their information in My Account, and update the values if they grow a few cms. wink.gif

SAVE

4. Open up catalog/admin/includes/languages/english.php

Okay, this one is easy. You just do here exactly what you did in step one and add these three chunks:

CODE
define('CATEGORY_SIZE', 'Sizing');

CODE
define('ENTRY_CUSTOMER_HEIGHT','Height');

CODE
define('ENTRY_CENTIMETERS_TEXT', 'centimeters');


SAVE

5. Open up catalog/admin/customers.php

This one gets a little tricky.  We are going to copy and paste the Contact CATEGORY, just like what we did to the files over in the catalog.  Then rename <?php echo ENTRY_FAX_NUMBER; ?> to <?php echo ENTRY_CUSTOMER_HEIGHT; ?>.

Now, the field is a little tricky.  Replace:
CODE
<?php
 if ($processed == true) {
   echo $cInfo->customers_fax . tep_draw_hidden_field('customers_fax');
 } else {
   echo tep_draw_input_field('customers_fax', $cInfo->customers_fax, 'maxlength="32"');
 }
?>


with
CODE
<?php
 if ($processed == true) {
   echo $cInfo->customers_height . tep_draw_hidden_field('customers_height');
 } else {
   echo tep_draw_input_field('customers_height', $cInfo->customers_height, 'maxlength="3"' . 'style="width: 50"');
 }
?>


A little different than what we have done before.  Notice the maxlength and the style width.

You will also notice the cInfo, don't worry I don't know what this is for either.  Hafta consult a php guy. 

One thing we are missing though is the cms after the field. This is simply because I haven't figured out how to get that text in there.  Once again, we'll have to consult a PHP guy.

In any case, the table is set up, now we have to do our database stuff again, so insert our variable at around LINE 30
CODE
$customers_height = tep_db_prepare_input($HTTP_POST_VARS[

'customers_height']);


Search for:
CODE
$sql_data_array = array('customers_firstname' => $customers_firstname,


and enter in below:
CODE
'customers_height' => $customers_height,


Remember to do this only on the top sql query.

Find the $customers_query and enter in c.customers_height.  Notice the difference from step 3.  Here is an example of what MY query looks like:
CODE
$customers_query = tep_db_query("select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, c.customers_height, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_address_id from "


Now we are DONE!!!
SAVE!!!!

Adjust at will, put those 5 files on the server and give it a go.  All should be fine. 

Good luck!!
*
markschaef
QUOTE (sassybot @ Sep 13 2005, 03:16 AM)
i tryed this it didnt work i know it was my mistake i could see it was going to work but god knows what i did wrong
*


it works just fine! but i realized you have to be really careful with the input fields, no mistakes or nothing will work wink.gif
yours, Mark
julia
QUOTE (markschaef @ Sep 12 2005, 09:47 PM)
it works just fine! but i realized you have to be really careful with the input fields, no mistakes or nothing will work wink.gif
yours, Mark
*


That's exacty it Mark. There are so many places that you have to list the variable, and if you cut and paste and forget to change one, it won't work. Plus you have to do it again on the edit account, and the admin..so there are alot of areas for an error.
Julie
sarah1980
Can someone tell me if the extra fields that you ask the customer to fill in are viewable on their invoice or their order information or customer information?
markschaef
QUOTE (sarah1980 @ Sep 15 2005, 03:33 AM)
Can someone tell me if the extra fields that you ask the customer to fill in are viewable on their invoice or their order information or customer information?
*


if these extra fields are edited in the invoice.php as well, yes!
but you have to insert the same tags there as well - like the tag to get them from the DB

yours, mark
sarah1980
QUOTE (markschaef @ Sep 15 2005, 05:35 AM)
if these extra fields are edited in the invoice.php as well, yes!
but you have to insert the same tags there as well - like the tag to get them from the DB

yours, mark
*

Sorry, which code do I need to add in the invoice.php?
markschaef
QUOTE (sarah1980 @ Sep 16 2005, 05:08 PM)
Sorry, which code do I need to add in the invoice.php?
*

I dont know what your extra fields look like or where they are stored at in the DB
but you have to get them out of there (by QUERY)
inside the invoice.php
and then to display them like <?php echo query['field'];?>
tec
On my check out shipping page, i have the Gift wrap mod installed, if i wanted to add the fields
- Is this for a male or female?
- What is the occassion?
- WHat do you wish the gift card to say?

would i do it the same way but only to the checkout shipping page? and what table would i edit in the DB to add these new fields?

I also need to have it shown on the Admin Orders Status Page and shown within the order confirmation email sent to both customer and store owner.
tec
This is what I have on my checkout_shipping.php, i must be missing something on this file though, it was too simple to do wink.gif
Now god knows, this is the only page i have been able to try to figure out, though it is probably off by a mile, I started editing the admin/orders.php but thought i better come back first


[code]
<?php

/*

 $Id: checkout_shipping.php,v 1.16 2003/06/09 23:03:53 hpdl Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright © 2003 osCommerce



 Released under the GNU General Public License

*/



 require('includes/application_top.php');

 require('includes/classes/http_client.php');



// if the customer is not logged on, redirect them to the login page

 if (!tep_session_is_registered('customer_id')) {

   $navigation->set_snapshot();

   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

 }



// if there is nothing in the customers cart, redirect them to the shopping cart page

 if ($cart->count_contents() < 1) {

   tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

 }



// if no shipping destination address was selected, use the customers own address as default

 if (!tep_session_is_registered('sendto')) {

   tep_session_register('sendto');

   $sendto = $customer_default_address_id;

 } else {

// verify the selected shipping address

   $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'");

   $check_address = tep_db_fetch_array($check_address_query);



   if ($check_address['total'] != '1') {

     $sendto = $customer_default_address_id;

     if (tep_session_is_registered('shipping')) tep_session_unregister('shipping');

   }

 }



 require(DIR_WS_CLASSES . 'order.php');

 $order = new order;



// register a random ID in the session to check throughout the checkout procedure

// against alterations in the shopping cart contents

 if (!tep_session_is_registered('cartID')) tep_session_register('cartID');

 $cartID = $cart->cartID;



// if the order contains only virtual products, forward the customer to the billing page as

// a shipping address is not needed

// ###### Added CCGV Contribution #########

//  if ($order->content_type == 'virtual') {

 if (($order->content_type == 'virtual') || ($order->content_type == 'virtual_weight') ) {

// ###### End Added CCGV Contribution #########

   if (!tep_session_is_registered('shipping')) tep_session_register('shipping');

   $shipping = false;

   $sendto = false;

   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

 }



 $total_weight = $cart->show_weight();

 $total_count = $cart->count_contents();

// load giftwrap module
 require(DIR_WS_CLASSES . 'gift.php');
 $giftwrap_modules = new gift;

// process the selected giftwrap method
 if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) {
   if (!tep_session_is_registered('giftwrap_info')) tep_session_register('giftwrap_info');

   if (tep_count_giftwrap_modules() > 0) {
     if ( (isset($HTTP_POST_VARS['giftwrap'])) && (strpos($HTTP_POST_VARS['giftwrap'], '_')) ) {
       $giftwrap_info = $HTTP_POST_VARS['giftwrap'];

       list($module, $method) = explode('_', $giftwrap_info);
       if (is_object($$module)) {
         $quote1 = $giftwrap_modules->quote1($method, $module);
         if (isset($quote1['error'])) {
           tep_session_unregister('giftwrap');
         } else {
           if ( (isset($quote1[0]['methods'][0]['title'])) && (isset($quote1[0]['methods'][0]['cost'])) ) {
             $giftwrap_info = array('id' => $giftwrap_info,
                                    'title' => $quote1[0]['module'] . ' (' . $quote1[0]['methods'][0]['title'] . ')',
                                    'cost' => $quote1[0]['methods'][0]['cost']);
           }
         }
       } else {
         tep_session_unregister('giftwrap_info');
       }
     }
   } else {
     $giftwrap_info = false;
   }    
 }

// get all available giftwrap quotes
 $quotes1 = $giftwrap_modules->quote1();

// add gift message
 if ($HTTP_GET_VARS['action'] == 'update') {
   if (tep_not_null($HTTP_POST_VARS['giftMessage']) && tep_session_is_registered('giftwrap_info')) {
     $giftMessage = tep_db_prepare_input($HTTP_POST_VARS['giftMessage']);

     if (tep_session_is_registered('customer_id')) {
       tep_db_query("update " . TABLE_ORDERS . " set giftMessage = '" . tep_db_input($giftMessage) . "' where customers_id = '" . $customer_id . "' and orders_id = '" . $order_id . "'");
     } else {
       tep_db_query("update " . TABLE_ORDERS . " set giftMessage = '" . tep_db_input($giftMessage) . "' where customers_id = '0' and orders_id = '" . $order_id . "'");
     }

     tep_session_unregister('giftwrap_info');
   }
 }
 
// what is the recipients info?

$occasion = tep_db_prepare_input($HTTP_POST_VARS['occasion']);
$recipient sex = tep_db_prepare_input($HTTP_POST_VARS['recipient sex']);
if ($HTTP_GET_VARS['action'] == 'update') {
if (tep_not_null($HTTP_POST_VARS['occasion']) && tep_session_is_registered('occasion_info')) {
$occasion = tep_db_prepare_input($HTTP_POST_VARS['occasion']);

if (tep_session_is_registered('customer_id')) {
tep_db_query("update " . TABLE_ORDERS . " set occasion = '" . tep_db_input($occasion) . "' where customers_id = '" . $customer_id . "' and orders_id = '" . $order_id . "'");
} else {
tep_db_query("update " . TABLE_ORDERS . " set occasion = '" . tep_db_input($occasion) . "' where customers_id = '0' and orders_id = '" . $order_id . "'");
}

if ($HTTP_GET_VARS['action'] == 'update') {
if (tep_not_null($HTTP_POST_VARS['recipient sex']) && tep_session_is_registered('recipient sex_info')) {
$occasion = tep_db_prepare_input($HTTP_POST_VARS['recipient sex']);

if (tep_session_is_registered('customer_id')) {
tep_db_query("update " . TABLE_ORDERS . " set recipient sex = '" . tep_db_input($recipient sex) . "' where customers_id = '" . $customer_id . "' and orders_id = '" . $order_id . "'");
} else {
tep_db_query("update " . TABLE_ORDERS . " set recipient sex = '" . tep_db_input($recipient sex) . "' where customers_id = '0' and orders_id = '" . $order_id . "'");
}
// load all enabled shipping modules

 require(DIR_WS_CLASSES . 'shipping.php');

 $shipping_modules = new shipping;



 if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) {

   $pass = false;



   switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {

     case 'national':

       if ($order->delivery['country_id'] == STORE_COUNTRY) {

         $pass = true;

       }

       break;

     case 'international':

       if ($order->delivery['country_id'] != STORE_COUNTRY) {

         $pass = true;

       }

       break;

     case 'both':

       $pass = true;

       break;

   }



   $free_shipping = false;

   if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {

     $free_shipping = true;



     include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php');

   }

 } else {

   $free_shipping = false;

 }



// process the selected shipping method

 if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) {

   if (!tep_session_is_registered('comments')) tep_session_register('comments');

   if (tep_not_null($HTTP_POST_VARS['comments'])) {

     $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);

   }



   if (!tep_session_is_registered('shipping')) tep_session_register('shipping');



   if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) {

     if ( (isset($HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'], '_')) ) {

       $shipping = $HTTP_POST_VARS['shipping'];



       list($module, $method) = explode('_', $shipping);

       if ( is_object($$module) || ($shipping == 'free_free') ) {

         if ($shipping == 'free_free') {

           $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;

           $quote[0]['methods'][0]['cost'] = '0';

         } else {

           $quote = $shipping_modules->quote($method, $module);

         }

         if (isset($quote['error'])) {

           tep_session_unregister('shipping');

         } else {

           if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {

             $shipping = array('id' => $shipping,

                               'title' => (($free_shipping == true) ?  $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),

                               'cost' => $quote[0]['methods'][0]['cost']);



             tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

           }

         }

       } else {

         tep_session_unregister('shipping');

       }

     }

   } else {

     $shipping = false;

               

     tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

   }    

 }



// get all available shipping quotes

 $quotes = $shipping_modules->quote();



// if no shipping method has been selected, automatically select the cheapest method.

// if the modules status was changed when none were available, to save on implementing

// a javascript force-selection method, also automatically select the cheapest shipping

// method if more than one module is now enabled

 if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest();



 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SHIPPING);



 $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

 $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

<script language="javascript"><!--

var selected;



function selectRowEffect(object, buttonSelect) {

 if (!selected) {

   if (document.getElementById) {

     selected = document.getElementById('defaultSelected');

   } else {

     selected = document.all['defaultSelected'];

   }

 }



 if (selected) selected.className = 'moduleRow';

 object.className = 'moduleRowSelected';

 selected = object;



// one button is not an array

 if (document.checkout_address.shipping[0]) {

   document.checkout_address.shipping[buttonSelect].checked=true;

 } else {

   document.checkout_address.shipping.checked=true;

 }

}



function rowOverEffect(object) {

 if (object.className == 'moduleRow') object.className = 'moduleRowOver';

}



function rowOutEffect(object) {

 if (object.className == 'moduleRowOver') object.className = 'moduleRow';

}

//--></script>

<?php echo HTML_PARAMS; ?>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"<?php echo CHARSET; ?>

<!-- header_eof //-->



<!-- body //-->

<table width="100%" border="0" cellpadding="0" cellspacing="0">

 <tr>

   <td width="<?php echo BOX_WIDTH; ?>" valign="top" class="columnLeft"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2" >

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

   </table></td>

<!-- body_text //-->

   <td width="100%" valign="top" class="columnCenter"><?php echo tep_draw_form('checkout_address', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

     <tr>

       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">

         <tr>

           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_delivery.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">

         <tr>

           <td class="main"><b><?php echo TABLE_HEADING_SHIPPING_ADDRESS; ?></b></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

         <tr class="infoBoxContents">

           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">

             <tr>

               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<?php //start gift registry ?>
                 <?php
                   if($cart->registry_customers_id == '0'){
                 ?>
               <td class="main" width="50%" valign="top"><?php echo TEXT_CHOOSE_SHIPPING_DESTINATION . '<br><br><a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '">' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>'; ?></td>
                 <?php
                   }else{
                 ?>
                     <td class="main" width="50%" valign="top"><?php echo TEXT_REGISTRY_PURCHASE_SHIPPING_DESTINATION . '<br><br>'; ?></td>
                 <?php
                   }
                 ?>
<?php //end gift registry ?>
               <td align="right" width="50%" valign="top"><table border="0" cellspacing="0" cellpadding="2">

                 <tr>

                   <td class="main" align="center" valign="top"><?php echo '<b>' . TITLE_SHIPPING_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td>

                   <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                   <td class="main" valign="top">
<?php //start gift registry ?>
                     <?php
                       if($cart->registry_customers_id == '0'){
                         echo tep_address_label($customer_id, $sendto, true, ' ', '<br>');
                       }else{
                         echo tep_address_label($cart->registry_customers_id, tep_get_default_address($cart->registry_customers_id), true, ' ', '<br>');
                       }
                     ?>
<?php //end gift registry ?>
                   </td>
                   <td class="main" valign="top"><?php echo tep_address_label($customer_id, $sendto, true, ' ', '<br>'); ?></td>

                   <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

                 </tr>

               </table></td>

             </tr>

           </table></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>
<?php
 if (tep_count_giftwrap_modules() > 0) {
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
               <td height="22" class="main"><b><?php echo TABLE_HEADING_GIFTWRAP_METHOD; ?></b></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
               <td height="194">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
   $quotes1_size = sizeof($quotes1);

   if ($quotes1_size > 1) {
?>
             <tr>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main" width="50%" valign="top"><?php echo TEXT_CHOOSE_GIFTWRAP_METHOD; ?></td>
               <td class="main" width="50%" valign="top" align="right"><?php echo '<b>' . TITLE_PLEASE_SELECT . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?></td>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
<?php
   } else {
?>
             <tr>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main" width="100%" colspan="2"></td>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
<?php
   }

   $radio_buttons = 0;
   for ($i=0; $i<$quotes1_size; $i++) {
?>
             <tr>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
     if (isset($quotes1[$i]['error'])) {
?>
                 <tr>
                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                   <td class="main" colspan="3"><?php echo $quotes1[$i]['error']; ?></td>
                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                 </tr>
<?php
     } else {
       $size = sizeof($quotes1[$i]['methods']);
       for ($j=0, $n2=$size; $j<$n2; $j++) {
// set the radio button to be checked if it is the method chosen
         $checked = (($quotes1[$i]['id'] . '_' . $quotes1[$i]['methods'][$j]['id'] == $giftwrap_info['id']) ? true : false);

         if ( ($quotes1[$i]['id'] . '_' . $quotes1[$i]['methods'][$j]['id'] == $giftwrap_info['id']) || (tep_count_giftwrap_modules() == (int)1) ) {
           echo '                  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
         } else {
           echo '                  <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
         }
?>
                 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                 <td class="main" width="75%"><?php echo $quotes1[$i]['methods'][$j]['title']; ?></td>
<?php
         if ( ($quotes1_size > 1) || ($n2 > 1) ) {
?>
                 <td class="main"><?php echo $currencies->format($quotes1[$i]['methods'][$j]['cost']); ?></td>
                 <td class="main" align="right"><?php echo tep_draw_radio_field('giftwrap', $quotes1[$i]['id'] . '_' . $quotes1[$i]['methods'][$j]['id'], $checked); ?></td>

<?php
         } else {
?>
                 <td class="main" align="right" colspan="2"><?php echo $currencies->format($quotes1[$i]['methods'][$j]['cost']) . tep_draw_hidden_field('giftwrap', $quotes1[$i]['id'] . '_' . $quotes1[$i]['methods'][$j]['id']); ?></td>
<?php
         }
?>
                 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               </tr>
<?php
         $radio_buttons++;
       }
     }
?>
             </table></td>
             <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
           </tr>
<?php
   }
?>
         </table>
                 <table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td colspan="2" class="main"><?php echo CATEGORY_RECIPIENT; ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table width="575" border="0" cellpadding="2" cellspacing="2">
<tr>
<td width="137" class="main"><?php echo ENTRY_RECPIENT_SEX; ?></td>
<td width="140" class="main"><?php echo tep_draw_input_field('recipient sex','','maxlength="1"' . 'style="width: 50"') . '&nbsp;'(tep_not_null(ENTRY_RECPIENT_SEX_TEXT) ? '<span class="inputRequirement">' . ENTRY_RECPIENT_SEX_TEXT . '</span>': ''); ?></td>
<td width="134" class="main"><?php echo ENTRY_OCCASION; ?></td>
<td width="138" class="main"><?php echo tep_draw_input_field('occasion','','maxlength="40"' . 'style="width: 50"') . '&nbsp;'(tep_not_null(ENTRY_OCCASION_TEXT) ? '<span class="inputRequirement">' . ENTRY_OCCASION_TEXT . '</span>': ''); ?></td>

</tr>
</table></td>

</tr>

</table></td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="main"><strong>What do you wish your
gift card to say?</strong></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_textarea_field('gift wrap information', 'soft', '60', '5'); ?></td>
</tr>
</table>
</
td>
       </tr>
       </table></td>
     </tr>
<?php
 }
?>
<?php

 if (tep_count_shipping_modules() > 0) {

?>

     <tr>

       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">

         <tr>

               <td class="main"><b><?php echo TABLE_HEADING_SHIPPING_METHOD; ?></b></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

         <tr class="infoBoxContents">

           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php

   if (sizeof($quotes) > 1 && sizeof($quotes[0]) > 1) {

?>

             <tr>

               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

               <td class="main" width="50%" valign="top"><?php echo TEXT_CHOOSE_SHIPPING_METHOD; ?></td>

               <td class="main" width="50%" valign="top" align="right"><?php echo '<b>' . TITLE_PLEASE_SELECT . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?></td>

               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

             </tr>

<?php

   } elseif ($free_shipping == false) {

?>

             <tr>

               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

               <td class="main" width="100%" colspan="2"><?php echo TEXT_ENTER_SHIPPING_INFORMATION; ?></td>

               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

             </tr>

<?php

   }



   if ($free_shipping == true) {

?>

             <tr>

               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

               <td colspan="2" width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="2">

                 <tr>

                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

                   <td class="main" colspan="3"><b><?php echo FREE_SHIPPING_TITLE; ?></b>&nbsp;<?php echo $quotes[$i]['icon']; ?></td>

                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

                 </tr>

                 <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, 0)">

                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

                   <td class="main" width="100%"><?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . tep_draw_hidden_field('shipping', 'free_free'); ?></td>

                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

                 </tr>

               </table></td>

               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

             </tr>

<?php

   } else {

     $radio_buttons = 0;

     for ($i=0, $n=sizeof($quotes); $i<$n; $i++) {

?>

             <tr>

               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

               <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">

                 <tr>

                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

                   <td class="main" colspan="3"><b><?php echo $quotes[$i]['module']; ?></b>&nbsp;<?php if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?></td>

                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

                 </tr>

<?php

       if (isset($quotes[$i]['error'])) {

?>

                 <tr>

                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

                   <td class="main" colspan="3"><?php echo $quotes[$i]['error']; ?></td>

                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

                 </tr>

<?php

       } else {

         for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {

// set the radio button to be checked if it is the method chosen

           $checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $shipping['id']) ? true : false);



           if ( ($checked == true) || ($n == 1 && $n2 == 1) ) {

             echo '                  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";

           } else {

             echo '                  <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";

           }

?>

                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

                   <td class="main" width="75%"><?php echo $quotes[$i]['methods'][$j]['title']; ?></td>

<?php

           if ( ($n > 1) || ($n2 > 1) ) {

?>

                   <td class="main"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); ?></td>

                   <td class="main" align="right"><?php echo tep_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked); ?></td>

<?php

           } else {

?>

                   <td class="main" align="right" colspan="2"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?></td>

<?php

           }

?>

                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

                 </tr>

<?php

           $radio_buttons++;

         }

       }

?>

               </table></td>

               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

             </tr>

<?php

     }

   }

?>

           </table></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

<?php

 }

?>

     <tr>

       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">

         <tr>

           <td class="main"><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

         <tr class="infoBoxContents">

           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">

             <tr>

               <td><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>

             </tr>

           </table></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

         <tr class="infoBoxContents">

           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">

             <tr>

               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

               <td class="main"><?php echo '<b>' . TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></td>

               <td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

             </tr>

           </table></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">

         <tr>

           <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

             <tr>

               <td width="50%" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>

               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

             </tr>

           </table></td>

           <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

           <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

         
shaytaan
Is it possible to make something like this?
http://forums.oscommerce.com/index.php?act...t=0#entry711332
qhordern
This has worked very well.
Now how can i get the new height field to show on my order page??

Q
markschaef
QUOTE (shaytaan @ Sep 29 2005, 04:38 AM) *
Is it possible to make something like this?
http://forums.oscommerce.com/index.php?act...t=0#entry711332


yes, i suppose its not a big deal.
just insert:

<tr><td class="main">Type:</td>
<td class="main"><select name="type" onchange="java script:swap_fields('create');"><option value="2">Firma</option><option value="4">Offentlig</option><option value="1" SELECTED>Privat</option></select></td></tr>

and the javascript command.

I WAS WONDERING, wheater you could use this for the type of account the customer would like to create.
if he only buys DOWNLOAD Products, he probably doesn't want to add all the shipping address stuff..
so maybe we could deactivate certain "field size checks"

thx! yours, Mark
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.