Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • anneo Friend
    #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 Moderator
    #969776

    Hi.

    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.

    anneo Friend
    #969876

    Any feedback please…?

    anneo Friend
    #970287

    I 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/veQ2P

    What 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 Moderator
    #970389

    Hi

    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

    anneo Friend
    #971121

    Consider this as done.

    I have:
    a) added "pre-filtering" using "featured"
    and
    b) manually changed the sorting in folder:
    componentscom_jak2filtermodels
    and file:
    itemlist.php

    to:
    //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.

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

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