How to display parent value with the value in select attribute?

Hello, I’m developing a Make/Model attribute utilizing a single Select attribute type and using parents and childs. But, when we have a large quantity of models on one make, it’s difficult to know which make corresponds to that model.
I’m searching for a code snippet to display the parent value and the value at the same line, at the listing block and the selector.

Please try using the %parent_value% token in the attribute display format. If you mean improving the UI of the selection itself, unfortunately, it’s not possible at the moment, but we’re working on it (the same issue occurs with the listing category selection drop-down so we’ll try to improve the UI for hierarchical options).

Unfortunately, when I put the %parent_value% token on the display, it displays as text. Do you know a fix for this?

image

Please make sure that this attribute has the Select type and that there are hierarchical options. For example, if you add Toyota > Corolla options and select Corolla in the attribute, this display format:

%parent_value% %value%

Will be replaced with “Toyota Corolla”.

I have confirmed that this indeed works, but, if I check the option “Allow multiple choices” in the attribute edit page, the %parent_value% displays as text, not as a value.

Yes, unfortunately it’s not possible with multiple selection enabled because a single parent value can’t be detected in this case.

But can you display the multiple selection box to select the attribute? When I put the single selection, it is difficult for the user to select the attribute, because there is no search box. If possible, I would like to display a search box for this attribute, in the single selection option.

Please try using Radio Buttons type in this case, it’s a single selection but displayed as radio buttons. We’ll fix the search issue for the Select type with the hierarchical option as soon as possible.

I have tried to use the Radio buttons but it still didn’t give the user that is posting the listing the ability to search through all the models. Is there another way?

The Radio Buttons type is the full equivalent of the Select type, it just shows radio buttons instead of a drop-down. If this issue persists please send the steps for reproducing it with temporary WP access to support@hivepress.io and we’ll check it.

Yes, I understood that the Radio Buttons type is equivalent. The problem is that the user cannot search through its options. Is it possible to modify the PHP to include a search bar above the Select element?

I just identified that the Multiple Selection is using the Select2 javascript, and it is allowing the field to be searchable. Is it possible to make the Single Selection use the Select2 to make it searchable?

Yes, if the issue is allowing users to search through the option we’re working on fixing this bug - it occurs for Select fields with hierarchical options only.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.