1 (edited by timelyfiasco 12/21/2017 09:16:52 am)

Topic: Reverse order of dropdown list from input box

Hi, I needed to use 2.4 due to dependency issues. But I like the way the search function in 2.3 works and I want to overwrite it on v2.4.
In 2.3, symbols appear after the alphabets, after the numbers. But the order in v2.4 is symbols, numbers, letters. Can I easily modify this?

Re: Reverse order of dropdown list from input box

Which dropdown are you referring to and where?

Re: Reverse order of dropdown list from input box

Hi Apmuthu,
When you type in the text box the item code in sales, purchasing, or item page, it shows a combo box with the item code and the description sorted by category then item code. I want to change the order back to the previous one where symbols come last.

Re: Reverse order of dropdown list from input box

In the text box before the dropdown select box for Items, only the item code can be typed. The dropdown will show the item name only and will be prefixed with the item code only if the "Show Item Codes" checkbox is ticked in the Preferences menu. Where do you get/see "symbols"?

If however, in Setup => Company Setup, the Search Items checkbox is ticked, then the textbox besfore the Items dropdown can be searched by Item Name when by Ajax, the dropdown will get filtered.

Post's attachments

ItemsSelect.png 17.4 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Reverse order of dropdown list from input box

Hi Apmuthu,

What I mean is the order of the list shown in the dropdown select box. I have search item ticked in the company page.
I tried to print screen the dropdown but it disappears. Is it even possible?

Here is an example:
If I type Gold bar, the results in the dropdown are as follows
Gold bar - Gold Bar 24k
123456789 - Gold Bar 24k
`Gold bar - Gold Bar 24k inner packaging
It is sorted as letters, numbers, then symbols. But in 2.4 symbols come first, then the rest.
I want to change it to the old one. What do I need to modify?

6 (edited by timelyfiasco 02/06/2018 04:42:11 am)

Re: Reverse order of dropdown list from input box

As mentioned, the new version of FA sorts items in a different order. I realized it may have something to do with the new version of mysql or php.
The sql concerned is

SELECT stock_id, s.description, c.description, s.inactive, s.editable
            FROM 0_stock_master as s,0_stock_category as c 
            WHERE s.category_id=c.category_id   ORDER BY c.description,stock_id;

which is found in include/ui/ui_lists.inc: function stock_items_list()

I tested adding REGEXP '^[a-z]' DESC, an answer I found in stackechange, and it works. But I cant figure out where the ORDER BY is located. It is not in the ui_list.php. Can someone point it out for me?

Re: Reverse order of dropdown list from input box

Ok. nevermind. I didnt look hard enough. It was just a few lines down the same file. Got it working.

Re: Reverse order of dropdown list from input box

The ORDER BY is implemented in the array_merge() array's element of the first argument and remains the same in both FA 2.3.x and 2.4.x as:

'order' => array('c.description','stock_id')

What did you change it to, in order to make it the way you wanted?

Re: Reverse order of dropdown list from input box

Hi apmuthu, I changed it to this
array('c.description','IF(stock_id RLIKE \'^[a-z]\', 1, 2), stock_id')

Re: Reverse order of dropdown list from input box

A non alphabetical first char being omitted before sorting....
Thanks - hope this helps someone.

There was no difference in FA 2.3.26 - wonder what made this necessary now.