Jump to content

How to make company field NOT mandatory?


jotaeme

Recommended Posts

Hi everyone,

 

I've been trying to make the field company NOT mandatory when a user is creating his account. I checked several solutions such as go to my admin panel and then Clients>Address and then setting the mandatory fields. That's not working since if I check company field it does appear in my form as mandatory field and if I don't check it, it does not appear at all.

 

The other thing that I've tried was go to Customer.php classes and checked that company wasn't stablished as required (required' => true) and it didn't.

 

What can I do?

 

Thanks!

Edited by jotaeme (see edit history)
Link to comment
Share on other sites

I did not think it was mandatory.

 

Can you give prestashop version, country (may be set in country settings), do you have B2B switched on? Do you have a link for us to test?

Link to comment
Share on other sites

I did not think it was mandatory.

 

Can you give prestashop version, country (may be set in country settings), do you have B2B switched on? Do you have a link for us to test?

 

Ey! thanks for your answer.

 

Apparently it is. If I want it to appear in my registration form, the only way to get it done is through checking that option (Client/Address and then selecting company as mandatory) that indeed makes it visible but also makes it required.

 

Current version is 1.6.1.4, language: spanish. b2b has been desabled so far.

I can not provide an url since the shop is currently under maintenance. 

 

Thanks again!

Edited by jotaeme (see edit history)
Link to comment
Share on other sites

Go to: Admin back-end > Clients > Adresses -> Set required fields for this section

 

Yeah, by doing that I get exactly what I don't want. 

I do want the company field in my registration field but I dont want it to be mandatory.

 

Thanks!

Link to comment
Share on other sites

1. Uncheck 'company' in: Admin back-end > Clients > Adresses -> Set required fields for this section

 

2. Open file /themes/(theme name)/address.tpl and show me your code between:

{if $field_name eq 'company'}

and

{/if}

3. Open /classes/AdressFormat.php and check do you have 'company' in $requireFormFieldsList array.

 

4. Do you have some files in /override/classes or /override/controllers/front/ ?

Link to comment
Share on other sites

1. Uncheck 'company' in: Admin back-end > Clients > Adresses -> Set required fields for this section

 

2. Open file /themes/(theme name)/address.tpl and show me your code between:

{if $field_name eq 'company'}

and

{/if}

3. Open /classes/AdressFormat.php and check do you have 'company' in $requireFormFieldsList array.

 

4. Do you have some files in /override/classes or /override/controllers/front/ ?

 

1. Done

2. What I have in address.tpl

{if $field_name eq 'company'}
				<div class="form-group">
					<label for="company">{l s='Company'}</label>
					<input class="form-control validate" data-validate="{$address_validation.$field_name.validate}" type="text" id="company" name="company" value="{if isset($smarty.post.company)}{$smarty.post.company}{else}{if isset($address->company)}{$address->company|escape:'html':'UTF-8'}{/if}{/if}" />
				</div>
			{/if}

3. AddressFormat.php

public static $requireFormFieldsList = array(
        'firstname',
        'lastname',
        'address1',
        'city',
}

4. No

 

Thanks!

Link to comment
Share on other sites

In address I see as mandatory: first and last name, address, city, post code, country, state, phone number

In personal informations mandatory is: first and last name, e-mail, password

 

Where do you see 'company' field as mandatory?

 

Nowhere. I want company to show but as an optional field.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...