How grouping items in a search page ?

More
9 years 1 month ago #57139 by osep45
Hello,

I would like to know if it is possible to group the items in a search page.
I have 2 types : book and text. A book contains some texts. In the search page, i get a list of book(s) and text(s) but i would like :
- to group the texts with the corresponding book
- to display the information of the book for each text found by the search, even if this book is not directly found by the search.

Here is an example :
if the result of the search is : Book n°3, Book n°5, Text n°4.2 (meaning the 2nd text of the Book n°4), Text n°5.1 and Text n°5.4,
I would like to display the result as following :
* Book n°3
* Book n°4
- Text n°4.2
* Book n°5
-Text n°5.1
-Text n°5.4

THANKS a lot for your help.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #57140 by ggppdk
Hello

i am not sure how the ITEM Types are related, i guess you know what you want to do

- you can do easily (easy for a developer) do this by making a Joomla template override, for file:

component/com_flexicontent/views/search/tmpl/default_results.php

copy as:
templates/MYJOOMLATemplate/html/com_flexicontent/search/default_results.php

and then edit to customize the file

e.g. find:
Code:
<?php foreach($this->results as $i => $result) : ?> <div class="fcclear"></div> <?php $count++; $fc_item_classes = 'fc_search_result '.($count%2 ? 'fcodd' : 'fceven'); if ( @ $result->fc_item_id ) { // FLEXIcontent specific result

and after it add:
Code:
echo "TYPE ID is:" $result->type_id."<br/>";

you would probably want to replace the loop with TWO loops
- first loop will do some reordering
- second loop will display things

- also you should set
number of items per page = Search limit (items returned by FLEXIContent advanced search plugin)
- also you probably would want to unpublish other search plugins and let only the FLEXIContent advanced search plugin, be published


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #57159 by osep45
Thanks a lot for your quick answer and for this helpful information. I will do as proposed.
I have just another small question. I have two different search pages, so I need to keep the default_results.php file for the other search page and to set a specific template for the search page described above. I haven't found a parameter to assign a specific template to the search page. Do you know how I could do that ?

Thanks again.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #57452 by osep45
For the moment, I use the parameter "Page Class" to assign a template to the search menu item :
I've modified the file : component/com_flexicontent/views/search/tmpl/default.php
as following :
if ($this->params->get('pageclass_sfx') == "xxxx") :
echo $this->loadTemplate('results_xxxx');
else :
echo $this->loadTemplate('results');
endif;
Maybe it could be a futur enhancement to have the possibility to assign a template to the search menu items ?

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.278 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline