[SOLVED] Search breaks when sorted by custom field (date)

More
9 years 1 month ago #62069 by Ninjakitten
I appreciate your help, but I don't feel as though you understand what I'm saying, and that's really becoming frustrating. :/ I'm not sure how I can rephrase it, but I'll try.

Please look at line 444 and line 461 in flexiadvsearch.php, and notice the table alias:
Code:
LEFT JOIN #__flexicontent_fields_item_relations AS f
and likewise, line 639 in the same file:
Code:
JOIN #__flexicontent_fields as f
That is not something I did. That is the untouched distributed file, straight from the 15-dev zip.
Changing the alias for the #__flexicontent_fields table from f to something unused (fi) resolved the custom ordering 404 error.

#__flexicontent_fields_item_relations is aliased to f 4 times (lines 438, 444, 455, 461), and to f2 4 times (lines 473, 479, 490, 496).
#__flexicontent_fields is aliased only once, and it is aliased to f (line 639).

Resolving this resolves the error I originally posted about.
I'm not trying to do the second level ordering via PHP -- I just want it to work through the normal search configuration options.
Your image in the example below SHOWS the level 2 drop-down.
This matters because when the drop-down is SHOWN, level 2 ordering DOES WORK -- even without using the drop-down.
When the drop-down is NOT SHOWN, level 2 ordering DOES NOT work.
...and on changing to 15-dev, now only the first result on a page seems to have a categories array (and yes, I do have categories set as a field that search should render).
All the other results on the page have an empty array.
This result is the same whether I use my custom default_results.php or the unchanged one from the zip.

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

More
9 years 1 month ago - 9 years 1 month ago #62070 by ggppdk
Hello

i did not read 1 of your messages

you had posted 3 messages back to back , and i did not read the 1st of the 3

indeed the TABLE Alias that needs to be changed is:
> JOIN #__flexicontent_fields as f

- i will make a fix for this

[EDIT]
about 2nd level ordering being ignored (when selector is not visible) , i will check this too


-- 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: 9 years 1 month ago by ggppdk.
The following user(s) said Thank You: Ninjakitten

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

More
9 years 1 month ago #62073 by Ninjakitten
Thank you!

After some poking around, it looks as if the new issue 15 caused (only having category info for the first result per search results page) comes from the rewriting of _getCategories in flexicontent.fields.php.

Changing line 1107 from
Code:
. ' WHERE c.itemid IN (' . $db->Quote(implode(',', $cids)) .')';
to
Code:
. " WHERE c.itemid IN ('" . implode("','", $cids) . "')";
and line 1121 from
Code:
. ' WHERE rel.itemid IN (' . $db->Quote(implode(',', $cids)) . ')'
to
Code:
. " WHERE rel.itemid IN ('" . implode("','", $cids) . "')"
seems to make it work properly again. It looks like maybe $db->quote doesn't work on lists of numbers? Joomla's secure coding guidelines page uses non-quoted implodes as above, but has JArrayHelper::toInteger($cids); on the line before the query in the 'Secure arrays of integers' section.

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

More
9 years 1 month ago - 9 years 1 month ago #62074 by ggppdk
Hello

The quotes were there before, and were working,
- Just we broke them recently, 1 day bug

because we replaced 1 query with 2 queries
- to make it faster for category view and use less memory

Furthermore indeed
1. These ids come from an integer DB column so they are never string, they are there for 3rd party code calling FC code,
2. you can just make sure that these are integers and then build the query without quotes

so will change them to be typecasted to integer and remove quotes completes

Thanks for report


-- 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: 9 years 1 month ago by ggppdk.
The following user(s) said Thank You: Ninjakitten

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

More
9 years 1 month ago #62075 by ggppdk
Hello

i have commited fix:

- if you have uploaded new version

then you can use v3.0.x-stable branch:
github.com/FLEXIcontent/flexicontent-cck/tree/3.0.x-stable

click "Download ZIP " and upgrade


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

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

More
9 years 1 month ago - 9 years 1 month ago #62076 by ggppdk
Hello

also fixed the 2nd level order will work now (regardless of if 2nd level order is displayed in frontend)

2nd level order was not working, because it was disabled, we have a flag to do this for views that do not implement it,

in this case , we added support but only enabled the flag when 2nd level order was shown

github.com/FLEXIcontent/flexicontent-cck/tree/3.0.x-stable


-- 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: 9 years 1 month ago by ggppdk.

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.392 seconds
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
Save