Category order by custom date field that is multi-value

More
6 years 9 months ago - 6 years 9 months ago #68426 by Soleo
Good morning,

Here's a category view displaying items ordered by a custom date field : puu.sh/wNtmM/590be3528e.jpg

As you can see, there's two items wrongly ordered. My field is a multiple values field, and I suppose that flexicontent doesn't uses the first value to order.

Here's my category parameters : puu.sh/wNtv7/f488b3ac69.png

Here's the date field parameters : puu.sh/wNtx5/ee39dc8851.png

Here are the dates values of the item happening the 20th July (the misordered) : puu.sh/wNtBS/c080239695.png
(I guess flexicontent pick the 10th August here)
The dates of the item happening the 7th August : puu.sh/wNtGh/5030f73d4b.png
The dates of the item happening the 12th August : puu.sh/wNtJb/01956f28f9.png

I use Flexicontent 3.1.1 and Joomla 3.7.3.
Last edit: 6 years 9 months ago by ggppdk.

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

More
6 years 9 months ago - 6 years 9 months ago #68427 by ggppdk
Hello

currently only single value fields are supported

our ordering code does not try to use the "first" value

it is possible to use 1st value
but this may break in some cases

becuase it could happen that somehow the 1st value does not exit in DB


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 6 years 9 months ago by ggppdk.

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

More
6 years 9 months ago #68429 by Soleo
Thanks for the answer,

What can I override to use the first value ? Because in my case, there's always at least one value in items of this category.

I made a script that reorder items in the template using the first date, but since there's pagination involved it only reorder displayed items, so I need to change something deeper.

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

More
6 years 9 months ago #68435 by ggppdk
Hello

we would like to get a more consistent behaviour for multi-value fields

Option1:
- always add 'AND valueorder=0' to the JOIN

Option 2:
- JOIN with a subquery that uses GROUP by to get value with smallest valueorder
(this may have some performance effect)

Option 3:
- load field configuration (parameters), and if 'multivalue' is set add 'AND valueorder=0' to the JOIN

Still option 1 should be OK unless someone is using custom code to delete the first value manually
you see our saving code always make 1st value to have 'valueorder' zero and 2nd value to have 'valueorder' 1 , etc

so it should be as simple as just doing the 'option 1', but probably 'option 3' is safer, about option 2 it may have a performance effect when trying to list 10,000 or items in websites with e.g. 100,000 so i do not like it


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
The following user(s) said Thank You: Soleo

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

More
6 years 9 months ago #68439 by Soleo
Good morning,

Adding the valueorder to the join worked like a charm, thanks ! (I just added a if ($orderbycustomfieldid == $myfieldid) to not screw others categories)

Note that the lowest valueorder was 1, not 0.

I guess I will have to do this everytime I update flexicontent until there's some kind of settings for multi-value field in the category order parameters.

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.282 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline