Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi everybody i wish that this will find you well.
i have a problem with uc_hotel module, i want to add a select
list("destination") to the room search block and involve it to the search engine.
I tried to create my hook module (customsearch) with 2 files .module and
.info. I made into .module file my hook fucntion and i tried some tricks i
could create a select list but i couldn't involve it in my room search engine
and I want also reorder the form to place my select list before the submite button.
Please if you can help me step by step cause I m beginner I will be gratefull.
Comments
Comment #1
larowlanHi
To get you started have a look here: #1071866: Add additional fields to search form.
If you like, post what you've done so far and I'll review it.
Regarding weighting of elements, the actual layout of the search form is governed by the template (hotel_booking_search_form.tpl.php from memory) - if you copy that to your theme folder, flush your caches and then edit the version in your theme folder - you should be able to add in new fields where you require theme. Have a look at the function template_preprocess_hotel_booking_search_form in the file hotel_booking.module to see how the variables are created, you can replicate elements of that logic if you define your own preprocessor in your theme's template.php
Lee
Comment #2
amineBK CreditAttribution: amineBK commentedHi.
I have already read the http://drupal.org/node/1071866 sorry i can't understand
here is what i have done. I copied the hotel_booking_search_form.tpl.php in the template folder like you told me
1. I created a new field :
print $destination;
I can see the div script but its empty
2. and I create also a new preprocess function in my them's template.php i called it template_prepro_hotel_booking_search_form
Can you please verify the function if its true and tell me what i must do after these steps
Comment #3
larowlanYou also need a form_alter hook in your module (as mentioned in the linked issue).
Please post what you have there - ie where you setup the destination field.
Also your function needs to be preprocess not prepro
Comment #4
amineBK CreditAttribution: amineBK commentedthis is my hook function but i cant involve it into the search engine
sorry if i dont understand quiqly im a beginner
custom search is my module
Comment #5
larowlantry changing $form['destination'] to $form['search']['destination']
Comment #6
amineBK CreditAttribution: amineBK commentedHi.
tell me please if i must modify the hotel_booking_theme, hotel_booking_search_results, hotel_booking_get_available_rooms, hotel_booking_search_form_submit and hotel_booking_calculate_prices functions ?
thanks
Comment #7
larowlanHi
No you don't touch any of the module functions, your module makes changes to what the module provides.
Did you get your field to work?
You can check that your module is working as expected by installing devel module and using the following code at the end of your form alter function
Comment #8
amineBK CreditAttribution: amineBK commentedSorry i tried but i cant have what i want. i will close the issue until someone will post the answer.