Boolean Custom Field default value

  • Posts: 127
  • Thank you received: 6
5 years 9 months ago #303260

-- HikaShop version -- : 4.01
-- Joomla version -- : 3.6.5
-- PHP version -- : 7.2

Hello
I have a Custom Field in the Users table - a simple Yes / No option.
I have set the default value to Yes, but, when a new User is created the field always is set at No.

I cannot see what the problem is or how to resolve - it seems so simple...

Attachments:

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

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
5 years 9 months ago #303269

Hello,

I had created myself a user custom filed by using your settings, and wasn't able to reproduce and see your issue.
Can you provide a step by step in order to allow us to reproduce the context, don't forget to detailed everything and precise where you see a default Boolean set by default to "no"

Awaiting news from you
Regards

Last edit: 5 years 9 months ago by Philip.

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

  • Posts: 127
  • Thank you received: 6
5 years 9 months ago #303278

Merci Philippe
1. Attached the field settings list...



2. And the field details...


3. I create a new user from the back-end...


4. I check the new user's details in Hikashop...


For some reason the Invite For Review field shows "No", but the default setting shows as "Yes".
Je suis un peu confus...

Checking the front end, the new user also has their Subscribe to Newsletter set to True, yet the default is False - also a little strange...

Last edit: 5 years 9 months ago by Bobwales.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 9 months ago #303280

Hi,

It's actually not a problem of the fact that the custom field is a boolean custom field. you would have the same issue with any kind of custom user field with a default value.
That's because you create the user from the backend and on the backend form to create the user, these custom user fields don't show up so their default value cannot be initialized.
However, if you test again by creating a user from the HikaShop registration form on the frontend, you shouldn't have the problem as you will see the custom fields on the registration form.
I suppose that it is why Philippe didn't had the problem since he must have tried to reproduce by creating a user from the frontend, since that's what 99% of the merchants care about.
Now we could potentially add the capability to set the default value when creating the user from the backend but that's not something that easy to add.

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

  • Posts: 127
  • Thank you received: 6
5 years 9 months ago #303307

Thanks for looking Nicolas.
It does happen also from the front end, both the custom field and the subscribe field too.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 9 months ago #303319

Hi,

You mean even when you register through the HikaShop registration form ? (I'm not talking about joomla's since the fields don't appear on Joomla's registration form either)

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

  • Posts: 127
  • Thank you received: 6
5 years 9 months ago #303333

Yes Nicolas, exactly that.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 9 months ago #303335

Hi,

And are you sure that you turned on the "frontend" display setting of your custom user fields so that they can display on the frontend ? Otherwise, they will be ignored like when you create a user from the frontend.

Last edit: 5 years 9 months ago by nicolas.

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

  • Posts: 127
  • Thank you received: 6
5 years 9 months ago #303379

Yes Nicolas - just tried that way again and took screen shots to show you...
But anyway, we would not want this field to appear on the user profile. This is a field just for our back-end use.





And you will notice that although Subscribe to Newsletter is set default = No, it appears as checked, which is not as intended.

Hope this helps - I think I have correctly understood how to configure these fields.

EDIT: Just updated to Joomla 3.9.2 from 3.6.5, but sorry, that didn't fix this issue. (PHP 7.2.14 HKShop 4.0.1)

Attachments:
Last edit: 5 years 9 months ago by Bobwales.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
5 years 9 months ago #303385

Hello,

Nicolas wrote :

And are you sure that you turned on the "frontend" display setting of your custom user fields so that they can display on the frontend ?

And regarding your screenshot, the field "invite to review" IS displayed in the front-end, we can see the green checkmark on the column just after the ordering column.

So the field is displayed in the front-end because it is configured as well.
But your screenshot is showing the edition of the profile ; not the registration. Which mean that we can't deduce anything from that except that when you edit a profile, it load the current saved data.

For that part, Nicolas already gave you the answer :

That's because you create the user from the backend and on the backend form to create the user, these custom user fields don't show up so their default value cannot be initialized.


For the registration, since we do not have any details about the issue (nor the kind of registration you're using ; because it might be something which is not the HikaShop registration form, so something which might not handle the HikaShop fields).

Afterwards, regarding the newsletter ; I'm afraid that is not related to HikaShop stuff but to your newsletter component.
Please understand that we do only provide support for our components.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 127
  • Thank you received: 6
5 years 9 months ago #304045

Thanks for your reply Jerome
The screen shots show the results of Nocolas' suggestion. He suggested I tried "Show on Front End", so I did and then gave Screenshots to show the results of his suggestion. The user was created on the Front End also, as Nicolas suggested.

You can see that new user has their Invite-For-Review setting to "No", whilst the settings for that field default = "Yes".

So, it doesn't make any difference Front End or Back End user creation, Show on Front End or Hide on Front End - the default setting is ignored (which is a pain).

And yes, we do use the Hikashop registration form.
As for the newsletter setting I will follow up elsewhere, of course.

So, not sure what to try next? Your help is always appreciated.
Thanks, Bob

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 9 months ago #304051

Hi,

We're not able to reproduce the problem on our end.
I wanted to look at the issue on your website, however, I don't see the custom field on your checkout registration form:
monosnap.com/file/AoHevxBBQGGzQTMph1RLDd8HMEScbJ
And when I try to access the registration form page, I see the registration form page of Joomla, not HikaShop's, as you didn't activate the Redirect Joomla registration to HikaShop plugin via the Joomla plugins manager:
monosnap.com/file/8OxRfcNmH8YkGM9B9OgT0pI5G6015N

Note that the default value of a custom field is the default value used to initialize the custom field when it is displayed in a form.
If you create the element through another mean than a form where the custom field is displayed, then the default value won't be set.
That goes for users but also for any other custom field.
For example, if you have a custom order field with a default value but you click on the "new" button of the orders listing in the backend, the default value won't be set as the custom field won't display through that process. It would however if you configure the custom field to display through the checkout (which is usually the case for custom order fields).
So if you create the user through the Joomla user manager in the backend, through the joomla user registration form of the frontend, or even if you created the user account through the HikaShop registration form BEFORE you configured the custom field or its default value, then you won't see the default value when you edit the user profile.

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

  • Posts: 127
  • Thank you received: 6
5 years 9 months ago #304067

Thanks Nicolas.
Your explanation makes perfect sense and I do appreciate your time.
BUT, I do have the Redirect To Hikashop Plugin enabled... So I cannot explain why both checkout and page use the Joomla Registration component. The plugin is version 4.02, so quite new.

You do still have access to the site if you wish to confirm.

This message contains confidential information

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 8 months ago #304107

Hi,

I checked your settings.
All your custom user fields have the "frontend" setting turned off.
So the custom user fields are not displayed on the HikaShop registration forms on the frontend and thus their value is not initialized, as if you were registering through the Joomla registration form.
You need to activate the custom fields and if you don't want to display them to the user, you can use custom CSS to hide them.
Alternatively, do no use a "boolean" type but a radio type. Then, when you add the yes / no values to the custom field values list, make sure that you leave the "value" input empty for the default value you want. That way, even if the custom field is not displayed on the form, the default value will correspond to the field not being used and it will display properly on your user details page in the backend.

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

  • Posts: 127
  • Thank you received: 6
5 years 8 months ago #304828

Merci Nicolas
Good advice - I prefer the Radio type field method in this case. All is then private from the user.
Cordialement, Bob

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

Time to create page: 0.130 seconds
Powered by Kunena Forum