List order by Prefilter

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
 
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
 
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


http://fabrikar.com/forums/index.php?threads/custom-code-in-search-form.49435/#post-259921

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

Thanks
 
Last edited:
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top