Zen Cart Logo
Forums / General Questions / Add a field into create account

Add a field into create account

Views: 51,600

Results 121 to 138 of 138
28 Sep 2011, 7:05 PM
#121
idc1 avatar

idc1

Zen Follower

Join Date:
Jul 2011
Posts:
139
Plugin Contributions:
0

Add a field into create account

CraigW:

Inserted:
<label class="inputLabel" for="taxid"><?php echo ENTRY_TAXID_NUMBER; ?></label>

<?php echo zen_draw_input_field('taxid', $account->fields['customers_taxid'], 'id="taxid"') . (zen_not_null(ENTRY_TAXID_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_TAXID_NUMBER_TEXT . '</span>': ''); ?> <br class="clearBoth" />

How do I make this readonly? If I do zen_draw_hidden_field(....
it hides it. I've tried readonly, googling for the answer, but I haven't come up with the correct coding.

Thanks

4 Oct 2011, 8:21 PM
#122
jackie_taferner avatar

jackie_taferner

Totally Zenned

Join Date:
Jun 2009
Location:
Orange County, California
Posts:
547
Plugin Contributions:
3

Re: Add a field into create account

Try adding readonly like so:

fields['customers_taxid'], 'id="taxid" [B][I]readonly="readonly"[/I][/B]')
2 Dec 2011, 5:17 PM
#123
newbie76 avatar

newbie76

Zen Follower

Join Date:
Aug 2009
Posts:
100
Plugin Contributions:
0

Re: Add a field into create account

Hi Jackie,

A couple of snags I could use some advice / help on after installing your mod please.

I tried installling this mod and all seemed to go fine, the field shows up as required on the registration page and the box shows in the admin area

However

When signing up a test account, I fill in this field then check in ym admin and the field shows blank

but

when logged in as the test customer, I go to edit details and the field shows blank as if I hadn't filled it in (I did as it was set as a requirement)

but

if I add the extra info again, it then shows in both the customer test account and the admin page

Any ideas as to what could be causing it to require the information then lose it then need to be added again as this might be a tough one to explain to customers.

Also, the additional field on the registration page is not aligned left like the rest of the fields, is there nay way to realign this?

Also, what if I want to add more than one field (which I do once I have got it working)

Much appreciated mod and it's exactly what I'm lookign for if the above is possible and i can get the information to stay when input the first time

Thanks in advance

Gary

30 Jan 2012, 11:47 AM
#124
thevagr1 avatar

thevagr1

New Zenner

Join Date:
May 2009
Location:
Melbourne, Australia
Posts:
46
Plugin Contributions:
0

Re: Add a field into create account

THANK YOU for this mod...
Works like a charm on 1.5

Still the issues of making it a 'required' field. Getting the red * is fine.
Did that in your extrafields_defines.php
Now how to make it 11 numbers only. Not more not less.
I see there are lots of coding options from the beginning of this thread but as this module is different and has been changed not sure what to edit.
I altered the quantity in my php.admin from 32 to 11 but it hasnt made a difference.

Any ideas??

Also if I want to ad several different fields with this mod would I change everywhere you have _EXTRAFIELD to something else?

for example ENTRY_ABN , ENTRY_ABN_TEXT for example?

THanks in advance for any help and all help so far with this.

Ren

4 Apr 2012, 7:00 PM
#126
hockey2112 avatar

hockey2112

Zen Follower

Join Date:
Jun 2010
Posts:
204
Plugin Contributions:
0

Re: Add a field into create account

hockey2112:

Jackie,

Any input on how this mod could be modified to allow multiple extra fields... maybe 5 or 10 of them?

I was able to add the fields by duplicating all of the Extra Fields entries in the files and in the SQL. It works very nicely! The only issue now is that when I update any of those fields from the admin back-end, the data from extra field #10 automatically gets entered into #1's field, and the field that I edited does not change at all (for instance, if I update extra field #5, #10's info goes into #1's field and #5's changes are not saved at all). Any idea what would cause that? Maybe I missed a piece of code somewhere?

There are no issues with updating the fields via the front-end account login/profile area. Those updates work perfectly and the changes are reflected in the front-end profile and in the back-end admin customer lookup.

Here is my SQL. I can upload the files as well if that might help:

ALTER TABLE customers ADD customers_extrafield1 varchar(250) NOT NULL AFTER customers_fax;



ALTER TABLE customers ADD customers_extrafield2 varchar(250) NOT NULL AFTER customers_extrafield1;



ALTER TABLE customers ADD customers_extrafield3 varchar(250) NOT NULL AFTER customers_extrafield2;



ALTER TABLE customers ADD customers_extrafield4 varchar(250) NOT NULL AFTER customers_extrafield3;



ALTER TABLE customers ADD customers_extrafield5 varchar(250) NOT NULL AFTER customers_extrafield4;



ALTER TABLE customers ADD customers_extrafield6 varchar(250) NOT NULL AFTER customers_extrafield5;



ALTER TABLE customers ADD customers_extrafield7 varchar(250) NOT NULL AFTER customers_extrafield6;



ALTER TABLE customers ADD customers_extrafield8 varchar(250) NOT NULL AFTER customers_extrafield7;



ALTER TABLE customers ADD customers_extrafield9 varchar(250) NOT NULL AFTER customers_extrafield8;



ALTER TABLE customers ADD customers_extrafield0 varchar(250) NOT NULL AFTER customers_extrafield9;



INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Allergies? Please list here', 'DISPLAY_EXTRAFIELD1', 'true', 'Display "Allergies? Please list here" on account creation page', '5', '6', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());


INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Require Allergies? Please list here', 'EXTRAFIELD1_REQUIRED', 'true', 'Require Allergies? Please list here in account creation', '5', '7', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display Height', 'DISPLAY_EXTRAFIELD2', 'true', 'Display "Height" on account creation page', '5', '6', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());


INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Require Height', 'EXTRAFIELD2_REQUIRED', 'true', 'Require Height in account creation', '5', '7', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display Weight', 'DISPLAY_EXTRAFIELD3', 'true', 'Display "Weight" on account creation page', '5', '6', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());


INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Require Weight', 'EXTRAFIELD3_REQUIRED', 'true', 'Require Weight in account creation', '5', '7', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display Do you drink coffee? If so, how often?', 'DISPLAY_EXTRAFIELD4', 'true', 'Display "Do you drink coffee? If so, how often?" on account creation page', '5', '6', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());


INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Require Do you drink coffee? If so, how often?', 'EXTRAFIELD4_REQUIRED', 'true', 'Require Do you drink coffee? If so, how often? in account creation', '5', '7', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display Do you drink alcohol? If so, how often?', 'DISPLAY_EXTRAFIELD5', 'true', 'Display "Do you drink alcohol? If so, how often?" on account creation page', '5', '6', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());


INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Require Do you drink alcohol? If so, how often?', 'EXTRAFIELD5_REQUIRED', 'true', 'Require Do you drink alcohol? If so, how often? in account creation', '5', '7', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display Do you exercise? If so, how often?', 'DISPLAY_EXTRAFIELD6', 'true', 'Display "Do you exercise? If so, how often?" on account creation page', '5', '6', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());


INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Require Do you exercise? If so, how often?', 'EXTRAFIELD6_REQUIRED', 'true', 'Require Do you exercise? If so, how often? in account creation', '5', '7', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display Are you familiar with a vegan lifestyle?', 'DISPLAY_EXTRAFIELD7', 'true', 'Display "Are you familiar with a vegan lifestyle?" on account creation page', '5', '6', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());


INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Require Are you familiar with a vegan lifestyle?', 'EXTRAFIELD7_REQUIRED', 'true', 'Require Are you familiar with a vegan lifestyle? in account creation', '5', '7', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display How did you hear about us?', 'DISPLAY_EXTRAFIELD8', 'true', 'Display "How did you hear about us?" on account creation page', '5', '6', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());


INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Require How did you hear about us?', 'EXTRAFIELD8_REQUIRED', 'true', 'Require How did you hear about us? in account creation', '5', '7', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display Favorite Food', 'DISPLAY_EXTRAFIELD9', 'true', 'Display "Favorite Food" on account creation page', '5', '6', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());


INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Require Favorite Food', 'EXTRAFIELD9_REQUIRED', 'true', 'Require Favorite Food in account creation', '5', '7', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Display Favorite Passtime', 'DISPLAY_EXTRAFIELD0', 'true', 'Display "Favorite Passtime" on account creation page', '5', '6', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());


INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Require Favorite Passtime', 'EXTRAFIELD0_REQUIRED', 'true', 'Require Favorite Passtime in account creation', '5', '7', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());
4 Apr 2012, 7:21 PM
#127
hockey2112 avatar

hockey2112

Zen Follower

Join Date:
Jun 2010
Posts:
204
Plugin Contributions:
0

Re: Add a field into create account

One other question... how can we make it so that the extra fields are included in the customer search function in admin? I'd like to be able to search based on any of those custom fields.

7 Jun 2012, 4:15 PM
#128
pwithers avatar

pwithers

New Zenner

Join Date:
Jun 2012
Posts:
9
Plugin Contributions:
0

Re: Add a field into create account

Hi, I am quite new to zencart, and am trying to achieve what is explained in this thread. I have added the correct field to the database, edited the customers.php file but as soon as I alter the tpl_modules_create_account.php file, the whole registration form disappears and only leaves the login section.

The code I have added is displayed between the #####

<?php echo zen_draw_checkbox_field('newsletter', '1', $newsletter, 'id="newsletter-checkbox"') . '<label class="checkboxLabel" for="newsletter-checkbox">' . ENTRY_NEWSLETTER . '</label>' . (zen_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="alert">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?>
<br class="clearBoth" />
<?php } ?>

<?php echo zen_draw_radio_field('email_format', 'HTML', ($email_format == 'HTML' ? true : false),'id="email-format-html"') . '<label class="radioButtonLabel" for="email-format-html">' . ENTRY_EMAIL_HTML_DISPLAY . '</label>' .  zen_draw_radio_field('email_format', 'TEXT', ($email_format == 'TEXT' ? true : false), 'id="email-format-text"') . '<label class="radioButtonLabel" for="email-format-text">' . ENTRY_EMAIL_TEXT_DISPLAY . '</label>'; ?>
<br class="clearBoth" />
</fieldset>

##############################################

<fieldset>
<legend><?php echo '<strong>VAT EXEMPTION DECLARATION FORM</strong>'?></legend>
<?php echo 'Eligibility declaration by a disabled person' ?>

<label class="inputLabel" for="vatpurchasername"><?php echo Full name of Purchaser; ?></label>
<?php echo zen_draw_input_field('vatpurchasername', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_vatpurchasername', '40') . ' id="vatpurchasername"') . (zen_not_null(ENTRY_VATPURCHASERNAME_TEXT) ? '<span class="alert">' . ENTRY_VATPURCHASERNAME_TEXT . '</span>': ''); ?>
<br class="clearBoth" />
`
</fieldset>
#################################################################################
<?php
  if (CUSTOMERS_REFERRAL_STATUS == 2) {
?>
<fieldset>

<legend><?php echo TABLE_HEADING_REFERRAL_DETAILS; ?></legend>
<label class="inputLabel" for="customers_referral"><?php echo ENTRY_CUSTOMERS_REFERRAL; ?></label>
<?php echo zen_draw_input_field('customers_referral', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_referral', '15') . ' id="customers_referral"'); ?>
<br class="clearBoth" />
</fieldset>
<?php } ?>

Any help is much appreciated as I am really stuck on this and cant see what I am doing wrong.

19 May 2013, 1:59 AM
#129
caroleas avatar

caroleas

Totally Zenned

Join Date:
Feb 2009
Posts:
896
Plugin Contributions:
0

Re: Add a field into create account

Not sure if anyone is still monitoring this thread, but I am trying to add this module which would do exactly what I need. However, although I didn't encounter any error in the installation, the actual fields name do not appear in the account creation page. I still see :

  • EXTRA FIELDS instead of "Additional information"
  • Field #1 instead of "What program are you using?"
  • Comments instead of "Tell us how you use your current program"

Even though I edited the required files, and the correct "field names" appear if I click on the customer profile, in the registration, it does not show.

I installed the module on my 1.5.0 zencart. You can see it here: http://creationcassel.com/storetest
(as you can see, it is my test site :) )

Where may I be missing something?

1 Jun 2016, 2:39 PM
#130
csgodeimos avatar

csgodeimos

Zen Follower

Join Date:
May 2016
Posts:
191
Plugin Contributions:
0

Re: Add a field into create account

Need a little help here guys.

Followed the instructions given.

Tax ID can be seen in the database fine - https://gyazo.com/26d4fd8fae5ca1650b1e7549b2f9a0c8

But when I go to register a new customer it doesn't show - https://gyazo.com/89423ca1bb1715117c7f8438a0828fa8

Any help? No idea what I'm doing wrong? I read somewhere about tpl_modules_create_account.php but that doesn't exist in 1.5.5a / Sheffield Blue Responsive

16 Jun 2016, 8:38 PM
#131
jadzia avatar

jadzia

New Zenner

Join Date:
Aug 2013
Location:
Oregon
Posts:
4
Plugin Contributions:
0

Re: Add a field into create account

CSGODeimos:

Need a little help here guys.

Followed the instructions given.

Tax ID can be seen in the database fine - https://gyazo.com/26d4fd8fae5ca1650b1e7549b2f9a0c8

But when I go to register a new customer it doesn't show - https://gyazo.com/89423ca1bb1715117c7f8438a0828fa8

Any help? No idea what I'm doing wrong? I read somewhere about tpl_modules_create_account.php but that doesn't exist in 1.5.5a / Sheffield Blue Responsive

If you don't find tpl_modules_create_account.php in includes/templates/YOURTEMPLATE/templates/tpl_modules_create_account.php then you need to grab it out of includes/templates/template_default/templates/tpl_modules_create_account.php

16 Jun 2016, 8:44 PM
#132
jadzia avatar

jadzia

New Zenner

Join Date:
Aug 2013
Location:
Oregon
Posts:
4
Plugin Contributions:
0

Re: Add a field into create account

Tharina posted this in 2009 and I've followed the instructions to successfully add additional fields to the customer account registration in Zen Cart 1.5.5a.

Once piece that I did find is that the new fields were not showing up in the Admin section when I went to edit a customer. Tere is an IF statement in Admin/customers.php that requires you set the Fax Number to TRUE in your admin->Configuration->Customer Details.

BACKUP
0. Backup your database using PHPMyAdmin,
ALSO backup the affected files before making each change.
AFFECTED FILES TO BACKUP:
includes/modules/YOURTEMPLATE/create_account.php
includes/languages/YOURTEMPLATE/english.php
includes/templates/YOURTEMPLATE/templates/tpl_modules_create_account.php
Admin/customers.php
includes/templates/YOUR TEMPLATE/templates/tpl_account_edit_default.php
includes/modules/pages/account_edit/header_php.php
includes/languages/YOURTEMPLATE/english.php
includes/modules/pages/create_account/jscript_form_check.php
includes/modules/pages/account_edit/jscript_form_check.php
includes/modules/create_account.php

ADD TABLE TO DATABASE:
1. Go to PHPMyAdmin and select your database from the pulldown.

2. On the left sidebar of PHPMyAdmin click on the table "customers"

3. On the right side of the screen you will see all the fields like customers_telephone, customers_fax and so-on... Now scroll below this and you should see a way to add a field, in mine I saw:

The "Add" text box should contain "1", in the field(s) section, select the "At end of table" radio button, leave everything else as it is and then click the "GO" button.

This sent me to another page to name my field and stuff so I named it "customers_taxid" (no quotation marks).
Then I selected "VarChar" and a length of "32"(or whatever length in characters you want your new entry field),
Collation = (it was blank and I left it blank),
Attributed = (it was blank and I left it blank),
Null = NULL

Then I clicked "SAVE"

4. I then saw my new field in the table it was on the bottom of all the other ones that were previously there.

5. Close PHPMyAdmin

TO ADD FIELD FOR NEW CUSTOMERS:
6. Open file includes/modules/YOURTEMPLATE/create_account.php
(or if your template did not override this then simply use the one in modules folder)

7a. Now search for the following:

$fax = zen_db_prepare_input($_POST['fax']);

DO NOT ERASE THE ABOVE CODE. PUT THE NEW CODE DIRECTLY UNDER THE CODE ABOVE, HERE IS THE EXTRA LINE OF CODE:

$taxid = zen_db_prepare_input($_POST['taxid']);

7b. Next search for:

'customers_fax' => $fax,

DO NOT ERASE THE ABOVE CODE. PUT THE NEW CODE DIRECTLY UNDER THE CODE ABOVE, HERE IS THE EXTRA LINE OF CODE:

'customers_taxid' => $taxid,


8a. Now open file: includes/languages/YOURTEMPLATE/english.php
(or if your template did not override this then simply use the one in languages folder)

8b. Search for the following code:

define('TABLE_HEADING_PHONE_FAX_DETAILS', 'Additional Contact Details');

this is the heading for the section on the form that houses the telephone number and fax number inputs, I changed it to this:

define('TABLE_HEADING_PHONE_FAX_DETAILS', 'Additional Details');

this allowed my heading to say "Additional Information" instead of the original text of "Additional Contact Details" *

8c. Also add the following code:

define('ENTRY_TAXID_NUMBER', 'TAX ID:');

define('ENTRY_TAXID_NUMBER_TEXT', '');

to be tidy, this entry should be added to where all the other "define('ENTRY..." statements are.


9. Now open file: includes/templates/YOURTEMPLATE/templates/tpl_modules_create_account.php

9a. Now search for the following code:

<?php
if (ACCOUNT_FAX_NUMBER == 'true') {
?>
<br class="clearBoth" />
<label class="inputLabel" for="fax"><?php echo ENTRY_FAX_NUMBER; ?></label>
<?php echo zen_draw_input_field('fax', $account->fields['customers_fax'], 'id="fax"') . (zen_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?>
<?php
}
?>

DO NOT ERASE THE ABOVE CODE, ONLY PASTE THE NEW LINES OF CODE BELOW THE CODE ABOVE, here is the new code to paste under the code above:

<br class="clearBoth" />
<label class="inputLabel" for="taxid"><?php echo ENTRY_TAXID_NUMBER; ?></label>
<?php echo zen_draw_input_field('taxid', $account->fields['customers_taxid'], 'id="taxid"') . (zen_not_null(ENTRY_TAXID_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_TAXID_NUMBER_TEXT . '</span>': ''); ?>


TO ADD FIELD UNDER ADMIN FOR EDITING EXISTING CUSTOMERS:
10. Now go to Admin/customers.php and edit this file.
(editing this file will allow you to see the taxid field when you edit customer information in the administrative section)

11. Search for:

$customers_fax = zen_db_prepare_input($_POST['customers_fax']);

DO NOT ERASE THE ABOVE CODE. PUT THE NEW CODE DIRECTLY UNDER THE CODE ABOVE, HERE IS THE EXTRA LINE OF CODE:

$customers_taxid = zen_db_prepare_input($_POST['customers_taxid']);

11a. Now search for:

'customers_fax' => $customers_fax,

DO NOT ERASE THE ABOVE CODE. PUT THE NEW CODE DIRECTLY UNDER THE CODE ABOVE, HERE IS THE EXTRA LINE OF CODE:

'customers_taxid' => $customers_taxid,

11b. Now search for:

a.entry_country_id, c.customers_telephone, c.customers_fax,

REPLACE THIS CODE WITH THE FOLLOWING CODE BELOW:

a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_taxid,

(ALL I DID WAS ADD "c.customers_taxid," TO THE END OF THE EXISTING CODE.)

11c. Now search for:

<tr>
<td class="main"><?php echo ENTRY_FAX_NUMBER; ?></td>
<td class="main">
<?php
if ($processed == true) {
echo $cInfo->customers_fax . zen_draw_hidden_field('customers_fax');
} else {
echo zen_draw_input_field('customers_fax', $cInfo->customers_fax, zen_set_field_length(TABLE_CUSTOMERS, 'customers_fax', 15));
}
?>
</td>
</tr>

DO NOT ERASE THIS CODE SIMPLY GO DIRECTLY UNDER THIS CODE AND ADD IN THE FOLLOWING CODE:

<tr>
<td class="main"><?php echo ENTRY_TAXID_NUMBER; ?></td>
<td class="main">
<?php
if ($processed == true) {
echo $cInfo->customers_taxid . zen_draw_hidden_field('customers_taxid');
} else {
echo zen_draw_input_field('customers_taxid', $cInfo->customers_taxid, zen_set_field_length(TABLE_CUSTOMERS, 'customers_taxid', 15));
}
?>
</td>
</tr>

12) In the file \includes\templates\<YOUR TEMPLATE>\templates\tpl_account_edit_default.php (it wasn't there for us so we copy-pasted it from the template_default folder)

Right after:
<label class="inputLabel" for="fax"><?php echo ENTRY_FAX_NUMBER; ?></label>
<?php echo zen_draw_input_field('fax', $account->fields['customers_fax'], 'id="fax"') . (zen_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?>
<br class="clearBoth" />

Inserted:
<label class="inputLabel" for="taxid"><?php echo ENTRY_TAXID_NUMBER; ?></label>
<?php echo zen_draw_input_field('taxid', $account->fields['customers_taxid'], 'id="taxid"') . (zen_not_null(ENTRY_TAXID_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_TAXID_NUMBER_TEXT . '</span>': ''); ?>
<br class="clearBoth" />

13) In the file \includes\modules\pages\account_edit\header_php.php:

a) After:
$fax = zen_db_prepare_input($_POST['fax']);
Inserted:
$taxid = zen_db_prepare_input($_POST['taxid']);

b) After:
array('fieldName'=>'customers_fax', 'value'=>$fax, 'type'=>'string'),
Inserted:
array('fieldName'=>'customers_taxid', 'value'=>$taxid, 'type'=>'string'),

c) Within the array:
$account_query = "SELECT customers_gender, customers_firstname, customers_lastname,
customers_dob, customers_email_address, customers_telephone,
customers_fax, customers_email_format, customers_referral
FROM " . TABLE_CUSTOMERS . "
WHERE customers_id = :customersID";

Added customers_taxid, as follows:
$account_query = "SELECT customers_gender, customers_firstname, customers_lastname,
customers_dob, customers_email_address, customers_telephone,
customers_fax, customers_taxid, customers_email_format, customers_referral
FROM " . TABLE_CUSTOMERS . "
WHERE customers_id = :customersID"; 

Good luck!

27 Apr 2017, 3:16 PM
#133
zapme1 avatar

zapme1

Zen Follower

Join Date:
Jan 2011
Location:
Ohio
Posts:
114
Plugin Contributions:
0

Re: Add a field into create account

Hi All,

I know this is an old topic, but as I needed additional fields on my create account page, this MOD seemed perfect....
I installed and all new fields display in their proper places both in catalog & admin, and also seem to work fine when data is entered during registration.....

All good so far... BUT!

Now, one field (company name) now "does not write to the database! It has been working for years now, and as I went back over all of the extrafields MOD files, I could not see a relation to the company name field, and all looks good......

Questions.....

  1. Which file actually "inserts" the posted data from the Create Account page to the DB?
  2. Any ideas how installing this MOD could stop another field from posting to the DB?

Thanks!

27 Apr 2017, 4:09 PM
#134
jackie_taferner avatar

jackie_taferner

Totally Zenned

Join Date:
Jun 2009
Location:
Orange County, California
Posts:
547
Plugin Contributions:
3

Re: Add a field into create account

@zapme1 it's really hard to say without seeing the files. It really could be any file in the installation causing the problem.

Does this issue only happen on Creating Account, or does happen on Editing Account as well?
Did you ever customize the files prior to installing this mod?
Did you copy the exact files from the module, or did you merge them into your existing files?
What version of ZenCart are you using?

27 Apr 2017, 5:05 PM
#135
zapme1 avatar

zapme1

Zen Follower

Join Date:
Jan 2011
Location:
Ohio
Posts:
114
Plugin Contributions:
0

Re: Add a field into create account

jackie.taferner:

@zapme1 it's really hard to say without seeing the files. It really could be any file in the installation causing the problem.

Does this issue only happen on Creating Account, or does happen on Editing Account as well?
Only on Creating Acct... If I edit the acct then the info is written to the DB....

Did you ever customize the files prior to installing this mod?
My site is heavily modified over the years..... Only modified Field Names & added a dropdown.... All seems to work tho...

Did you copy the exact files from the module, or did you merge them into your existing files?
Merged into existing files...

What version of ZenCart are you using?
1.3.9h

Hi Jackie and thanks for the reply!

I answered your questions in Red above.....

UPDATE:
I back-tracked and restored my original files one-by-one until my issue vanished and narrowed it to a single file from the MOD.....

/includes/modules/MY_TEMPLATE/create_account.php

This file "Was Not" existing in this folder before installing this MOD, so nothing has been modified in the file, so I'm confused how this is causing "NULL" to be entered in another fields DB slot???

Any ideas?

27 Apr 2017, 5:13 PM
#136
jackie_taferner avatar

jackie_taferner

Totally Zenned

Join Date:
Jun 2009
Location:
Orange County, California
Posts:
547
Plugin Contributions:
3

Re: Add a field into create account

Ok, thanks for this info!

Please grab your copy of this file:
/includes/modules/create_account.php

Then merge the changes with this file:
/includes/modules/MY_TEMPLATE/create_account.php

That second file overwrites the first, so if you had changes in the other file, they would not carry over.

Let me know if that works! If not, please copy the contents of that file here so I can have a look.

27 Apr 2017, 5:45 PM
#137
zapme1 avatar

zapme1

Zen Follower

Join Date:
Jan 2011
Location:
Ohio
Posts:
114
Plugin Contributions:
0

Re: Add a field into create account

jackie.taferner:

Ok, thanks for this info!

Please grab your copy of this file:
/includes/modules/create_account.php

Then merge the changes with this file:
/includes/modules/MY_TEMPLATE/create_account.php

That second file overwrites the first, so if you had changes in the other file, they would not carry over.

Let me know if that works! If not, please copy the contents of that file here so I can have a look.

YAY!!! That Worked!!!

There wasn't much to merge between the 2-files, and I still don't see what caused the issue, but the important thing is that It Works!

Thank You So Much For Your Help, Jackie! :-)

27 Apr 2017, 5:47 PM
#138
jackie_taferner avatar

jackie_taferner

Totally Zenned

Join Date:
Jun 2009
Location:
Orange County, California
Posts:
547
Plugin Contributions:
3

Re: Add a field into create account

Great! Glad I could help :)