Show Facilities on reservationasset

More
9 years 4 months ago #5019 by donaldmoore
Show Facilities on reservationasset was created by donaldmoore
Luxuria Quickstart - Hub:

When creating a new Reservation Asset there are facilities that can be checked. However, I do not see where they are being displayed for each Reservation Asset on the front end. I need to be able to display the Reservation Asset's Facilities so the customers will know what facilities are available for each Asset.

Same thing for the Room Type Facilities, how can I show what facilities are available for each room type?

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

More
9 years 4 months ago #5020 by vietvh
Replied by vietvh on topic Show Facilities on reservationasset
Hi,

Those facilities fields were added later and they were designed to be used as filter for search results only

Asset and room type have their own fields/custom fields for that purpose, please consider using them instead.

Regards,

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

More
9 years 1 month ago #5486 by fabrikastyle
Replied by fabrikastyle on topic Show Facilities on reservationasset
Hi, I show facilities on reservationasset this way:

1. Make backup of your site :)
2.. You should change function onReservationAssetPrepareData in file plugins/solidres/hub/hub.php. After strings:

// Load the facility data from the database.
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('facility_id')
->from($db->quoteName('#__sr_facility_reservation_asset_xref'))
->where('reservation_asset_id = ' . (int) $id );
$data->facility_id = $db->setQuery($query)->loadColumn();

// Load the theme data from the database
$query->clear();
$query->select('theme_id')
->from($db->quoteName('#__sr_reservation_asset_theme_xref'))
->where('reservation_asset_id = ' . (int) $id );
$data->theme_id = $db->setQuery($query)->loadColumn();

I added changed strings:

// Load the facility data from the database with titles
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*')
->from($db->quoteName('#__sr_facilities').' AS facilities')
->join('INNER', $db->quoteName('#__sr_facility_reservation_asset_xref').' AS res_facilities ON res_facilities.facility_id = facilities.id')
->where('reservation_asset_id = ' . (int) $id );
$data->facility_id2 = $db->setQuery($query)->loadObjectList();


// Load the theme data from the database with titles
$query->clear();
$query->select('*')
->from($db->quoteName('#__sr_themes').' AS themes')
->join('INNER', $db->quoteName('#__sr_reservation_asset_theme_xref').' AS res_themes ON res_themes.theme_id = themes.id')
->where('reservation_asset_id = ' . (int) $id );
$data->theme_id2 = $db->setQuery($query)->loadObjectList();

3. And then in reservationasset template - components/com_solidres/views/reservationasset/tmpl/default - insert code like this:

( for themes)

<?php foreach($this->item->theme_id2 as $theme ) : ;?>
<div class="theme-block">
<p><?php echo $theme->title ;?></p>
</div>
<?php endforeach ;?>


(for facilities)


<?php foreach($this->item->facility_id2 as $facility ) : ;?>
<div class="facility-block">
<p><?php echo $facility->title ;?></p>
</div>
<?php endforeach ;?>


You can style it as you want. You can draw icons for each facility and name it as _ID_.png (where _ID_ is ID of your facility) and show icons near your facility name.
You can add other information from theme and facility like description, id etc.

And do not forget to make backup of your site before making changes

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

More
9 years 1 month ago - 9 years 1 month ago #5487 by fabrikastyle
Replied by fabrikastyle on topic Show Facilities on reservationasset
Like this

sory i can not attache screen shot :(
Last edit: 9 years 1 month ago by fabrikastyle.

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

More
9 years 1 month ago #5491 by vietvh
Replied by vietvh on topic Show Facilities on reservationasset
Hi,

Thank you very much for sharing your code.


About attachment, what is the size and type of your image? At this moment we only allow uploading image <= 4MB

Regards,

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

More
9 years 4 weeks ago #5500 by fabrikastyle
Replied by fabrikastyle on topic Show Facilities on reservationasset
It's small :)

Attachments:

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

Moderators: solidres
Powered by Kunena Forum

All the things you need to make your work easier. Did you like Solidres?