Price in event module

  • Matj
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
7 years 4 months ago #119706 by Matj
Price in event module was created by Matj
I have some custom overrides for mod_eb_events to display price in module. I have this part for price:
Code:
<div class="eb-event-price-container btn-primary"><span class="eb-individual-price"><?php if ($row->price_text) { echo $row->price_text; } elseif ($row->individual_price > 0) { echo EventbookingHelper::formatCurrency($row->individual_price, $config, $row->currency_symbol); } else { echo '<span class="eb_free">' . JText::_('EB_FREE') . '</span>'; } ?></span> </div>

I try discounted_price, but not ok. Now there is price without discount. If I put discounted price, there is only discounted. When Early bird discount is past, there is wrong price.
So I need same logic as component view, always right price.

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

More
7 years 4 months ago #119711 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Price in event module
Hello Matj

At the beginning of layout file, could you please try to call this code:

EventbookingHelperData::preProcessEventData($rows, 'list');

That should calculate discounted_price for each event displayed in the module and you can then use the same logic to display price in the module (like how it's displayed in the component)

Tuan

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

  • Matj
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
7 years 4 months ago #119714 by Matj
Replied by Matj on topic Price in event module
I have now:
Code:
<?php /** * @package Joomla * @subpackage Event Booking * @author Tuan Pham Ngoc * @copyright Copyright (C) 2010 - 2017 Ossolution Team * @license GNU/GPL, see LICENSE.php */ // no direct access defined('_JEXEC') or die; EventbookingHelperData::preProcessEventData($rows, 'list'); JHtml::_('script', JUri::root().'media/com_eventbooking/assets/js/noconflict.js', false, false); if ($showLocation) { $width = (int) $config->map_width ; if (!$width) { $width = 800 ; } $height = (int) $config->map_height ; if (!$height) { $height = 600 ; } $deviceType = EventbookingHelper::getDeviceType(); if ($deviceType == 'mobile') { EventbookingHelperJquery::colorbox('eb-colorbox-map', '100%', $height . 'px', 'true', 'false'); } else { EventbookingHelperJquery::colorbox('eb-colorbox-map', $width . 'px', $height . 'px', 'true', 'false'); } } if (count($rows)) { $monthNames = array( 1 => JText::_('EB_JAN_SHORT'), 2 => JText::_('EB_FEB_SHORT'), 3 => JText::_('EB_MARCH_SHORT'), 4 => JText::_('EB_APR_SHORT'), 5 => JText::_('EB_MAY_SHORT'), 6 => JText::_('EB_JUNE_SHORT'), 7 => JText::_('EB_JULY_SHORT'), 8 => JText::_('EB_AUG_SHORT'), 9 => JText::_('EB_SEP_SHORT'), 10 => JText::_('EB_OCT_SHORT'), 11 => JText::_('EB_NOV_SHORT'), 12 => JText::_('EB_DEC_SHORT') ); ?> <div class="eb-event-list timeline-mod"> <ul class="eventsmall"> <?php $k = 0 ; $baseUri = JUri::base(true); foreach ($rows as $row) { $k = 1 - $k ; $date = JHtml::_('date', $row->event_date, 'd', null); $month = JHtml::_('date', $row->event_date, 'n', null); ?> <li class="vevent clearfix row"> <div class="col-sm-1"> <span class="event-date"> <?php if ($row->event_date == '2099-12-31 00:00:00') { echo JText::_('EB_TBC'); } else { ?> <span title=""> <span class="month"><?php echo $monthNames[$month];?></span> <span class="day"><?php echo $date; ?></span> </span> <?php } ?> </span> </div> <div class="col-sm-3"> <a class="img-link eb-event-link" href="<?php echo JRoute::_(EventbookingHelperRoute::getEventRoute($row->id, 0, $itemId), false); ?>"> <?php if ($showThumb && $row->thumb && file_exists(JPATH_ROOT.'/media/com_eventbooking/images/thumbs/'.$row->thumb)) { ?> <img src="<?php echo $baseUri . '/media/com_eventbooking/images/thumbs/' . $row->thumb; ?>" class="eb_event_thumb" /> <?php } ?> </a> </div> <div class="col-sm-8"> <a class="url eb-event-link" href="<?php echo JRoute::_(EventbookingHelperRoute::getEventRoute($row->id, 0, $itemId), false); ?>"> <h3 class="summary"><?php echo $row->title ; ?></h3> </a> <div class="eb-event-price-container btn-primary"><span class="eb-individual-price"> <?php if ($config->show_discounted_price) { $price = $event->discounted_price; } else { $price = $event->individual_price; } if ($event->price_text) { ?> <span class="eb-individual-price"><?php echo $event->price_text; ?></span> <?php } elseif ($price > 0) { $symbol = $event->currency_symbol ? $event->currency_symbol : $config->currency_symbol; ?> <span class="eb-individual-price"><?php echo EventbookingHelper::formatCurrency($price, $config, $symbol);?></span> <?php } elseif ($config->show_price_for_free_event) { ?> <span class="eb-individual-price"><?php echo JText::_('EB_FREE'); ?></span> <?php } ?> </span> </div> <span class="event_date"><i class="fa fa-calendar" aria-hidden="true"></i> <?php if ($row->event_date == '2099-12-31 00:00:00') { echo JText::_('EB_TBC'); } else { echo JHtml::_('date', $row->event_date, 'd.m. Y', null); } ?> </span> <?php if ($showCategory) { ?> <p><small title="<?php echo JText::_('EB_CATEGORY'); ?>" class="category"><span> <i class="icon-folder-open"></i> <?php echo $row->categories ; ?></span></small></p> <?php } if ($showLocation && strlen($row->location_name)) { ?> <p title="<?php echo JText::_('EB_LOCATION'); ?>" class="location"> <i class="fa fa-map-marker" aria-hidden="true"></i> <a href="<?php echo JRoute::_('index.php?option=com_eventbooking&view=map&location_id='.$row->location_id.'&tmpl=component&format=html&Itemid='.$itemId); ?>" class="eb-colorbox-map" <strong><?php echo $row->location_name ; ?></strong> </a></p> <div class="mod_eb_description"><?php echo $row->short_description; ?> </div> <a class="btn btn-default btn-primary" href="<?php echo JRoute::_(EventbookingHelperRoute::getEventRoute($row->id, 0, $itemId), false); ?>"> <?php echo JText::_('EB_DETAILS'); ?> </a> <?php } ?> </div> </li> <?php } ?> </ul> </div> <?php } else { ?> <div class="eb_empty"><?php echo JText::_('EB_NO_UPCOMING_EVENTS') ?></div> <?php } ?>

But now is price "free".

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

More
7 years 4 months ago #119725 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Price in event module
Hello Matj

In this case, better submit a support ticket so that I can look at it to see what's wrong and correct it for you. I need to have super admin account of the site and the event which has wrong price displayed in the module to check it

Tuan

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

Moderators: Tuan Pham Ngoc