Skip to main content

Different form fields for guest and user in checkout

9 years 6 months ago #267889 by deuce4884
-- HikaShop version -- : 2.6.1
-- 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.

9 years 6 months ago #267897 by nicolas
Hi,

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.

9 years 6 months ago #267929 by deuce4884
Don't I need the address fields enabled for calculating shipping rates in the checkout and also for if a registered user wants to manage their addresses?

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

9 years 6 months ago #267930 by Jerome
Hello,

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.

9 years 6 months ago #268147 by deuce4884
If I create a new view say named 'guestform' under the com_users/registration directory can I use hikashop_getLayout to display the view? I see in the checkout/login view the code hikashop_getLayout('user','registration',$params,$js), but doesn't that display the default view in the com_users/registration directory?

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

9 years 6 months ago #268149 by nicolas
Hi,

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.

8 years 6 months ago #291639 by deuce4884
The fields I really need displayed on registration but not on guest are custom user fields not address fields. Can I not set these fields to work like the username and password fields do?

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

8 years 6 months ago - 8 years 6 months ago #291657 by Philip
Hello,

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
Last edit: 8 years 6 months ago by Philip.

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

8 years 6 months ago #291705 by deuce4884
I have specific custom user fields that need to be included in the checkout registration form but not included in the guest checkout form behaving exactly like the username and password fields.

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

8 years 6 months ago - 8 years 6 months ago #291729 by Philip
Hello,

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 :
Code:
.guest_class_form .custom_field_class { display: none; }

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
Last edit: 8 years 6 months ago by Philip.

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

8 years 6 months ago #291789 by deuce4884
I know how to do CSS for the fields. How do I handle that the fields are required in the registration checkout form and I don't want them to be in the guest checkout form?

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

8 years 6 months ago - 8 years 6 months ago #291818 by Philip
Hello,

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
Last edit: 8 years 6 months ago by Philip.

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

8 years 6 months ago #291983 by deuce4884
Which view or file writes the javascript function displayRegistration()? I've looked everywhere I can think of and I can't find it. Thanks

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

8 years 6 months ago #291986 by kyratn
Hi,

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.

8 years 6 months ago #292022 by nicolas
The displayRegistration function is located in the file "show_block_login" that you can edit via the menu Display>Views:
monosnap.com/file/X4x5kcPcfv0ssFLZvazVx0HrSLVmCI

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

8 years 6 months ago #292051 by deuce4884
i don't have a "show_block_login" view

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

8 years 6 months ago #292075 by nicolas
Hi,

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.

Time to create page: 0.110 seconds
Powered by Kunena Forum