Main menu

Forum


× Help Forum English

Number of tickets remaining displayed on event list

  • Drdaz123
  • Portrait de Drdaz123 Auteur du sujet
  • Nouveau membre
  • Nouveau membre
Plus d'informations
il y a 3 ans 8 mois - il y a 3 ans 8 mois #17132 par Drdaz123
Hello again...

Is it possible to show the number of tickets available for and event in the description on the events list page without clicking on that event???

Thanks in advance,
Darren
Dernière édition: il y a 3 ans 8 mois par Lyr!C. Raison: [IN DEV.]

Connexion ou Créer un compte pour participer à la conversation.

  • Lyr!C
  • Portrait de Lyr!C
  • Administrateur
  • Administrateur
  • Lead Developer
Plus d'informations
il y a 3 ans 8 mois #17137 par Lyr!C
Hello Darren,

For 3.8 version, the system to display remaining tickets was full recoded to be a new separate layout (easier too for custom design and overrides).

In this refactory, i have worked to allow this function to work in the main list and to be displayed per event (this was not possible with current stable version).
So my goal is to allow this display in main list too, with a show/hide new option (not yet added, but to be added in the 3.8 serie).

Thank you!

Best regards,
Cyril

NB: i think you will wait for 3.8 with attention ;-)

Latest version : iCagenda 3.9.3
We recommend every user to keep iCagenda updated.
Don't forget to have your Joomla!™ up-to-date!

Do you like iCagenda?
I would appreciate if you could take 5 minutes to post a review on JED (Joomla Extensions Directory) .

Fichier attaché :

Les utilisateur(s) suivant ont remercié: Drdaz123

Connexion ou Créer un compte pour participer à la conversation.

  • PhilKloppers
  • Nouveau membre
  • Nouveau membre
Plus d'informations
il y a 2 ans 8 mois - il y a 2 ans 8 mois #17412 par PhilKloppers
Réponse de PhilKloppers sur le sujet Number of tickets remaining displayed on event list
I've been waiting for this, but eventually just rolled my own solution. Here it is if anyone also needs this functionality. I'm using the ic_rounded theme and the file to edit is components/com_icagenda/themes/packs/ic_rounded/ic_rounded_events.php. Insert the following code before the line (around line 150 for me):  <?php // + infos Text ?> 
                        <?php // Show remaining seats for event ?>
                        <?php
                                $tempdb = JFactory::getDbo();
                                $query = $tempdb->getQuery(true);
                                $query
                                        ->select(array('count(*)', 't1.date', 't2.title', 'JSON_UNQUOTE(JSON_EXTRACT(t2.params,"$.maxReg")) AS capacity', '(JSON_UNQUOTE(JSON_EXTRACT(t2.params,"$.maxReg")) - count(*)) AS available'))
                                        ->from($tempdb->quoteName('#__icagenda_registration', 't1'))
                                        ->join('LEFT', $tempdb->quoteName('#__icagenda_events', 't2') . ' ON ' . $tempdb->quoteName('t1.eventid') . ' = ' . $tempdb->quoteName('t2.id'))
                                        ->where($tempdb->quoteName('t1.date') . ' LIKE "%' . $item->next . '%"')
                                        ->where($tempdb->quoteName('t2.title') . ' LIKE "%' . $item->title . '%"')
                                        ->where($tempdb->quoteName('t1.state') . ' = "1"')
                                        ->group($tempdb->quoteName('title'));
                                $tempdb->setQuery($query);
                                $tempResults = $tempdb->loadAssoc();
                                if ($tempResults["available"] > 0) {
                                        echo $tempResults["available"]." seats available.";
                                } else {
                                        echo "There are no seats available.";
                                }
                        ?>
I haven't tested it with events that have multiple dates, but this works for me for now at least.

*** Updated 2021/08/17 ***
I've tweaked the code to work correctly with repeat events and to display the correct seats when no bookings have yet been made.
                        <?php // Show remaining seats for event ?>
                        <?php
                                $tempdb = JFactory::getDbo();

                                $query = $tempdb->getQuery(true);
                                $query
                                        ->select(array('t1.title', 'JSON_UNQUOTE(JSON_EXTRACT(t1.params,"$.maxReg")) AS capacity'))
                                        ->from($tempdb->quoteName('#__icagenda_events', 't1'))
                                        ->where($tempdb->quoteName('t1.period') . ' LIKE "%' . $evt . '%"')
                                        ->where($tempdb->quoteName('t1.title') . ' LIKE "%' . $item->title . '%"');
                                $tempdb->setQuery($query);
                                $tempResults = $tempdb->loadAssoc();
                                $capacity = $tempResults["capacity"];

                                $query = $tempdb->getQuery(true);
                                $query
                                        ->select(array('count(*)', 't1.date', 't2.title', 'JSON_UNQUOTE(JSON_EXTRACT(t2.params,"$.maxReg")) AS capacity', '(JSON_UNQUOTE(JSON_EXTRACT(t2.params,"$.maxReg")) - count(*)) AS available'))
                                        ->from($tempdb->quoteName('#__icagenda_registration', 't1'))
                                        ->join('LEFT', $tempdb->quoteName('#__icagenda_events', 't2') . ' ON ' . $tempdb->quoteName('t1.eventid') . ' = ' . $tempdb->quoteName('t2.id'))
                                        ->where($tempdb->quoteName('t1.date') . ' LIKE "%' . $evt . '%"')
                                        ->where($tempdb->quoteName('t2.title') . ' LIKE "%' . $item->title . '%"')
                                        ->where($tempdb->quoteName('t1.state') . ' = "1"')
                                        ->group($tempdb->quoteName('title'));
                                $tempdb->setQuery($query);
                                $tempResults = $tempdb->loadAssoc();

                                if ($tempResults == NULL) {
                                        echo "$capacity seats available.";
                                } elseif ($tempResults["available"] > 0) {
                                        echo $tempResults["available"]." seats available.";
                                } else {
                                        echo "This venue is fully booked.";
                                }
                        ?>

 
Dernière édition: il y a 2 ans 8 mois par PhilKloppers. Raison: Updated code to handle repeat events
Les utilisateur(s) suivant ont remercié: Lyr!C

Connexion ou Créer un compte pour participer à la conversation.

Modérateurs: Lyr!C
Temps de génération de la page : 0.174 secondes

Follow Us

Créez vos templates Joomla avec Template Creator CK

acymailing logo new