Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • iorfino Friend
    #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.

    iorfino Friend
    #996615

    Hello…

    Mo0nlight Moderator
    #996816

    Hi.

    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

    iorfino Friend
    #996943

    what 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 Moderator
    #997344

    Hi.

    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 line

    if ($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.

    iorfino Friend
    #997912

    It works very well. Thank you.
    When I’ll upgrade the component the modified file will be overwritten?

    Nino

    Mo0nlight Moderator
    #999099

    Hi,

    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

Viewing 7 posts - 1 through 7 (of 7 total)

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