Customize Search Event Form and Query

  • Anita Bachmann
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 months 2 days ago #159711 by Anita Bachmann
Customize Search Event Form and Query was created by Anita Bachmann
On the frontend we have a list of events that can be searched. We should customize the search filters for text search and duration search.
Instead of Today, Tomorrow we want to have the years for selecting, for example.

I'm using the search that can be activated in the EB configuration.
For the customization of the search fields and the query data I tried overrides. But it seems that I didn't override the right files.
I tried overriding the model "search", =11.0ptcomponents/com_eventbooking/model/search.php, without success.

Which files are the right ones to make an override?

Thank you and best regards

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

More
9 months 1 day ago #159724 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Customize Search Event Form and Query
If it is for searching events, search module as you mentioned is the right code to override

How did you override it? Exactly what is not working ?

Tuan

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

  • Anita Bachmann
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 months 1 day ago #159729 by Anita Bachmann
Replied by Anita Bachmann on topic Customize Search Event Form and Query
The override should be for searching events by search bar (that can be activated in EB configuration), not by search module.

I created a folder "override" in components/com_eventbooking/model/. In the override folder I put the file search.php with the class definition
class EventbookingModelOverrideSearch extends EventbookingModelSearch.
For testing I made some changes in the queries of the override search.php. The changes have no effect on the search by search bar nor by module. There always running the standard search.

Thank you
Anita

 

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

More
9 months 1 day ago #159730 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Customize Search Event Form and Query
Hi Anita

Could you please send me link to the page so that I can take a quick look ?

Tuan

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

  • Anita Bachmann
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 months 1 day ago #159732 by Anita Bachmann
Replied by Anita Bachmann on topic Customize Search Event Form and Query
test1.wif-wirtschaftsforum.ch.193.33.128...tungen-event-booking

The first search is by module, the second by search bar.


In search.php I changed the where clause for "from date" for testing:

if ($this->state->filter_from_date)
{
/**
$query->where('DATE(tbl.event_date) >= ' . $this->getDbo()->quote($this->state->filter_from_date));
*/
$query->where('YEAR(tbl.event_date) <= 2022');
}


The module search seems to take this override.
But the search bar ignores it.
I need to use the search bar for showing the pagination also after searching.

Thank you
Anita

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

More
9 months 1 day ago #159733 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Customize Search Event Form and Query
Hi Anita

The search bar is using inside the category page, so you need to override components/com_eventbooking/model/category.php model

Regards,

Tuan

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

  • Anita Bachmann
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 months 1 day ago #159745 by Anita Bachmann
Replied by Anita Bachmann on topic Customize Search Event Form and Query
Hello Tuan

Thanks for the information. As I need to override the datebase query, I have to override also the model list.php, is this correct?
The search bar I override in search_filters.php.

Until now I didn't achieve to make working the changed search.
Are there any more files that must be overridden? xml-files?

Thanks and regards,
Anita

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

More
9 months 1 day ago #159746 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Customize Search Event Form and Query
Hi Anita

You cannot override model list. You need to override model category instead

Regards,

Tuan

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

  • Anita Bachmann
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 months 1 day ago #159766 by Anita Bachmann
Replied by Anita Bachmann on topic Customize Search Event Form and Query
Hello Tuan

Thank you very much, the override is now ok.

Testing with the search filter of the event category brought me another problem that maybe should be placed to another category of this forum.
The overrides are disabled, so they don't change the behaviour.

I work with pagination, for testing showing only 2 events per page.
Searching for events with "this month" shows perfectly the first page.
When I continue to page 2, the search filter is lost and there appears the second page of all events, not of the events "this month".

Test website
test1.wif-wirtschaftsforum.ch.193.33.128...tungen-event-booking

"this month" (august) has 3 events.

Best regards,
Anita

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

More
9 months 1 day ago #159768 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Customize Search Event Form and Query
Hi Anita

For this, I will have to check it directly on your site. Please submit a support ticket ending us super admin account of the site and link to the page which we can re-procedure the issue

We will check to see why the issue happens and get it sorted

Regards,

Tuan

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