Sort Events by Date

  • Tuan Pham Ngoc
  • Topic Author
  • Offline
  • Administrator
  • Administrator
More
15 years 4 months ago #5850 by Tuan Pham Ngoc
Sort Events by Date was created by Tuan Pham Ngoc
Hi All

This question was asked by a customer via support ticket system. I posted it here in case you need it, you can modify it to meet your requirement :



I have a few questions as to how I can complete the following:

- How can I display my events in date order using the event start date, with the soonest event showing first ?
- How can I hide the 'Individual Price' if the price is not entered or set to zero.
- Which css do I need to modify in order to change the button hyperlink text color?


Here are my answers for the above questions :

- How can I display my events in date order using the event start date, with the soonest event showing first ?


=> By default, events are ordered by ordering which you setup in events management of Event Booking. To make it odered by event date, you need to modify one line of code. Please open the file components/com_eventbooking/models/category.php, look at line 133, change the code from :
Code:
$orderby = ' ORDER BY a.ordering ';

To :
Code:
$orderby = ' ORDER BY a.event_date ';

- How can I hide the 'Individual Price' if the price is not entered or set to zero.


=> Please open the file components/com_eventbooking/views/event/tmpl/default.php, look at the lines of code from line 100 to line 112 :
Code:
<tr> <td> <strong><?php echo JText::_('EB_INDIVIDUAL_PRICE'); ?></strong> </td> <td class="eb_price"> <?php if ($item->individual_price > 0) echo $this->config->currency_symbol.number_format($item->individual_price, 2) ; else echo '<span class="eb_free">'.JText::_('EB_FREE').'</span>' ; ?> </td> </tr> [code] and Change it to : [code] <?php if ($item->individual_price > 0) { ?> <tr> <td> <strong><?php echo JText::_('EB_INDIVIDUAL_PRICE'); ?></strong> </td> <td class="eb_price"> <?php if ($item->individual_price > 0) echo $this->config->currency_symbol.number_format($item->individual_price, 2) ; else echo '<span class="eb_free">'.JText::_('EB_FREE').'</span>' ; ?> </td> </tr> <?php } ?>

(Attached is the modified file, you can simply get it and upload to your site) .

- Which css do I need to modify in order to change the button hyperlink text color?


=> The css file is components/com_eventbooking/assets/css/style.css. The css code for the button is from line 183 to line 227.



Hope this help .

Regards,

Tuan

Attachment default-20101122.zip not found

  • Tuan Pham Ngoc
  • Topic Author
  • Offline
  • Administrator
  • Administrator
More
15 years 4 months ago #5983 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Sort Events by Date
Hi all !

In the latest releases of Event Booking, there is a config option in configuration area of the extension which allows you to sort events by date or by ordering. You can change it by going to Configuration -> Event Booking, look at Themes tab, find the config option and change it to the ordering type you want .

Thanks,

Tuan

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

More
14 years 5 months ago #12034 by socoweb
Replied by socoweb on topic Re: Sort Events by Date

- How can I display my events in date order using the event start date, with the soonest event showing first ?


=> By default, events are ordered by ordering which you setup in events management of Event Booking. To make it odered by event date, you need to modify one line of code. Please open the file components/com_eventbooking/models/category.php, look at line 133, change the code from :
Code:
$orderby = ' ORDER BY a.ordering ';

To :
Code:
$orderby = ' ORDER BY a.event_date ';

To change the date display / sort order, line 192 can be changed to

$orderby = ' ORDER BY a.event_date DESC';

which sorts the table by date descending

and with the backend Configuration:themes: Order Events By: Event Date setting

it creates a date descending table, with current events at top

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

  • Tuan Pham Ngoc
  • Topic Author
  • Offline
  • Administrator
  • Administrator
More
14 years 5 months ago #12038 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Sort Events by Date
Thanks @socoweb for the answer. The answer for the original question was long time ago. Now, if anyone wants to have this feature, you don't have to modify code anymore. Just go to Event Booking -> Configuration, looks at Themes tab, find the config option Order Events By, set it t Events Date .

Regards,

Tuan

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

More
13 years 9 months ago - 13 years 9 months ago #16403 by lukashajek
Replied by lukashajek on topic Re: Sort Events by Date
Dear Tuan,

this is not working for me. I have this choice selected, but its not working. example .

It is working in component, but not in content plugin.

Thank you for a hint. Lukas
Last edit: 13 years 9 months ago by lukashajek.

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

  • Tuan Pham Ngoc
  • Topic Author
  • Offline
  • Administrator
  • Administrator
More
13 years 9 months ago #16431 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Sort Events by Date
Hi Lukas

What content plugin you are talking about ? I believe there is no content plugin to show list of events in the package ?

Tuan

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

More
13 years 9 months ago #16445 by lukashajek
Replied by lukashajek on topic Re: Sort Events by Date
Hi Tuan,

I mean this plugin .

Thank you

Lukas

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

  • Tuan Pham Ngoc
  • Topic Author
  • Offline
  • Administrator
  • Administrator
More
13 years 9 months ago #16446 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Sort Events by Date
Hi Lukas

Here is the updated plugin which use the setting in configuration area of Event Booking to sort event (it sorts events by title before). Please make sure you backup the site (or the plugin) before install this new version (I haven't tested this new version yet but It should work).

Tuan

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

More
13 years 9 months ago #16448 by lukashajek
Replied by lukashajek on topic Re: Sort Events by Date
Hi Tuan,

did you forget to attach the file, or am I looking wrong?

Thank you

Lukas

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

  • Tuan Pham Ngoc
  • Topic Author
  • Offline
  • Administrator
  • Administrator
More
13 years 9 months ago #16450 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Sort Events by Date
Hi

Sorry. It seems I forgot to upload file. Please get it here .

Tuan

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

Moderators: Tuan Pham Ngoc