PowWeb Forums - The Perfect Community for the Perfect Host  

Register now to interact with over 11,000 members! Registered users have Posting Privileges, free access to Private Messaging, Email Notifications and more.

Go Back   PowWeb Community Forums > Web Site Design > Content Management Systems > E-commerce and Shopping Carts
User Name
Password
Register FAQ Members List Search Today's Posts Mark Forums Read

Closed Thread
 
Thread Tools Search this Thread
Old 11-26-04, 09:07 PM   #1
aviscat
 
Join Date: Nov 2004
Location: Texas
Posts: 24
Reputation: 5
Help Adding a Required Text Field

I am trying to add a text field to the customers database and I have accomplished that. I want it to be a required field but it is not seeing it as such. It is also not updating in the database. I am not 100% sure what I am doing and need some specific help.


--
aviscat
AKA Maria
aviscat is offline  
Old 11-26-04, 09:26 PM   #2
stevel
XPW
 
stevel's Avatar
 
Join Date: Jun 2002
Location: New Hampshire, USA
Posts: 9,464
Reputation: 265
Well, what have you done so far?

The general steps needed are:

1. Add the field to the customers record in the database using phpMyAdmin
2. Ask for the data in an appropriate form. If you're unsure how to do this, find another field that already exists that has the same general properties and duplicate it, changing the field name as appropriate.
3. Be sure to call tep_db_prepare_input on the customer-entered data to prevent a security hole. For example, create_account.php does:
PHP Code:
$firstname tep_db_prepare_input($HTTP_POST_VARS['firstname']); 
4. Add the new field to the $sql_data_array used for adding or updating a record, and to the list of fields requested in any relevant queries.

Again, the easiest way to add something new in osCommerce is to find something already there that is similar and copy it.
__________________
Steve
stevel is offline  
Old 11-26-04, 11:34 PM   #3
aviscat
 
Join Date: Nov 2004
Location: Texas
Posts: 24
Reputation: 5
Quote:
Originally Posted by stevel
Well, what have you done so far?

The general steps needed are:

1. Add the field to the customers record in the database using phpMyAdmin
2. Ask for the data in an appropriate form. If you're unsure how to do this, find another field that already exists that has the same general properties and duplicate it, changing the field name as appropriate.

Did this already

3. Be sure to call tep_db_prepare_input on the customer-entered data to prevent a security hole. For example, create_account.php does:
PHP Code:
$firstname tep_db_prepare_input($HTTP_POST_VARS['firstname']); 

Missed this part but have now coded it

4. Add the new field to the $sql_data_array used for adding or updating a record, and to the list of fields requested in any relevant queries.

This is where I am having trouble.

I can't find where it updates. Can you tell me which file to look at and possibly some hint at what code is doing the update?

Again, the easiest way to add something new in osCommerce is to find something already there that is similar and copy it.

That's what I have been doing. Will also need to see this field in the admin section but I am thinking that if it updates on entry it will be there in admin. I have already coded the text box and it does appear but of course it is empty.

Thanks,
--
aviscat
Maria
aviscat is offline  
Old 11-27-04, 09:43 AM   #4
stevel
XPW
 
stevel's Avatar
 
Join Date: Jun 2002
Location: New Hampshire, USA
Posts: 9,464
Reputation: 265
In the code for admin, you will also have to add the new field to queries that display the customer record and then add code to display the new field. Do be aware that the customer record is not shown for orders - you would perhaps need to copy information to the order record (customer details for a specific order are in the order record - the customer record is changeable by the customer at any time.)
__________________
Steve
stevel is offline  
Old 11-27-04, 02:24 PM   #5
aviscat
 
Join Date: Nov 2004
Location: Texas
Posts: 24
Reputation: 5
still not updating

Quote:
Originally Posted by stevel
In the code for admin, you will also have to add the new field to queries that display the customer record and then add code to display the new field. Do be aware that the customer record is not shown for orders - you would perhaps need to copy information to the order record (customer details for a specific order are in the order record - the customer record is changeable by the customer at any time.)

I have added all the above to my code on the admin side and yes the box shows up on the admin side - empty.

The site is http://felinepharmacy.com//catsafratsrx/catalog/ if you want to take a look at it.

--
aviscat still
AKA Maria
aviscat is offline  
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 08:53 AM.


Contents ©PowWeb, Inc. ~ vBulletin, Copyright © 2000-2007 Jelsoft Enterprises Limited.