How to show the remaining tickets in the events listing

The way RSEvents!Pro was built can offer more information than displayed by default. For example, normally, the component would display, in the events listing, the event's start date / time, end date / time, location, categories and, if available, repeats. However, a common request is to have the possibility to also display the event's tickets and the number of seats available for each ticket. Although there is no default functionality for this, it can be implemented using some custom scripting and Joomla!'s template overrides feature.

Creating the template override

In a few words, template overrides are used in order to perform source code modifications to any component's view files, excluding the possibility to lose the modifications upon future updates. This is done by copying the files controlling the view in question to the current template's html folder and performing the modifications there.

Assuming that you are using the beez5 template (Joomla! 2.5), here's how you can implement our described scenario:

In /templates/beez5/html create the following folder structure:

/com_rseventspro/rseventspro

RSEvents!Pro's Events view is controlled by the following files:

/components/com_rseventspro/views/rseventspro/tmpl/default.php - controls the initial listing

/components/com_rseventspro/views/rseventspro/tmpl/items_events.php - controls what is displayed when the Load more button is clicked, available when the default list limit (set up in Site >> Global Configuration >> Site >> Default List Limit) is exceeded

Copy these files in the folder created above. The final path should be:

/templates/beez5/html/com_rseventspro/rseventspro/default.php

and

/templates/beez5/html/com_rseventspro/rseventspro/items_events.php

The custom code

Edit the copied files and add the following code where you need to have the ticket information displayed, in the events listing:

 
<?php if ($details['ticket_info']){?>
  <span>
  <strong>Available Tickets: </strong>
    <?php       
      echo implode(", ",$details['ticket_info']);
    ?>
  </span>
<?php }?>
 

3 persons found this article helpful.


Was this article helpful?

Yes No
Sorry about that