- Posts: 128
- Thank you received: 3
Different form fields for guest and user in checkout
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.3.24
I want to use the switcher in the configuration for the checkout so people have the choice to checkout as a guest or create an account during registration. The problem is if they checkout as guest I need their address fields, email, and DOB to be required. If they checkout as a user and want to register an account I need username, password, address fields, email, DOB, and a couple other fields to be required. Currently when I enable the switcher the same amount of fields are required in the guest checkout as the registration. How can I have it where I only have certain fields in the guest checkout? Does this require a custom plugin or something?
Please Log in or Create an account to join the conversation.
The guest checkout will revmoe the username and password fields.
There is no setting to have different custom address fields between the registration and the guest checkout.
What you could do is to disable the custom address fields and instead use custom order fields.
With them, you can restrict them by user group thanks to the "access level" setting. That way, you can set the fields you don't want for guests as only for the "registered" user group.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
It depends the shipping methods you're using ; but yes, that's best to have the basis address fields (name, street, postcode, state, country) in order to get precise quote from dynamic shipping methods (ups, usps, fedex, canadapost) and some payment plugin might need to have these details too.
Afterwards, a guest account or a regular account would have access to the address edition within the checkout.
For sure a regular account will have the possibility to login later and access to the user control panel, see his order history, manage his addresses, etc.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
You could yes, but that won't help. Even if you don't display the fields, the registration/guest checkout systems will check the fields if they are required and if they are missing, it won't accept it.
So you would also have to modify the code in administrator/components/com_hikashop/classes/user.php and/or administrator/components/com_hikashop/classes/field.php
But it won't be easy.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Sorry but we don't understand what you mean by "work like the username and password fields do?".
Can you precise your idea ?
Awaiting news from you.
Regards
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Ok so you mean to don't display in the guest checkout form, I think that you can use some css command with display: none; in the guest checkout.
Something like this :
See this tutorial to see how to proceed to add custom css
Now, if your custom field are required that will leads to something more advance like an override view to prevent this field to "really" don't displayed in the view, as Nicolas told in his previous message.
See this tutorial to learn more about HikaShop override view.
The last solution if the custom is too advance for you, you can contact one of our partner .
Hope that you will achieved what you need.
Regards
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
By an override view of checkout / show_block_login view that will required some html & php knowledge.
For the theory, you have to add an algorithm in order to prevent displaying unwanted custom fields when you are in guest html part.
See this documentation to learn more about HikaShop override system.
Regards
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I suggest you to check jquery validator plugin. You then could create custom fields you need and show/hide them based on checked form.... you can set required whenever you need and also custom error messages under every input. It looks much better insteed those annoying joomla messages under checkout.
I have added same thing what you are looking for using that plugin and it looks and works much better....
Thanks
Please Log in or Create an account to join the conversation.
monosnap.com/file/X4x5kcPcfv0ssFLZvazVx0HrSLVmCI
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Ah, I had missed the fact that you were on HikaShop 2.6.1.
In that case, it's the file components/com_hikashop/views/checkout/view.html.php where you'll find that.
Please Log in or Create an account to join the conversation.