0

I have a customer which works with buses and passenger transportation.Now he would like that all routes would be visible on a site and guests could filter routes by source and destination points.
Routes examples:

Route A-E
StopA 08:10
StopB 08:20
StopC 08:30
StopD 08:40
StopE 08:50

Route E-A
StopE 09:00
StopD 09:10
StopC 09:20
StopB 09:30
StopA 09:40

Now client wants Search fields Source and Destination and for example if Source has value StopB and Destination has value StopC than user should only see Route A-E

How I'm doing this:

Firstly I created a new paragraph and added two fields in it: stop(text field) and time (time field)
enter image description here
Then I Created a content type Routes and added newly created paragraph
enter image description here
When I'm creating a new Content of Routes I can add as many stops with time as I like.
enter image description here
I created a view:
enter image description here
It shows all data as expected
enter image description here
I added Relationship field_stops: Paragraph
After that data multiplied 5 times same amount as routes in Content. Why is that?

Then I was able to add Filter Criteria field_stops: Paragraph

Now if I type StopB in filter field it filters both routes: Route A-E and Route E-A and it's normal because both of them has StopB value

enter image description here

Now I need ideas how can I add another filter field and search for both values in Routes. And how to implement source and destination route? Can it use time field?

I hope I'm clear with my question

2
  • Well its combine filter check this hope it helps you befused.com/drupal/views-combined-filter
    – Naveen
    Jan 4 at 16:48
  • Thanks for a hint. I checked the link but it says: In order to use this, the view format needs to be set to show fields. It doesn’t work if you want to display rendered entities as there are no fields to combine. And Paragraph is Rendered entity so I can't select these fields. Jan 5 at 6:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.