Elxis CMS Forum

Extensions => Components => Topic started by: de-active on March 16, 2010, 23:14:12

Title: IOS Reservations: My Reservations
Post by: de-active on March 16, 2010, 23:14:12
Hi,

Is it possible to hide "My Reservations" from the front page, because by default it is present on the front page. I want "my reservations" module to ONLY appear for those registered users who have made a booking, NOT for all users whether they are registered or unregistered. 

This is because we have three types of front end users: anyone browsing (unregistered), registered and those who have registered and made a booking, so 'my reservations' should only appear for them.

Thanks
Title: Re: IOS Reservations: My Reservations
Post by: datahell on March 16, 2010, 23:43:47
In order for the system to run faster it does nt check if a logged in user is a hotel customer or not. It just displays the link. But this is not bad as if the user has not book a room then he will see a message like "You have not booked any rooms" (or something like that). If you want to change it you have to execute an extra sql query and add a code like this:

Code: (php) [Select]
<?php 
if ($my->id) {
  
$database->setQuery("SELECT COUNT(resid) FROM #__res_reservations WHERE userid=&#39;".$my->id."&#39;");
  
$c = (int)$database->loadResult();
  if (
$c 0) {
    
//show the link
  
}
}
?>
Title: Re: IOS Reservations: My Reservations
Post by: de-active on March 17, 2010, 00:10:59
That's great! The reason why I inquired is for the purpose of a better user experience to know that there are three types of users by default: unregistered, registered and customer (those who have made a booking), so it would only be logical to show three views for each but it makes sense if you want performance to take over functionality/user experience.   

But if I add this new piece of code, will there be any problems with future updates or anything - who best to ask then you!  ;D

Thanks for your reply.
Title: Re: IOS Reservations: My Reservations
Post by: datahell on March 17, 2010, 14:19:02
The code I wrote you is safe and can be added anywhere. Off course future updates will overwrite your changes. This is why you should better not change the original code.
Title: Re: IOS Reservations: My Reservations
Post by: de-active on March 17, 2010, 17:57:53
Yeah, I think in that case, it's best to leave it until you change it in new versions or updates, if you decide to.

Thanks again but it's good to know that you can do it.
Title: Re: IOS Reservations: My Reservations
Post by: de-active on March 18, 2010, 16:25:44
This might be a silly suggestion but the component eHide, could that not hide Registration? Just a thought...
Title: Re: IOS Reservations: My Reservations
Post by: datahell on March 18, 2010, 18:46:23
eHide is a bot for Elxis' content items (articles). It can not be used for this task.