Custom field: Display limited to multiple values

  • Posts: 59
  • Thank you received: 0
8 years 8 months ago #233738

-- 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

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
8 years 8 months ago #233773

Hi,

The system isn't made to support that.
It would require custom coding.

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

  • Posts: 59
  • Thank you received: 0
8 years 8 months ago #233778

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

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
8 years 8 months ago #233787

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.

The following user(s) said Thank You: simonev

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

  • Posts: 59
  • Thank you received: 0
8 years 7 months ago #238006

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

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
8 years 7 months ago #238015

Hi,

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.064 seconds
Powered by Kunena Forum