hello,

when creating a room type content i can assign
some products' attributes but when i'm trying to book
that room i can't view the attributes choosen.

example :
attribute "person" with a list selection :
"normal person : 0€ from that price" and "company : -10€ from that price"

this for each room content.
when modifying the room node, i see the attributes but not when seeing that node
for booking it.

what i'm trying to do :
- 2 room types (single and double rooms),
- normal person/company person (10€ discount, actually trying with attributes),
- 1,2 and 3 persons per room (pricing with the rates modifier : ok).

is there something i missed please ?

CommentFileSizeAuthor
#7 room_accessories.zip5.17 KBsylvainblot

Comments

aem34’s picture

sorry i forgot :

i tried to do a modifier for this in the module,
but the modifiers aren't allowing for negative money values.

larowlan’s picture

Hi
Unfortunately the module doesn't work with Ubercart attributes.
That said though, you can achieve what you need using hook_form_alter if you're comfortable writing a module.
If you're not I can point you in the right direction.
What you're trying to achieve is not dissimilar to what was being attempted here (http://drupal.org/node/1071866#comment-4156546) - you just need to add a new field to the search box for type of person, then you need to modify the search results (the prices are value fields in the search results form).
If you're completely new to module building, there's a module called module_builder that will help you scaffold a module, but seeing as though you really only need one function, you can probably start by just making the info file and module files manually.
Lee

aem34’s picture

Status: Active » Postponed
ludp’s picture

Is comment #2 (Ubercart attributes not supporte) still true for version 7.x-1.0-alpha1?

larowlan’s picture

The 7.x version is more sympathetic to other modules at the time of adding items to the cart, in so far as that it calls module_invoke_all('uc_add_to_cart_data', $form_state) which is where the uc_attributes modules ordinarily adds it's data to the cart item.
What it doesn't do is add the attributes form to the search results/book now form (the form on the room node) - however you can do this with an implementation of hook_form_alter that mimics how uc_attributes adds it's form elements to the standard ubercart add to cart form.

sylvainblot’s picture

@larowlan I'm on my way to implement attribute support for d7.
what do you recommend? a submodule or modify hotel_booking ?

attributes affect the price so the function that handle the price calculation can be changed to :
hotel_booking_calculate_prices(
$check_in,
$check_out,
$rooms,
$adults,
$children,
$smoking,
$attributes,
$values
);

Is there an ubercart function to get the sum of all attributes ?

sylvainblot’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Component: Miscellaneous » Code
Status: Postponed » Needs review
StatusFileSize
new5.17 KB

Here is a submodule written by @larowlan, I've made some minor changes. It works on D7.

This not real room attributes but a page that is used as redirect after a booking that list products such as breakfast, wifi ect.

Default quantity is set to the last booking stay duration.

Please review ! Thanks

phuongnam3k’s picture

Thanks sylvainblot,
But how to configure it, sorry I'm a newbie. I have installed it but cannot find how to set up the "room attributes" like you said.

How it works?

Thanks,

sylvainblot’s picture

@phuongnam3k
In admin/store/hotel_booking/hotel_settings change your redirect URL to hotel-booking/accessories
Create a new ubercart product and it should appear on the list displayed after a room is added in the cart

sygnetica’s picture

Here is a submodule written by @larowlan, I've made some minor changes. It works on D7.

This not real room attributes but a page that is used as redirect after a booking that list products such as breakfast, wifi ect.

Default quantity is set to the last booking stay duration.

Please review ! Thanks

Hi.

I have problem with module Room Accessories:

Notice: Trying to get property of non-object in room_accessories_form_alter() (line 41 of /home/irsapart/public_html/sites/all/modules/room_accessories/room_accessories.module).
Warning: in_array() expects parameter 2 to be array, null given w room_accessories_form_alter() (line 41 of /home/irsapart/public_html/sites/all/modules/room_accessories/room_accessories.module).

Ubercart 7.x-3.0-rc3
Hotel Booking 7.x-1.0-beta1

Any idea ? Thanks

EDIT: Solution

- if(in_array("nights", $latest->data))
+ if(!empty($latest->data) && in_array("nights", $latest->data))