Tagged: jak2filter sort
-
AuthorPosts
-
September 19, 2016 at 4:54 pm #969204
Hi,
What i want to achieve is to be able to have 2 options for sorting K2 Items on JAK2Filter search results:
1) sort by "Featured" ("Featured" to appear first, then "Non-Featured") –> i achieved that by selecting "Featured" in "JAK2Filter module / Order by" option (screenshot: http://take.ms/TwePk)
then…
2) sort by "Title" (K2 Items starting with "A…" to appear first, and so on…)
Since in JAK2Filter module only one sorting option exists, i suppose the solution resides in files.
One possible solution that i can think of (but i don’t know where this change should be done):
- I suppose i should be able to change the "SELECT sql query" in files and append the additional sorting option as below: from "… ORDER BY [existing option]" to "… ORDER BY [existing option], Title"
Can you help me to find in which files is the selection located or advise with any other solution?
Thank you in advance!
Mo0nlight ModeratorMo0nlight
- Join date:
- September 2014
- Posts:
- 707
- Downloads:
- 38
- Uploads:
- 107
- Thanked:
- 99 times in 97 posts
September 21, 2016 at 9:09 am #969776Hi.
You could try using pre-filter and multi ordering feature.
describle in Version 1.2.1.The link : https://www.joomlart.com/documentation/joomla-component/ja-k2-filter#version-121
Regards.
September 21, 2016 at 3:22 pm #969876Any feedback please…?
September 22, 2016 at 5:45 pm #970287I have tried what you suggested but it does not work properly. Actually it behaves very strange and i cannot identify why.
This is the current configuration that i expected to work:
http://take.ms/WPEJTM
http://take.ms/veQ2PWhat is strange, is that when i add values "Featured" and "Title" in the "Pre Order field", "Title" always comes first. I tried many ways, but when these 2 values exist together "Title" always comes first on "Save" and the ordering on the page is always by "Title" and then by "Featured" .
If this was the case, then i would not have any issue, but what i want is ordering by "Featured" and then by "Title".
What i tried next, was to change the order of these values in the database ("modules" table, "params" column) from "pre_order_field":["alpha","featured"] to "pre_order_field":["featured", "alpha"]. After this change, the items appear correct for "Featured" (first all featured and then all non-featured) but appear not correct for "Title".
For example they appear like this:
Fxxx (Featured)
Exxx (Featured)
Dxxx (Featured)
Cxxx (Featured)
Bxxx (Featured)
Axxx (Featured)
Mxxx (Featured)
Lxxx (Featured)
Fxxx (Non-Featured)
Exxx (Non-Featured)
Dxxx (Non-Featured)
Cxxx (Non-Featured)
…Can you please check the code of jk2filter extension and let me know why this happens?
Mo0nlight ModeratorMo0nlight
- Join date:
- September 2014
- Posts:
- 707
- Downloads:
- 38
- Uploads:
- 107
- Thanked:
- 99 times in 97 posts
September 23, 2016 at 4:08 am #970389Hi
Could you provide site’s URL, Admin & FTP account of your site? I will help you to check this further.
http://static.joomlart.com/images/blog/2015/nov/Add-new-post.gif
September 26, 2016 at 5:02 pm #971121Consider this as done.
I have:
a) added "pre-filtering" using "featured"
and
b) manually changed the sorting in folder:
componentscom_jak2filtermodels
and file:
itemlist.phpto:
//Set ordering
foreach ($order_fields AS $of => $vof) {
preg_match(‘/(xf|rxf)([0-9]+)/’, $of, $orderXField);
if (!$orderXField) {
switch ($of)
{
case ‘featured’ :
$orderby[‘featured’] = ‘i.featured DESC, i.title ASC’;
break;
…Thanks any for your help.
-
AuthorPosts
This topic contains 5 replies, has 2 voices, and was last updated by anneo 8 years, 2 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum