Hi There,

I was already happy to have the Upgrade/Addon working, but while testing (and i did test any possible setting) i get this Fatal error:

Fatal error: Call to a member function modify() on a non-object in /home/deb13499n7/domains/samsvakantiehuizen.nl/public_html/modules/uc_hotel-6.x-2.0-beta4/uc_hotel/hotel_booking/hotel_booking.panes.inc on line 193

This is in the function hotel_booking_order_details_table:

Line 189 _hotel_booking_add_date_based_add_ons($rows, $add_ons, $night);
Line 190 $night_count++;
Line 191 $check_in = '';
Line 192 }
Line 193 $night_date->modify('+1 day');
Line 194 $check_out_formatted = $night_date->format('l F j, Y');
Line 195 //add our check out row
Line 196 $rows[] = array(

I'm not that good at this, but it seems it tries to modify a night_date that isn't present in a Upgrade/Addon. I tried every possible setting in Available Days of Week and Available Months of Year.

For the Upgrades/Addons there is 1 available per booked room (holiday home), so on the upgrade/addons page a customer can either take 1 of none. If no Upgrades/Addons are selected the completion of the order works. It just doesn't work if a Upgrade/Addon is selected.

I have no clu how to rewrite this. Please Help!!

After refreshing (i try anything) i get the following message:
warning: Invalid argument supplied for foreach() in /home/deb13499n7/domains/samsvakantiehuizen.nl/public_html/modules/uc_hotel-6.x-2.0-beta4/uc_hotel/hotel_booking/hotel_booking.panes.inc on line 157. (i don't know if this helps)

CommentFileSizeAuthor
#6 uc_hotel-1089356.patch1.08 KBlarowlan

Comments

larowlan’s picture

Status: Active » Needs review

Hi
Can you try again with the dev version.
We had a similar issue last week that I believe we patched with this commit
Lee

paardje’s picture

Hi

Sorry no change using the dev version (the fatal error is just one line different)

Fatal error: Call to a member function modify() on a non-object in /home/deb13499n7/domains/samsvakantiehuizen.nl/public_html/modules/uc_hotel-6.x-2.0-beta4/uc_hotel/hotel_booking/hotel_booking.panes.inc on line 192

I also tried to use the patch directly, and this also make no difference.

larowlan’s picture

Hi
Do you have the devel module installed?
If so can you visit /devel/php and run this code:

dsm(uc_cart_get_contents());

And paste the result here, being sure to remove any personal details.

paardje’s picture

Hi,

Result with 1 room booking, 2 addons in cart

... (Array, 3 elements)
0 (Object) stdClass
cart_item_id (String, 3 characters ) 241 cart_id (String, 1 characters ) 1 nid (String, 2 characters ) 16 qty (String, 1 characters ) 1 changed (String, 10 characters ) 1300091972 data (Array, 3 elements) module (String, 21 characters ) hotel_addons_upgrades child_id (String, 32 characters ) ab0249d9e375f238dbc18e34c7552bea parent_id (String, 3 characters ) 239 title (String, 20 characters ) Rit met paardenkoets vid (String, 2 characters ) 16 cost (Float) 0 price (Float) 45 weight (Integer) 0 module (String, 21 characters ) hotel_addons_upgrades model (String, 9 characters ) PKSautens 1 (Object) stdClass
cart_item_id (String, 3 characters ) 240 cart_id (String, 1 characters ) 1 nid (String, 1 characters ) 8 qty (String, 1 characters ) 1 changed (String, 10 characters ) 1300091972 data (Array, 3 elements) module (String, 21 characters ) hotel_addons_upgrades child_id (String, 32 characters ) 8835c4fdf007f905a5fd52afc63c9cb7 parent_id (String, 3 characters ) 239 title (String, 12 characters ) AAK Picknick vid (String, 1 characters ) 8 cost (Float) 0 price (Float) 45 weight (Integer) 0 module (String, 21 characters ) hotel_addons_upgrades model (String, 27 characters ) Picknick voor alle Personen 2 (Object) stdClass
cart_item_id (String, 3 characters ) 239 cart_id (String, 1 characters ) 1 nid (String, 1 characters ) 7 qty (Integer) 1 changed (String, 10 characters ) 1300091957 data (Array, 8 elements) module (String, 13 characters ) hotel_booking prices (Array, 7 elements) 0 (Float) 560 1 (Float) 0 2 (Float) 0 3 (Float) 0 4 (Float) 0 5 (Float) 0 6 (Float) 0 nights (Array, 7 elements) 0 (String, 19 characters ) 2011-04-09 00:00:00 1 (String, 19 characters ) 2011-04-10 00:00:00 2 (String, 19 characters ) 2011-04-11 00:00:00 3 (String, 19 characters ) 2011-04-12 00:00:00 4 (String, 19 characters ) 2011-04-13 00:00:00 5 (String, 19 characters ) 2011-04-14 00:00:00 6 (String, 19 characters ) 2011-04-15 00:00:00 total (Float) 560 adults (String, 1 characters ) 4 children (String, 1 characters ) 0 booking_upgrades (Array, 2 elements) 8 (String, 3 characters ) 240 16 (String, 3 characters ) 241 booking_upgrades_order (Array, 2 elements) 8 (String, 32 characters ) 8835c4fdf007f905a5fd52afc63c9cb7 16 (String, 32 characters ) ab0249d9e375f238dbc18e34c7552bea title (String, 47 characters ) Testwoning Het Stulpje - Sautens - Max. 7 Pers. vid (String, 1 characters ) 7 cost (Integer) 0 price (Float) 560 weight (Integer) 0 module (String, 13 characters ) hotel_booking model (String, 7 characters ) AT00001

I did some testing of my own yesterday. The problem occurs while creating the email to be send to the customer. There the Error Message is given (checkout complete). The email is not send.
The email however is created correctly, as can be reviewed at /admin/store/orders/109/invoice.

As i tested, i can see 'it' runs (on a order with 1 booked room and 1 addon) three times through the functions:

hotel_booking_order_details_table (originating from hotel_booking_details_pane_order)
_hotel_booking_add_date_based_add_ons

First time the 2 productid's (booked room and addon), number of booked nights and dates are given correctly.
Second time the 2 productid's (booked room and addon), number of booked nights and dates are given correctly.
The third time everything is empty, resulting in the error

Call to a member function modify() on a non-object in /home/deb13499n7/domains/samsvakantiehuizen.nl/public_html/modules/uc_hotel-6.x-2.0-beta4/uc_hotel/hotel_booking/hotel_booking.panes.inc on line 193

At this time the error occurs at the code: Line 193 - $night_date->modify('+1 day'); where $night_date is empty and cannot change by one day!
I hope this helps you further.

Thanks upfront for the help!

paardje’s picture

Hi larowlan,

I solved the error.

I noticed the error coming from line 95 in hotel_booking.panes.inc.

First i implemented your patch (Your post from March 11) into hotel_booking.token.inc directly.

Then i wrote an "if-statement" at line 95 in hotel_booking.panes.inc.

So i changed:

list($details, $additional) = hotel_booking_order_details_table($product, $products, FALSE, $as_template); 

into

if ($product->data['nights']) {
   list($details, $additional) = hotel_booking_order_details_table($product, $products, FALSE, $as_template);
} 

I just noticed that the last time the function uses list here data['nights'] is empty, which resulted in the error message at line 193.

It isn't very perfect programming (it is about 10 years ago i did some programming), so you might want to change it.

Greetings from Austria!!

larowlan’s picture

StatusFileSize
new1.08 KB

Here's a patch that applies against the 6.x-2.x-dev version.
Please test and advise, it is very similar to what you've done but skips a load of processing.

paardje’s picture

Works perfectly! But only with patch for hotel_booking.token.inc.

Thanks!!!