Wednesday, November 11, 2009

Removing required fields in zen cart user sign up page when they create an account

To remove most of the fields in the 'Create an Account' page, this can be achieved by disabling them one by on in the admin module under the menu:

Configuration->Customer details

One that caught me out was the Mr/Ms field for account gender. Which was strangely Called 'Email Salutation.'

However, there are other stubborn fields such as:

Telephone Number
City
State
Post Code
Street Address
Country (really stubborn)


This is a hack, but it did the job. Basically what I did to get rid of these was:

1. Delete/comment out any code inside the file that is not needed:

'templates/template_default/templates/tpl_modules_create_account.php'

Make sure that the layout of the page is not broken.

2. In the admin module of the shop, click on Configuration->Minimum Values, and set the minimum values for such deleted fields to 0.

3. Then you're left with the stubborn field 'Country'

To get rid of that (hack again), open the file:

'includes/modules/create_account.php'

Roughly around line 225, you will see the following code, which needs to be commented out:

if ( (is_numeric($country) == false) || ($country < 1) ) {
$error = true;
$messageStack->add('create_account', ENTRY_COUNTRY_ERROR);
}


4. Finally, edit the following file, so that the 'Your Account Has Been Created' page doesn't look silly:


'templates/template_default/templates/tpl_create_account_success.php'


I hope this helps!

5 comments:

  1. Anonymous10:38 PM

    Thank You! That was perfect!

    ReplyDelete
  2. Thanks for the advice. I followed your post and implemented all the changes and all was fine, until I did a test account. When I went to the customer section in admin I got 4 errors

    QUOTE

    Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/resellr1/public_html/resellrightsshop.com/disguised_admin/customers.php on line 1099

    Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/resellr1/public_html/resellrightsshop.com/disguised_admin/customers.php on line 1101

    Warning: reset() [function.reset]: Passed variable is not an array or object in /home/resellr1/public_html/resellrightsshop.com/disguised_admin/includes/classes/object_info.php on line 29

    Warning: Variable passed to each() is not an array or object in /home/resellr1/public_html/resellrightsshop.com/disguised_admin/includes/classes/object_info.php on line 30

    END QUOTE

    I presume this is because I have disabled the country dropdown etc. I cannot edit nor delete the customer as the fields that I have modified to anable a quick account creation are required fields within the admin core when editing or deleting a customer.

    Have I done something drastically wrong? Further advice would be greatly appreciated.

    ReplyDelete
  3. ah! i just realised that i get the same errors.

    i do my customer management through SQL/database directly though. other than that, everything seems to be working just fine.

    i'll add a solution here in a few days when i look at it again.

    ReplyDelete
  4. Thanks Mark, I'll check back when you have had chance to have a look. I am also trying to rok out a solution but I'm not very webtech yet.

    ReplyDelete
  5. Anonymous8:04 AM

    Did this and the only required field are email address and password to create an account. But why isn't the address saved for the customer after account creation?

    ReplyDelete