Here it is listtemplate source
list::create \
-name items \
-multirow items \
-key item_id \
-page_flush_p 1 \
-page_size 250 \
-page_query_name select_items \
-actions {
"#evex-event.Send_request#" request-proposal "#evex-event.Send_a_request_to_partner#"
} \
-bulk_action_method post \
-bulk_action_export_vars { event_id } \
-bulk_actions {
"#evex-event.Send_request#" request-proposal "#evex-event.Send_request_to_all_partners#"
} \
-elements {
title {
label "#evex-event.Title#"
}
distance {
label "#evex-event.Distance#"
}
score {
label "#evex-event.Category_Score#"
}
total {
label "#evex-event.Total_Score#"
}
location {
label "#evex-event.Location#"
}
}
db_multirow -extend { location thumbnail_url} items select_items_page "
SELECT qa1.item_id, qa1.score AS total, qa2.score, cr.title,
pa.latitude, pa.longitude, pa.delivery_address AS location,
to_char((( 3959 * acos ( cos ( radians(:latitude) ) * cos( radians( CAST(pa.latitude AS NUMERIC)) ) * cos( radians( CAST(pa.longitude AS NUMERIC) ) - radians(:longitude) )+ sin ( radians(:latitude) )* sin( radians( CAST(pa.latitude AS NUMERIC) ) ) )) * 1.6)::float, 'FM999999990.00') AS distance
FROM
cr_items ci, cr_revisions cr,
ee_qa_item_info qa1, ee_qa_item_category_score qa2,
postal_addresses pa,
acs_data_links adl
WHERE ci.item_id = cr.item_id
AND ci.live_revision = cr.revision_id
AND (ci.content_type = 'ee_venue' OR ci.content_type = 'ee_service')
AND qa1.item_id = ci.item_id
AND qa1.item_id = qa2.item_id
AND adl.object_id_one = qa1.item_id
AND adl.object_id_two = pa.party_id
AND adl.relation_tag = 'item_group_rel'
AND (( 3959 * acos ( cos ( radians(:latitude) ) * cos( radians( CAST(pa.latitude AS NUMERIC)) ) * cos( radians( CAST(pa.longitude AS NUMERIC) ) - radians(:longitude) )+ sin ( radians(:latitude) )* sin( radians( CAST(pa.latitude AS NUMERIC) ) ) )) * 1.6) < :max_distance
AND ci.item_id IN ($item_ids)
AND qa2.category_id IN ($categories)
AND [template::list::page_where_clause -name items -key qa1.item_id ]
[template::list::filter_where_clauses -and -name items]
GROUP BY qa1.item_id, qa2.score, cr.title, pa.latitude, pa.longitude, pa.delivery_address
ORDER BY qa2.score DESC, qa1.score DESC
" {
set thumbnail_url ""
...
}