[Skip to main content](#vessel-content)

#   alphabetical order of filter values

##

- **[Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")**
- [![Greg&#95;C's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/57819-greg-c "View Greg&#95;C's Profile") Topic Author
- [ Offline](/forum/user/57819-greg-c)

Less More

- Posts: 141
- Thank you received: 3
-
-

7 years 11 months ago [\#301816](#301816) by [Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")  *[alphabetical order of filter values](/forum/25-install-update/896498-alphabetical-order-of-filter-values#301816 "-- HikaShop version -- : 4.0.1. -- Joomla version -- : 3.8.13  Hi, I am working on Hikashop Business 4.0.1. Is it possible to set alphabetical order of filter values presented in dropdown list (filter based on custom field) ? I see that the order of values in dropdown list is taken by default based on order of values typed in the value list in the custom fields setup but I cannot find the way how to change this order to alphabetical. Regards, Greg")* was created by *[Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")*

-- HikaShop version -- : 4.0.1.
-- Joomla version -- : 3.8.13

Hi, I am working on Hikashop Business 4.0.1.
Is it possible to set alphabetical order of filter values presented in dropdown list (filter based on custom field) ?
I see that the order of values in dropdown list is taken by default based on order of values typed in the value list in the custom fields setup but I cannot find the way how to change this order to alphabetical.
Regards,
Greg

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2luc3RhbGwtdXBkYXRlLzg5NjQ5OC1hbHBoYWJldGljYWwtb3JkZXItb2YtZmlsdGVyLXZhbHVlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Philip](/forum/user/34318-philip "View Philip's Profile")**
- [![Philip's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34318-philip "View Philip's Profile")
- [ Offline](/forum/user/34318-philip)

Less More

- Posts: 4820
- Thank you received: 652
-
-

7 years 11 months ago -  7 years 11 months ago [\#301826](#301826) by [Philip](/forum/user/34318-philip "View Philip's Profile")  Replied by *[Philip](/forum/user/34318-philip "View Philip's Profile")* on topic *[alphabetical order of filter values](/forum/25-install-update/896498-alphabetical-order-of-filter-values#301826 "-- HikaShop version -- : 4.0.1. -- Joomla version -- : 3.8.13  Hi, I am working on Hikashop Business 4.0.1. Is it possible to set alphabetical order of filter values presented in dropdown list (filter based on custom field) ? I see that the order of values in dropdown list is taken by default based on order of values typed in the value list in the custom fields setup but I cannot find the way how to change this order to alphabetical. Regards, Greg")*

Hello,

So far, I can say that you are right there is no options in order to order value by alphabetical order, but maybe there is a way but this will depends from your specific needs and your filter and custom field configuration.

So in order to find a solution can you provide :
- **Filer settings** screenshot
- **Custom fields** screenshot
- Describe in details your needs and your value

the point is for us to understand the context and what you want achieved as filter results.
Regards

Last edit: 7 years 11 months ago by [Philip](/forum/user/34318-philip "View Philip's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2luc3RhbGwtdXBkYXRlLzg5NjQ5OC1hbHBoYWJldGljYWwtb3JkZXItb2YtZmlsdGVyLXZhbHVlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")**
- [![Greg&#95;C's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/57819-greg-c "View Greg&#95;C's Profile") Topic Author
- [ Offline](/forum/user/57819-greg-c)

Less More

- Posts: 141
- Thank you received: 3
-
-

7 years 11 months ago [\#301837](#301837) by [Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")  Replied by *[Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")* on topic *[alphabetical order of filter values](/forum/25-install-update/896498-alphabetical-order-of-filter-values#301837 "-- HikaShop version -- : 4.0.1. -- Joomla version -- : 3.8.13  Hi, I am working on Hikashop Business 4.0.1. Is it possible to set alphabetical order of filter values presented in dropdown list (filter based on custom field) ? I see that the order of values in dropdown list is taken by default based on order of values typed in the value list in the custom fields setup but I cannot find the way how to change this order to alphabetical. Regards, Greg")*

Hi Philip, thank you for your response

Please find below an example of the custom field set as dropdown field and filter based on this custom field also set as dropdown type.

[ ![1.jpg](/forum/attachment/45661) ](/forum/attachment/45661 "1.jpg")

[ ![2.jpg](/forum/attachment/45662) ](/forum/attachment/45662 "2.jpg")

Finally filter on the front page (in filter module) will looks like below – so order of values is as entered to the custom field settings but because I plan to have a lot of different filters with many values I prefer to have possibility to sort these vaules in the filter in alphabetical order

[ ![3.jpg](/forum/attachment/45663) ](/forum/attachment/45663 "3.jpg")

maybe the solution would be to place relevant code to the Display-Views-Filter.php – but question how this code should looks like and where should be placed ?

- [ ![1.jpg](/forum/attachment/45661) ](/forum/attachment/45661 "1.jpg") [ ](/forum/attachment/45661?download=1 "1.jpg")
- [ ![2.jpg](/forum/attachment/45662) ](/forum/attachment/45662 "2.jpg") [ ](/forum/attachment/45662?download=1 "2.jpg")
- [ ![3.jpg](/forum/attachment/45663) ](/forum/attachment/45663 "3.jpg") [ ](/forum/attachment/45663?download=1 "3.jpg")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2luc3RhbGwtdXBkYXRlLzg5NjQ5OC1hbHBoYWJldGljYWwtb3JkZXItb2YtZmlsdGVyLXZhbHVlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

7 years 11 months ago [\#301839](#301839) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[alphabetical order of filter values](/forum/25-install-update/896498-alphabetical-order-of-filter-values#301839 "-- HikaShop version -- : 4.0.1. -- Joomla version -- : 3.8.13  Hi, I am working on Hikashop Business 4.0.1. Is it possible to set alphabetical order of filter values presented in dropdown list (filter based on custom field) ? I see that the order of values in dropdown list is taken by default based on order of values typed in the value list in the custom fields setup but I cannot find the way how to change this order to alphabetical. Regards, Greg")*

Hi,

No, you would have to do that in the administrator/components/com_hikashop/classes/filter.php file when the values are loaded or when the dropdown is generated.
In the filter.php view, the elements are just assembled so I don't think you would be able to do it from there.

But why not reorder the values on the custom field ? That way, you would have the order you want.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2luc3RhbGwtdXBkYXRlLzg5NjQ5OC1hbHBoYWJldGljYWwtb3JkZXItb2YtZmlsdGVyLXZhbHVlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")**
- [![Greg&#95;C's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/57819-greg-c "View Greg&#95;C's Profile") Topic Author
- [ Offline](/forum/user/57819-greg-c)

Less More

- Posts: 141
- Thank you received: 3
-
-

7 years 11 months ago [\#301880](#301880) by [Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")  Replied by *[Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")* on topic *[alphabetical order of filter values](/forum/25-install-update/896498-alphabetical-order-of-filter-values#301880 "-- HikaShop version -- : 4.0.1. -- Joomla version -- : 3.8.13  Hi, I am working on Hikashop Business 4.0.1. Is it possible to set alphabetical order of filter values presented in dropdown list (filter based on custom field) ? I see that the order of values in dropdown list is taken by default based on order of values typed in the value list in the custom fields setup but I cannot find the way how to change this order to alphabetical. Regards, Greg")*

Hi Nicolas, I can keep the proper (alphabetical) order of the values on the custom field but in case of multilanguage site and translation to different language the order will be not alpabetcial in different language. Is it possible to keep alphabetical order regardless of language ?

Regards,

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2luc3RhbGwtdXBkYXRlLzg5NjQ5OC1hbHBoYWJldGljYWwtb3JkZXItb2YtZmlsdGVyLXZhbHVlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

7 years 11 months ago [\#301882](#301882) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[alphabetical order of filter values](/forum/25-install-update/896498-alphabetical-order-of-filter-values#301882 "-- HikaShop version -- : 4.0.1. -- Joomla version -- : 3.8.13  Hi, I am working on Hikashop Business 4.0.1. Is it possible to set alphabetical order of filter values presented in dropdown list (filter based on custom field) ? I see that the order of values in dropdown list is taken by default based on order of values typed in the value list in the custom fields setup but I cannot find the way how to change this order to alphabetical. Regards, Greg")*

Hi,

I didn't think of that.
That's indeed a valid reason to have a alphabetic ordering setting for the options of the filter directly in the filter.
Right now, the only way would be to modify the code in administrator/components/com_hikashop/classes/filter.php

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2luc3RhbGwtdXBkYXRlLzg5NjQ5OC1hbHBoYWJldGljYWwtb3JkZXItb2YtZmlsdGVyLXZhbHVlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")**
- [![Greg&#95;C's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/57819-greg-c "View Greg&#95;C's Profile") Topic Author
- [ Offline](/forum/user/57819-greg-c)

Less More

- Posts: 141
- Thank you received: 3
-
-

7 years 11 months ago [\#301899](#301899) by [Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")  Replied by *[Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")* on topic *[alphabetical order of filter values](/forum/25-install-update/896498-alphabetical-order-of-filter-values#301899 "-- HikaShop version -- : 4.0.1. -- Joomla version -- : 3.8.13  Hi, I am working on Hikashop Business 4.0.1. Is it possible to set alphabetical order of filter values presented in dropdown list (filter based on custom field) ? I see that the order of values in dropdown list is taken by default based on order of values typed in the value list in the custom fields setup but I cannot find the way how to change this order to alphabetical. Regards, Greg")*

Hi, Could you propose how this code should looks like and in which line should be placed ?
Regards,

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2luc3RhbGwtdXBkYXRlLzg5NjQ5OC1hbHBoYWJldGljYWwtb3JkZXItb2YtZmlsdGVyLXZhbHVlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

7 years 11 months ago [\#301919](#301919) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[alphabetical order of filter values](/forum/25-install-update/896498-alphabetical-order-of-filter-values#301919 "-- HikaShop version -- : 4.0.1. -- Joomla version -- : 3.8.13  Hi, I am working on Hikashop Business 4.0.1. Is it possible to set alphabetical order of filter values presented in dropdown list (filter based on custom field) ? I see that the order of values in dropdown list is taken by default based on order of values typed in the value list in the custom fields setup but I cannot find the way how to change this order to alphabetical. Regards, Greg")*

Hi,

You would have to have a developer work on that for you.
It will be that code that need to be modified there: Code:

foreach($field-&gt;field_value as $val){ $selectedItem=''; if(!empty($selected) &amp;&amp; in_array($val[0], $selected)){ $selectedItem='selected="selected"'; } if(empty($val[0]) &amp;&amp; $field-&gt;field_required) continue; $html.='&lt;OPTION '.$selectedItem.' name="'.$filter-&gt;filter_data.'" value="'.$val[0].'"&gt;'.JText::_($val[1]).'&lt;/OPTION&gt;'; }

It's a more complex that just one line of code you can copy/paste there.

I've thought of an alternative. Supposing that you're using Falang to translate your products (which you probably do), you can translate your custom field through Falang's translations interface instead of using the translation files system of Joomla. With it, you'll also be able to translate the values of the custom field and in that case, the sorting can be done before the code above with just that line: Code:

usort($field-&gt;field_value, function ($a, $b) { return strcmp($a[1], $b[1]); });

(note that I didn't test it and just wrote it off the top of my head so I can't guarantee that it will work without some tweaking)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2luc3RhbGwtdXBkYXRlLzg5NjQ5OC1hbHBoYWJldGljYWwtb3JkZXItb2YtZmlsdGVyLXZhbHVlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")**
- [![Greg&#95;C's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/57819-greg-c "View Greg&#95;C's Profile") Topic Author
- [ Offline](/forum/user/57819-greg-c)

Less More

- Posts: 141
- Thank you received: 3
-
-

7 years 10 months ago [\#302151](#302151) by [Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")  Replied by *[Greg\_C](/forum/user/57819-greg-c "View Greg&#95;C's Profile")* on topic *[alphabetical order of filter values](/forum/25-install-update/896498-alphabetical-order-of-filter-values#302151 "-- HikaShop version -- : 4.0.1. -- Joomla version -- : 3.8.13  Hi, I am working on Hikashop Business 4.0.1. Is it possible to set alphabetical order of filter values presented in dropdown list (filter based on custom field) ? I see that the order of values in dropdown list is taken by default based on order of values typed in the value list in the custom fields setup but I cannot find the way how to change this order to alphabetical. Regards, Greg")*

Hi, thank you - I will try to check this
Regards,

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2luc3RhbGwtdXBkYXRlLzg5NjQ5OC1hbHBoYWJldGljYWwtb3JkZXItb2YtZmlsdGVyLXZhbHVlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.071 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
