Adding new fields to the Customer Details
I have a client that lost his Zen Cart developer mid-project. I am an experienced PHP developer, but new to the cart.
The requirement is to add four new fields to the Client Details, the page you fill out to get an id to the site. He wants to add a Fed Tax Id, Business Type, etc.
Going through the forum and faqs, I think my approach is to:
Add a new database table for the fields, this will prevent me from losing the fields when he upgrades.
Add the fields to a language file in the language override directory. This file already exists, it was left by the previous dev.
Add the fields to a template in the override dir. Like the language, this file is already there, it just needs the new fields.
Change the code that saves the data (header_php.php?). My understanding is that this is outside the override system. I believe I need to back up the original, make the changes, and backup the new. Lastly leave good notes about this so that I will remember to deal with it when we upgrade in the future.
If I am about to blow a big hole in my foot, please let me know.
Thanks!
Re: Adding new fields to the Customer Details
Boom ... :eek:
Unless there is a reason for a new table adding to an existing table is fine ... you just need to confirm that access to the table for adding, editing, etc. manages the existing fields as well as the new ones ...
Upgrades should not toss your tables ... just update your code and be sure to apply the changes when needed ...
So you need to determin which table owns the field ...
customers
customers_info
address_book
This is actually much easier than trying to join tables and track them together etc.
Re: Adding new fields to the Customer Details
Thanks for the feedback! The work is in and working, so I am not going to take your advice this time. That is great to know for the future though.
Tom
Re: Adding new fields to the Customer Details
Hi,
I am currently working on the same kind of development :wink2: (need to add a field in the create account page).
I have no problem with the database (customers table), the override template dir. (/includes/templates/my_template/templates/tpl_modules_create_account.php) and the override languages dir. (/includes/languages/my_template/english.php and as you maybe guessed ... french.php).
But like DustyShoes, I am less sure with the way to update the database :
I guessed i have to change the /includes/modules/create_account.php file and my questions are :
- Am i correct ?
- is there any other files I need to change ?
- is there a way to use the override system to deal with the file create_account.php ?
Thanks a lot for your help
Re: Adding new fields to the Customer Details
my mistake :smile:
I absolutly can use the create_account.php file with the override system :
/includes/modules/my_template/create_account.php
This override system is really cool
Thanks a lot
Re: Adding new fields to the Customer Details
You can always download my contribution called: Additional Customers Fields available from my signature link. Since a couple of days, it has been recognized as a solid and flexible addon. :wink2:
Re: Adding new fields to the Customer Details
Hello, Im new to Zen and my knowledge of php isn't that great. I know this thread is kind of old but I was wondering if anyone could explain in plain English (pretend your talking to someone who has no clue about codes and such) of how to add the options the original poster questioned. My client has asked for this...
need for business registration info (eg tax ID) that can be cross checked and validated before giving permission for the viewer to see our prices and trade arrangements.
I have most of the shopping cart going except for this. Im stumped. Can anyone help us?
Thank you.
Re: Adding new fields to the Customer Details
Quote:
Originally Posted by
lmm314
Hello, Im new to Zen and my knowledge of php isn't that great. I know this thread is kind of old but I was wondering if anyone could explain in plain English (pretend your talking to someone who has no clue about codes and such) of how to add the options the original poster questioned. My client has asked for this...
need for business registration info (eg tax ID) that can be cross checked and validated before giving permission for the viewer to see our prices and trade arrangements.
I have most of the shopping cart going except for this. Im stumped. Can anyone help us?
Thank you.
Start with the new fields by downloading the mod mentioned above and see how they add the new felds.
Re: Adding new fields to the Customer Details
what mod are you talking about? :unsure: Remember...Im new to Zen, Im just a HTML web designer, no eccommerce expertise here :wink: Are you talking about following Oracles signature? I did click on his/her profile and got a 5 or 6 page thread of some unhappy people.
Re: Adding new fields to the Customer Details
Quote:
Originally Posted by
lmm314
what mod are you talking about?
http://www.zen-cart.com/index.php?ma...roducts_id=587