Hello,
I want to add some more fields like
1: Type of accommodation
2: Country
3: Destination
in Room search form block of uc_hotel module
How i can add the fields in search form .
Any body can help me. I really need this to complete my website

Thanks

Comments

larowlan’s picture

Status: Active » Fixed

Hi
The module's forms are built using the Drupal form api.
You can use hook_form_alter to add your fields and manipulate the search results.
See api.drupal.org for more information on hook_form_alter.

Lee

larowlan’s picture

Category: feature » support
Priority: Major » Normal
cis.drupal’s picture

Thanks for you help.

Ok i can add the other fields from form alter then how my new fields would involve in search.

larowlan’s picture

There's a drupal_alter('hotel_booking_available_rooms') in the module but the search results are also a form.
If you analyse the form you'll see there's $form['results'] for the results - these are keyed by node and you can access your fields from form_state['values']. You can unset the invalid ones.

cis.drupal’s picture

Thank you for your kind help.

But i alter form hook form alter - hotel_booking_search_form
From my custom module but i did not get any way to involve my search filter in its search.
i try to alter hotel_booking_search_results but not found any form.

I struck over here for the right way.

Thanks

larowlan’s picture

Hi
It's the same form (hotel_booking_search_form), but the results are appended, something like this will get you started (you need the devel module installed):

function MYMODULE_form_hotel_booking_search_form_alter(&$form, $form_state) {
  if (isset($form['results'])) {
    dsm($form['results']); // You can see how the results are structured here.
    dsm($form_state['values']); //You can access your custom field values here
  }
}

Obviously change MYMODULE to your module's name

cis.drupal’s picture

Thanks for your kind help.

It works now for me.:)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

larowlan’s picture

Title: Want to add some more filed in search room block of uc_hotel » Add additional fields to search form