-
AuthorPosts
-
December 15, 2016 at 4:54 pm #994913
I have two k2 categories with different extrafields groups. There is a JA K2 Filter page for each category and I would like the search results to be sorted by different criteria: the first output in random order and the second alphabetical based on the value of the data in an extrafield.
December 22, 2016 at 8:08 am #996615Hello…
Mo0nlight ModeratorMo0nlight
- Join date:
- September 2014
- Posts:
- 707
- Downloads:
- 38
- Uploads:
- 107
- Thanked:
- 99 times in 97 posts
December 23, 2016 at 2:40 am #996816Hi.
The JA K2 Filter supports multiple order so you can order by many criteria but you have to show the sorting options.
If you want to sort without showing the options you can try this. Edit the file components/com_jak2filter/models/itemlist.php around line 52.
$order_fields = $jinput->get('orders', array(), 'ARRAY');
Add this code under.
$order_fields['xf30']='xf30'; $order_fields['xf31']='rxf31';
30 mean Argomento 31 mean Dove
Which one above will be used for sorting first.
xf30 means ascending.
rxf30 means descending.If you find it difficult you can post your ftp account then i’ll edit for you.
Regards
December 23, 2016 at 12:13 pm #996943what exactly I need is to get 3 separate unique orders for the filters assigned in 3 different pages:
/catalogo/operatori (random order) /catalogo/eventi (ordered on QUANDO extrafield for "eventi" category) /catalogo/corsi (ordered on DA extrafield for "corsi" category)
QUANDO and DA are both Date type field and I’d like to have them ordered to have a sort of events calendar.
Mo0nlight ModeratorMo0nlight
- Join date:
- September 2014
- Posts:
- 707
- Downloads:
- 38
- Uploads:
- 107
- Thanked:
- 99 times in 97 posts
December 26, 2016 at 9:41 am #997344Hi.
You could change the edit code from
$order_fields['xf30']='xf30'; $order_fields['xf31']='rxf31';
To
$menuId = JFactory::getApplication()->getMenu()->getActive()->id; if (empty($menuId)) $menuId = $jinput->get('Itemid', 0); if ($menuId == 121) { $order_fields['xf30']='xf30'; $order_fields['xf31']='rxf31'; }
121 mean Menu Item ID.
You can copy many lineif ($menuId == 121) { $order_fields['xf30']='xf30'; $order_fields['xf31']='rxf31'; }
And change menu item id and extrafield id to suit your need.
BTW i can’t login to your administrator using your share account.If you find it’s difficult. You can post your ftp account i’ll change for you.
Regards.
December 28, 2016 at 5:53 pm #997912It works very well. Thank you.
When I’ll upgrade the component the modified file will be overwritten?Nino
Mo0nlight ModeratorMo0nlight
- Join date:
- September 2014
- Posts:
- 707
- Downloads:
- 38
- Uploads:
- 107
- Thanked:
- 99 times in 97 posts
January 3, 2017 at 2:09 am #999099Hi,
Before updating, please remember to backup this file first as it will be overwritten.
We will also consider to add a new function to the component.
Regards
-
AuthorPosts
This topic contains 6 replies, has 2 voices, and was last updated by Mo0nlight 7 years, 10 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum