what is the proper way to remove an address field

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
I don't want to ask the customer for a company.  In _CreateOrUpdateAddress.cshtml I found

@if (!Model.CompanyDisabled){...} and removing the negation so I have  @if (Model.CompanyDisabled){...} works but does not  feel like the correct MVC way of doing things.  One alternative is  in the AddressModel.cs constructor to just add

CompanyDisabled = False;

This feels a little better, but I'm still not sure.  

What is the correct way to do this?  Thanks.
12 years ago
in nop 2.1 Configuration>Settings>Customer Settings right there you can untick company.
12 years ago
wxDevelopment wrote:
in nop 2.1 Configuration>Settings>Customer Settings right there you can untick company.


With all respect, I believe that those fields control the display of the customer registration form.  I'm trying to remove the company (and fax number) input fields in guest checkout...shipping address (and billing address).
12 years ago
cds4126 wrote:
in nop 2.1 Configuration>Settings>Customer Settings right there you can untick company.

With all respect, I believe that those fields control the display of the customer registration form.  I'm trying to remove the company (and fax number) input fields in guest checkout...shipping address (and billing address).


If you want to hide those fields under certain circumstances then the best approach is to create a new property on the model, something like "Is<Specific>FieldDisabled". Inside of the controller write the logic that is required to populate the new property and make use of it in the view. If you're looking to disable only on guest users you can use the following code inside the controller "_workContext.CurrentCustomer.IsRegistered()". I believe IsRegistered() is an extension method.
12 years ago
cds4126 wrote:
With all respect, I believe that those fields control the display of the customer registration form.  I'm trying to remove the company (and fax number) input fields in guest checkout...shipping address (and billing address).


In your first post you didn't ask anything about guest checkout.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.