Get All Events Method

  • LAC Webadmin
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
7 years 2 months ago #112887 by LAC Webadmin
Get All Events Method was created by LAC Webadmin
Hi Tuan,

Is there any method I can use to pull all Events (with all the data) that I can call within Categories view? I am creating an override on Categories view where all categories are listed in the left but I want to create a right column where the lists of events are shown. I found a method getAllEvents() in database class but it only pull 3 data, I want all the data like what getEventData() method has.

Before tweaking or adding my own code, maybe you already have one so I don't have to reinvent the wheel.

I am trying to create a view just like how eventbrite is doing it. Something like this:

www.eventbrite.com/d/ca--pasadena/busine...s/?place_id=85923487

Thanks,

Jackson

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

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
7 years 2 months ago #112892 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Get All Events Method
I don't really understand what you need. However, you might want to look at the code which I use in the file components/com_eventbooking/view/categories/html.php

Look at the code from line 90 to 106, you will see the code which I used to get events from a certain category. Maybe you can re-use that code somehow?

Tuan

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

  • LAC Webadmin
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
7 years 2 months ago #112996 by LAC Webadmin
Replied by LAC Webadmin on topic Get All Events Method
In components/com_eventbooking/view/categories/html.php where you lists all of the categories, I also want to list All Events regardless of categories and lists it by Date, and other filters which you just added.

In your original code you fetch events per category and store it in $category->events.

What I am trying to create is a layout that when loaded and no category is selected, it will lists all events. Is that possible?


Thanks,

Jackson

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

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
7 years 2 months ago #113010 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Get All Events Method
Yes. In that same code, just remove ->setState('id', $item->id) and it will load all events

Ofcourse, in that case, you should move the code outside the for loop block

Tuan

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

  • LAC Webadmin
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
7 years 2 months ago - 7 years 2 months ago #113046 by LAC Webadmin
Replied by LAC Webadmin on topic Get All Events Method
Hi Tuan,

I was looking at the code yesterday after I posted here and aha! Exactly what I did :) the only issue I am having is I am also getting past events like January events. I enabled don't show past events and looking at upcomingevents model it should run applyHidePastEventsFilter but I am still getting past events. Is there anything that I missed?

What I mean with past event is, the events returned is the Parent event, what I'm expecting for it to return is the latest repeat or child.

Here's the code I did:
Code:
if ($this->getLayout() == 'default') { $model = new EventbookingModelUpcomingevents( [ 'table_prefix' => '#__eb_', 'remember_states' => false, 'ignore_request' => true, ] ); $events = $model->setState('limitstart', 0) ->setState('limit', $this->params->get('number_events_per_category', 20)) //->setState('id', $item->id) ->getData(); $this->events = $events; }

If you look at the timeline category view, the same thing is happening, it will lists past events. Isn't it supposed to show the upcoming latest date and not past?

Thanks,

Jackson
Last edit: 7 years 2 months ago by LAC Webadmin.

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

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
7 years 2 months ago #113066 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Get All Events Method
Hi Jackson

Unfortunately, there is no way for getting upcoming date using SQL. So it's not possible to do that

So maybe after getting list of events, you will have to make a for loop block, check all the events returned. If it's a parent and past event, then write some code to replace it with the next child event of that past events

Tuan

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

  • LAC Webadmin
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
7 years 2 months ago #113151 by LAC Webadmin
Replied by LAC Webadmin on topic Get All Events Method
Hi Tuan,

I've been playing around with it more yesterday and yeah, I just created a for loop just like you said and fetch the children using:
Code:
foreach ($this->events as $event) { if ($event->event_type == '1') { $childrenEvents = EventbookingModelEvent::getAllChildrenEvents($event->id); $event->children = $childrenEvents; } }

Can you confirm if event type 1 is the only event type that creates a children event?

I am understanding Event Booking more now, you designed the views to exactly show what it is, so categories only show categories unless you drill down to a single category. I just wish you designed it like Joomla Articles where you can also choose to show articles while on categories view.

The design of repeating event will only show the Parent and once the parent is open you have the option to show all the children.

I am trying to create a view where it shows the most recent available date of a repeating event and if there's a registration they can register for it. But I guess like you said I have to tweak how the dates are displayed.

One quick request if possible Tuan, can you add an option in a menu item to override the setting

- Show children events date under parent events

If I turn this setting off, the list will fetch the latest available date for repeating event but it does fetch all of the repeats instead of merging it into one and just showing the recent repeat date. I wish you will create that query in the future.

Thanks,

Jackson

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

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
7 years 2 months ago #113174 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Get All Events Method
Hi Jackson

1. event_type = 1 is correct condition

2. If you want to show both events and categories, try to use category menu option instead. It will show both it's children categories and events belong to that category

3. About adding additional parameter to the menu, I could not promise. I will have to think more about it it.

Regards,

Tuan

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

Moderators: Tuan Pham Ngoc