103 Posts
Osep45
7 years ago
6
Topic

Hi,
In a content type "receipts", I have a field "list simple" with these values :
- Crudité
- Viande
- Fromage
- Dessert

How create a search list that will display :
- Crudité (X results)
- Viande (X results)
- Fromage (X results)
- Dessert (X results)
?

Osep45

Get a Book for SEBLOD
4229 Posts
Kadministrator
7 years ago
1
Level 1

Only way to do it with pure Seblod that I can think of is:

create new content type receipts with only article title and recepy id as fields and add each recepy as separate record with recepy id matching ids from your field.

create parent search that will search for recepies from above content type. In list add article title field and List field and use FIelds option to pass recepy id from parent search to child search as described in tutorial. Child search would be your actual search, but it needs to have your select simple field in the search. so that. Set this child search to show items number or use Search total field, but don't add any field that will be visible.

http://www.seblod.com/resources/tutorials/create-a-dynamic-list-within-a-list-item

103 Posts
Osep45
7 years ago
0
Level 2

Thank you. I will try this...

103 Posts
Osep45
7 years ago
3
Level 1

I can't manage to display the number of results. 

I get this :

- Crudité
--- Oeufs en gelée
--- Salade verte... etc
- Viande
--- Cerfs
--- Sanglier... etc
- Fromage
- Dessert

but I want this :

- Crudité (X results)
- Viande (X results)
- Fromage (X results)
- Dessert (X results)

Klas, what do you mean exactly when you write :

"Set this child search to show items number 

or use Search total field, but don't add any field that will be visible."

please ?

Where can I set to show items number, or how to use Search total field (there is no parameters in this field !) ?

4229 Posts
Kadministrator
7 years ago
2
Level 2

Hi,

in the search type configuration there is a setting Show Items Number. To not display any fields you can e.g. put article title in the list fields, but on hidden position or using hidden variation. 

I'm afraid Search total field won't work as it is search form field and form is not displayed when list is displayed trough the list field. It might be that the above setting to display number of results won't work either for the same reason - sorry if I miss leaded you.

103 Posts
Osep45
7 years ago
1
Level 3

So, it's impossible to display a list like that with Seblod ?

- Crudité (X results)
- Viande (X results)
- Fromage (X results)
- Dessert (X results)

4229 Posts
Kadministrator
7 years ago
0
Level 4

One idea to do this would be to use SQl field or live plugin from

https://www.seblod.com/resources/extensions/plug-ins/sql-pack

For number of results you would need to replicate sql query produced by the child&search for each child (probably category in your case? ) and add COUNT to the query, but it is important that you need to have mysql knowledge to get that working either yourself or from a developer.

Get a VIP membership