Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Making Company Field on Create Account Required

Making Company Field on Create Account Required

Locked

Views: 7,699

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
6 Jun 2006, 12:34 AM
#1
pioupioun avatar

pioupioun

New Zenner

Join Date:
Jun 2006
Posts:
31
Plugin Contributions:
0

Making Company Field on Create Account Required

I was wondering if anyone could tell me how I can change the Company field on the Create Account page to be required, I can't seem to find how to do it in the admin panel.... thanks!

6 Jun 2006, 5:33 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Making Company Field on Create Account Required

includes/modules/YOURTEMPLATE/create_account.php
line 40 contains:```php
if (ACCOUNT_COMPANY == 'true') $company = zen_db_prepare_input($_POST['company']);

change that one line to these several lines:```php
  if (ACCOUNT_COMPANY == 'true') {
    $company = zen_db_prepare_input($_POST['company']);
    if (strlen($company) < 4) {
      $error = true;
      $messageStack->add('create_account', ENTRY_COMPANY_NAME_ERROR);
    }
  }

And add a definition for your error message to your
includes/languages/YOURTEMPLATE/english.php :

define('ENTRY_COMPANY_NAME_ERROR', 'Please enter a company name.');

Note: the example test above checks that the company name entered is at least 4 characters long.

6 Jun 2006, 5:14 PM
#3
pioupioun avatar

pioupioun

New Zenner

Join Date:
Jun 2006
Posts:
31
Plugin Contributions:
0

Re: Making Company Field on Create Account Required

Ok, thank you very much that worked great. Now, this may seem ridiculous, but I can NOT figure out how to get the red "Required field" asterisk to appear next to company name. Any hints? Thanks again!

7 Jun 2006, 4:16 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Making Company Field on Create Account Required

That's in the includes/languages/YOURTEMPLATE/english.php

  define('ENTRY_COMPANY_TEXT', '');

Just add a * or whatever you want in the quotes.

7 Jun 2006, 10:16 PM
#5
pioupioun avatar

pioupioun

New Zenner

Join Date:
Jun 2006
Posts:
31
Plugin Contributions:
0

Re: Making Company Field on Create Account Required

Found it! Thanks very much!:yes:

29 Jun 2006, 2:24 PM
#6
dcfxking avatar

dcfxking

New Zenner

Join Date:
Jun 2006
Location:
Boston, MA
Posts:
80
Plugin Contributions:
0

Re: Making Company Field on Create Account Required

I got the * to show up on the create account form however I edited the code as stated in my : /includes/modules/create_account.php file but it does not do anything when company field is left blank.

I did not have a creat_account.php file in my /includes/modules/classic foler.

Do I need to do anything to: templates/template_default/templates/tpl_modules_create_account.php ?

Is there anything I can do to correct this?

29 Jun 2006, 10:19 PM
#7
jasbor avatar

jasbor

New Zenner

Join Date:
Jun 2006
Posts:
17
Plugin Contributions:
0

Re: Making Company Field on Create Account Required

I tried to make the company field required, but it doesnt require the company field. Is this snipit good for zen 1.30?
Not getting error or anything, works like default.
I do have the * showing next to the field, but thats about it.

18 Feb 2007, 1:08 PM
#8
vik007 avatar

vik007

Zen Follower

Join Date:
Feb 2007
Posts:
201
Plugin Contributions:
0

Re: Making Company Field on Create Account Required

how can i make the address field optional? As i wont really be needing there address info..i want customers to make it a option to enter in there address.

18 Feb 2007, 4:36 PM
#9
meltdown avatar

meltdown

Totally Zenned

Join Date:
Jun 2006
Location:
My family and I live in Brighton, England
Posts:
947
Plugin Contributions:
0

Re: Making Company Field on Create Account Required

jasbor:

I tried to make the company field required, but it doesnt require the company field. Is this snipit good for zen 1.30?
Not getting error or anything, works like default.
I do have the * showing next to the field, but thats about it.

I believe the following will force the Company field to be mandatory:

Go to admin/configuration/minimum values and enter a number greater than 0 in "Company."

Good luck!

Tim

21 Oct 2010, 3:31 PM
#10
k8ee avatar

k8ee

New Zenner

Join Date:
Sep 2009
Location:
Ontario, Canada
Posts:
23
Plugin Contributions:
0

Re: Making Company Field on Create Account Required

I know this is an old thread, but thanks DrByte, your solution was perfect.

:clap: