1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

List order by Prefilter

Discussion in 'Community' started by considerthis, Nov 9, 2018.

  1. considerthis

    considerthis Member

    Level: Community
    Hi Guys,

    I need to order a list by a dynamic variable

    Ex- I have created a custom search form that accept location and converts this to lat long. and it will also take a radius and do a search within that radius.

    My only issue is that i cant get to order the list by distance as this value is dynamic and not an element. so i though if there is a way to order the list by prefilter I can run a php code

    Thanks in advance
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I think the only way to do that would be using the php_event plugin, and run code on onLoadData to manually order the data.

    The data array will be in $args->data.

    -- hugh
  3. considerthis

    considerthis Member

    Level: Community
    Thanks Hugh. I will have a play
  4. considerthis

    considerthis Member

    Level: Community
    Hi Hugh. I just dumped that array and I can see data that only relates to a specific page ( Ex - I have 10 results pages ). Which bring me to my question

    If this is the case and let's say I order the array by distance. Will it be ordered for individual pages or for the full result?

    I have raised the same question on another thread and you suggested me to insert the distance into the rendered data ($this->rows), then order that data yourself, before the main

    Which I'm not sure how to add a property to $this->rows from the prefilter


    However, i did find a temporary solution by creating an element and run an update query to add distance to database, then from List, I set distance element as the order field - Which works but I think it's affecting the speed as there are a lot of records

    Last edited: Nov 13, 2018

Share This Page