- Posts: 59
- Thank you received: 0
Custom field: Display limited to multiple values
10 years 7 months ago #233738
by simonev
Custom field: Display limited to multiple values was created by simonev
-- HikaShop version -- : 2.6.1
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.5.
Hi,
I would like to display a custom field only if some post code are typed (post code is a text type field). I'm trying with "Display limited to" function but I can insert only one value. ex. 20100
How can I show a field "display limited to" a list of values? ex. "20100,20109,20394..."?
Regards,
Simone
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.5.
Hi,
I would like to display a custom field only if some post code are typed (post code is a text type field). I'm trying with "Display limited to" function but I can insert only one value. ex. 20100
How can I show a field "display limited to" a list of values? ex. "20100,20109,20394..."?
Regards,
Simone
Please Log in or Create an account to join the conversation.
10 years 7 months ago #233773
by nicolas
Replied by nicolas on topic Custom field: Display limited to multiple values
Hi,
The system isn't made to support that.
It would require custom coding.
The system isn't made to support that.
It would require custom coding.
Please Log in or Create an account to join the conversation.
10 years 7 months ago #233778
by simonev
Replied by simonev on topic Custom field: Display limited to multiple values
Thanks for your answer, could you please suggest me how should I edit it? or the file to edit?
any information about is really appreciated.
Thank you,
Simone
any information about is really appreciated.
Thank you,
Simone
Please Log in or Create an account to join the conversation.
10 years 7 months ago #233787
by nicolas
Replied by nicolas on topic Custom field: Display limited to multiple values
Hi,
So first, custom address fields are displayed in several places. So you'll have to edit the file "custom_fields" (or custom_fields_bootstrap if the use bootstrap design setting is activated on your HikaShop configuration) of the view "user" for the registration form. And the file "form" of the view "address" for the address edition form.
There, you want to change the line:
' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\''.$type.'\',0);"',
which handles the toggling of the fields when a field is changed.
I would recommend to add there a call to a custom javascript function with this.value and only add that call if the field is the post code field (you can check $fieldName for that).
Then, to your own check in your javascript function and hide/display the line you want with a getElementById on the id of the row in the DOM.
So first, custom address fields are displayed in several places. So you'll have to edit the file "custom_fields" (or custom_fields_bootstrap if the use bootstrap design setting is activated on your HikaShop configuration) of the view "user" for the registration form. And the file "form" of the view "address" for the address edition form.
There, you want to change the line:
' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\''.$type.'\',0);"',
which handles the toggling of the fields when a field is changed.
I would recommend to add there a call to a custom javascript function with this.value and only add that call if the field is the post code field (you can check $fieldName for that).
Then, to your own check in your javascript function and hide/display the line you want with a getElementById on the id of the row in the DOM.
The following user(s) said Thank You: simonev
Please Log in or Create an account to join the conversation.
10 years 6 months ago #238006
by simonev
Replied by simonev on topic Custom field: Display limited to multiple values
Hi,
I made changes as you suggested and everything work great, thank you.
I'm using "popup mode” to change adresses in checkout and everything works updating form.php in address view.
Now I would change "popup mode" to "list" but if I do it the code in form.php is not render in page.
Is there another file to edit in order to let works the feature also in "list" lode?
Thank you,
Simone
I made changes as you suggested and everything work great, thank you.
I'm using "popup mode” to change adresses in checkout and everything works updating form.php in address view.
Now I would change "popup mode" to "list" but if I do it the code in form.php is not render in page.
Is there another file to edit in order to let works the feature also in "list" lode?
Thank you,
Simone
Please Log in or Create an account to join the conversation.
10 years 6 months ago #238015
by nicolas
Replied by nicolas on topic Custom field: Display limited to multiple values
Hi,
In that case, you want to do that change in the "show" file of the "address" view.
In that case, you want to do that change in the "show" file of the "address" view.
The following user(s) said Thank You: simonev
Please Log in or Create an account to join the conversation.
Time to create page: 0.113 seconds