Help replacing username in checkout registration

  • Posts: 116
  • Thank you received: 7
  • Hikashop Business
3 years 1 month ago #330679

-- HikaShop version -- : 4.4.1
-- Joomla version -- : 3.9.25
-- PHP version -- : 7.4

I am modifying sub_block_login_registration to replace the username field. I am trying to fill the field value with the Email address (we already use Email for login, but I realize the J! requires a unique username, so this seems to be the safest method other than possible creating a random username based on the email address like the J! Name field does in Hikashop).

Either way, I need help with the best way to manipulate the username field after the user enters the Email address on the form.

If there is a better way to omit the username field from the process, I couldn't find it. If we use Simplified Registration with/without password, the Name field isn't available, and the Name field gets populated with the left-of-@ portion of the Email address provided.

Thanks!

EDIT: javascript! ... maybe I over complicated things a bit, so I've hidden the label/field and used javascript/onchange. But is this where/how I should be doing it? It would be nice to have an option to either randomize this, or set to email, etc. and hide since we can already do something similar with the simplified registration option.

Last edit: 3 years 1 month ago by stratacorps.

Please Log in or Create an account to join the conversation.

  • Posts: 81509
  • Thank you received: 13064
  • MODERATOR
3 years 1 month ago #330698

Hi,

You have two ways to go about it:
- like you did, you go with the normal registration, hide the username field with CSS and add a bit of javascript with an onchange attribute on the email input field in sub_block_login_registration to automatically set the value of the username field with the value entered in the email email.
- you use the 'Simplified Registration with/without password' mode and modify sub_block_login_registration to display the name field. That way, it will be taken into account instead of generating it from the email field. That's simplier as it doesn't require javascript or writting any code, just removing the PHP check around the name input field.

Please Log in or Create an account to join the conversation.

  • Posts: 116
  • Thank you received: 7
  • Hikashop Business
3 years 1 month ago #330742

Thank you so much...I did the first one in testing, but the 2nd choice is better. I'm glad I asked.

The following user(s) said Thank You: Philip

Please Log in or Create an account to join the conversation.

Time to create page: 0.059 seconds
Powered by Kunena Forum