Filter content plugin by unique value

Status
Not open for further replies.
Hello,

I have 2 lists : trips and days
Each trip is made out of several days (these 2 lists are not joined, I use the content plugin). Each day has one destination.
I'd like to show a list of destinations for each trip. Yet, as we can stay several days in the same destination the content plugin currently repeats the same destination several times.
Is there anyway to tell the content plugin to show each day only if the value of destination is unique ?
like for eg : {fabrik view=list id=2 days___trip_id=<?php echo thistripid; ?> days___destination_id[is_unique]=1}

Thanks
 
Ok, I succeeded with this one using my own query in a calc element. :)

For those who are interested : as "destination" is a dbjoin element you have to make a subquery to get the destinations ids (with select distinct to get unique ids) and then a query to get their label.
Then you can foreach it all and apply for example links on each destination name.

Which gives in my case :
Code:
$db = JFactory::getDbo();
$fk = $db->Quote('{fk_trips___id_raw}');
$query = "SELECT id, nom_destination FROM fk_destinations WHERE fk_destinations.id IN (SELECT DISTINCT destinations FROM fk_days WHERE day_id=$fk ORDER BY day_order ASC)";
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as $row)
{
    $liste[] =  "<a href='index.php?option=com_fabrik&view=details&formid=8&rowid=" . $row->id . "&Itemid=217'>" . $row->nom_destination . "</a>";
}
return implode(" > ",$liste);
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top