Closed (fixed)
Project:
Hotel Booking System for Ubercart
Version:
7.x-1.0-alpha1
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
7 Apr 2011 at 17:24 UTC
Updated:
3 Jan 2014 at 02:58 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
larowlanta
Comment #2
bwoelkers commentedI'm having the same problem. "Product" content types can be removed easily with the update cart/ remove button, but the remove button does not work for "Hotel Room" Content Types. It might be a related issue (probably not, but you never know), but when I add an item in the checkout I have an undefined property notice for weight units:
Notice: Undefined property: stdClass::$weight_units in uc_cart_get_contents() (line 1371 of [installdirectory]/modules/ubercart/uc_cart/uc_cart.module).
The "Hotel Room" content type doesn't allow me to post a weight (which it doesn't need to obviously), but the notice is saying it needs it.
Comment #3
pragna commentedI have used ubercart_hotel module and ubercart module.
I have requirement same functionality ubercart_hotel In my project but whenever I book room it redirect me cart page and when I tried to remove that room from cart page it remains as it is.
Remove button is not working for ubercart_hotel.
Please help me if any one has solution...
Thanks in advance...:)
Comment #4
pragna commentedI solved above problem... replace uc_cart_remove_item function to following code:
function uc_cart_remove_item($nid, $cid = NULL, $data = array(), $op = 'remove') {
if (isset($data['booking_upgrades'])) {
unset($data['booking_upgrades']);
}
if (empty($nid)) {
return;
}
$cart_id = !(is_null($cid) || empty($cid)) ? $cid : uc_cart_get_id();
// Invoke hook_uc_cart_item() with $op = 'remove' in enabled modules.
$result = db_query("SELECT c.*, n.title, n.vid FROM {node} n INNER JOIN {uc_cart_products} c ON n.nid = c.nid WHERE c.cart_id = :cart_id AND c.nid = :nid AND c.data = :data", array(':cart_id' => $cart_id, ':nid' => $nid, ':data' => serialize($data)));
if ($item = $result->fetchObject()) {
foreach (module_implements('uc_cart_item') as $module) {
$func = $module . '_uc_cart_item';
if (function_exists($func)) {
$func($op, $item);
}
}
}
db_delete('uc_cart_products')
->condition('cart_id', $cart_id)
->condition('nid', $nid)
->condition('data', serialize($data))
->execute();
}
Comment #5
larowlanAre you saying it's a bug with ubercart? I don't think that is the case, we should be able to resolve it by modifying our implementation of hook_uc_cart_item.
If so please post your fix as a patch so we can allocate it to the Ubercart issue queue.
Comment #6
pragna commentedyou are right, its not bug of Ubercart we should change the hotel_booking_uc_cart_item() in hotel_booking.ubercart.inc file.
Comment #7
zany commentedAttached patch fixes this issue. hotel_booking_uc_cart_item() doesn't need to unserialize() $item->data -- it's already unserialized in uc_cart_remove_item(). This patches just the case 'remove', the case 'load' is already ok.
(comment 2 about weight_units is a different problem.)
Comment #8
zany commentedThe above patch fixed part of the problem. The real problem is the code in hotel_booking.panes.inc line 416:
which introduces a booking_upgrades array entry into data. This then mismatches the db_query() in ubercart's uc_cart_remove_item().
I'm not sure about the fix here. But removing the empty array in hotel_booking_cart_details_table() works for me.
Comment #9
zany commentedHere is a patch to test my assumption about the empty booking_upgrades entry into data.
Comment #10
larowlanAll references to upgrades can be removed, the upgrades module is deprecated in d7.
Comment #11
zany commentedThis patch tries to remove all references to upgrades. This needs careful review!
Comment #12
larowlanI've removed the empty upgrades array from the data array.
I've not applied the rest of the upgrades removal patch as I plan to include it eventually, but just don't want it to delay a release of the module.
Comment #14
manicato commentedI applied this patch. But now, when I click the remove button, it removes not only one room reservation but all of them.
Comment #15
larowlanPlease test the 7.x-dev version and report back
Comment #16
manicato commentedThe dev version does the same thing as the beta1 version. You can't remove the rooms from the cart.
Comment #17
manicato commentedStill not resolved. Does not work with patch, does not work with "dev" version.
Comment #18
manicato commentedDoes anybody know the solution?
@larowlan You?
Comment #19
larowlanUbercart has changed the remove checkbox to a button, uc hotel needs updating to suit.
Comment #20
manicato commentedIs there a patch to correct this shortly?
Comment #21
manicato commentedI downgraded Ubercart to beta1, which still has the check boxes, but it does still not remove the reservations in the cart.
Comment #22
manicato commentedOh my god. I lost hours and hours for nothing. The patch above works, but not for reservations created before the patch.