Trying to use this module for a equipment rental application. After setting up everything and configuring my product, when I go to the search page, I get the date popup... but no time dropdown.
I've search through the module and js files and cant seem to find the code that even handles this. The other issue I see is even though I've set my time limits to 10:00-18:00... when I look at the booking calendar, I see 24 hours worth of time slots. Any suggestions on how to resolve these issues would be appreciated.

Regards,

CommentFileSizeAuthor
wt-cal.png40.73 KBReevescorp
wt-time.png48.64 KBReevescorp

Comments

Reevescorp’s picture

I updated to the dev version, didnt fix the time dropdown issue on the search form, the time dropdown is working from the bookings calendar so I know the date module is working correctly. As to the second issue I realize it probably can be controlled by editing the view filter so that issue can be discarded.

Reevescorp’s picture

I've done some more testing on this problem...

This function is not working. It's returning a null array rather than a time array.

function _agres_categories_create_options_servicehours($daynumber, $cat) {
  $lang = 'und';
  $lang = field_language('node', $cat,'field_agres_servicehours');    
  $datform = 'Y-m-d H:i';
  $shours = $cat->field_agres_servicehours[$lang][$daynumber]['value'];
  $stimearray = array();
  if ($shours <> 'x'){
  $hoursofday = explode(",", $shours);
  $stimearray = array();
//  $i = 0;
  
  foreach ($hoursofday as $x => $startend) {
    $startendarray = explode("-", $startend);
    $start = $startendarray[0];
    $end = $startendarray[1];
    $prepend = array('00', '01', '02', '03', '04', '05', '06', '07', '08', '09');
    $prependmin = array('00',);
    $hours = array_merge($prepend, range(10, 23));
    $minutes = array_merge($prependmin, range(15, 59,15));      
    foreach ($hours as $h => $hour) {
      foreach ($minutes as $minute) {
        $stime = $hour . ':' . $minute;
        
        if (($stime <= $end) && ($stime >= $start)) {
          $stimearray[$stime] = $stime;
        }
//        $i++;
      }
    }
  }
  }  
  return $stimearray;
}

As I research the problem more Ill update.

Reevescorp’s picture

Priority: Critical » Normal

Ok.. solved it. By putting an x into the first time slot on the category node, it bombs the function above. I havent tested by putting an x into any other time slots.

Reevescorp’s picture

Version: 7.x-2.0-beta3 » 7.x-2.x-dev

So the problem is this...

if ($shours <> 'x'){

If you put an x into your schedule... it just does nothing, drops through and has zero handling of the closed day. This time dropdown is generated before the page is generated and the user picks a date, there is no json call back to the server to check to see if the date picked is actually a date the business is open. There is not a whole lot of choices when it comes to rental modules for drupal and this is the only one which plugs into ubercart and makes it a purchase. But BE WARNED.... it is definitely not a turnkey solution. You will have to know PHP in order to make it operate as such.

I am also not a fan of the idea it uses nodes for its category and unit types. In a busy site with a lot of nodes this seriously slows down the server having to search through 1000s of nodes in order to find a single category record and then do another search through 1000s of nodes to find the unit types records associated with that category record. The only thing that should be a node is when it actually creates a reservation that processes through ubercart. The other data should be contain in their own tables for easy management and quick query. This would also give you a quick query table to see what items are out on rental and what is available to rent. I plan to rewrite it as such to use for my purposes. If you want the finished code Ill be happy to contribute it to the package once completed.

agill’s picture

Hello Reevescorp,
thanks for offering your help!

Yes agreservations is not a turnkey solution thats right, but if your usecase is not too
extravagant or special it is a good start.

This time dropdown is generated before the page is generated and the user picks a date, there is no json call back to the server to check to see if the date picked is actually a date the business is open.

You got me, i sort of cheated on this feature ;-)
Yes, this definately needs work. I would implement this on my own, but currently have no time.
If you would provide a patch that solves this issue implementing a json call back to the server
to run this function for the proper day slot of the category calling _agres_categories_create_options_servicehours($daynumber, $cat) with the correct first parameter
0-6 (currently only 0 is used), that would be awesome!
also it should be determined in that callback if the day generally is available.

Second issue:

I am also not a fan of the idea it uses nodes for its category and unit types. In a busy site with a lot of nodes this seriously slows down the server having to search through 1000s of nodes in order to find a single category record and then do another search through 1000s of nodes to find the unit types records associated with that category record.

... well you know, by using relational DBs like MySQL ... no, i do not have much time,
...to make it short:
the mysql queries(yes that includes the views queries) do not slow down the site much, unless you have millions of nodes...also see: http://groups.drupal.org/node/47018 or test yourself with devel generate or write tests.
i can assure for hotel, bicycle, car-rental sites, even if they are big, db queries are no issue.
For agreservations D8 switching to entities is planned but its the same in green when it comes to performance.

i also do not see much sense in implementing your own data storing bypassing Drupal, reinventing the wheel, when in reality nodes do not slow down alot Drupal...better invest that energy where it is needed, like the User Interface of agreservations which definately needs work in agreservations.

Thanks again!

Andreas

Reevescorp’s picture

Andreas,

Thanks for the reply and I appreciate the work you put into the module. I dont know if it will be suited well for the application I have planned. Im building a jetski rental website that will have rentals, tours, charters, diving along with products and multiple locations. So I was looking for a good base to start. Probably will end up writing my own module so I have better understanding of what is going on when I need to add more features, but your module is a good example to work from.

Regards,
Charles

Reevescorp’s picture

Status: Active » Needs work
agill’s picture

Status: Needs work » Needs review

I added a callback function to properly fill the time entry dropdown from the service hour fields of the category.