Tags/topics: 
1
Answers
Vote up!
0
Vote down!

Small Ecotour company booking solution

Hi DC community,
Okay, I've been researching this for a few days now, and I need a little direction. I don't think this has really been covered in other posts, but feel free to direct me to a similar use case if you know of one.

I run a small climbing tour business in Alaska. I'm very versed in Drupal, but I'm not a PHP developer by any means. What I'm looking to create is a solution for our company to allow our customers to register for one of our climbing tours online.

I'm looking at having the user fill out and submit a webform that collects the type of tour desired, contact information, tour time, etc.

Here's where it gets tricky. Once the user submits a tour request, I want our staff to be able to review the reservation, and if everything looks right (we have availability, customer is fit enough to climb, etc), I want to be able to "approve" the reservation. On approval, the user should be redirected to a payment gate that allows them to pay for the tour they selected in the initial webform process. Once they have paid, I need their submitted webform to reflect that they have paid and are now "confirmed"

I know this is a very specific use case, but there are dozens of small tour companies like mine that currently have no adequate and affordable booking solutions, and I feel like the answer lies in Drupal and Drupal Commerce. This would be like the Holy Grail for my fellow eco-tour companies.

Any direction or suggestions from those folks out there that are way smarter than I am would be beyond appreciated. Thanks in advance, DC community!

Asked by: Abenezer
on December 21, 2012

1 Answer

Vote up!
0
Vote down!

If by '... I'm not a PHP developer...' you mean you don't write any code, then my suggestions might not be helpful. I apologize in advance if that's the case. I don't believe you'll be able to accomplish what you want without getting your hands a little dirty in some code ;)

Attach the fields you need from a customer to the commerce_order bundle. Can do this in hook_install(), using field_create_field() and field_create_instance(). I prefer to create the fields in the UI and use Field Inspector (http://drupal.org/project/field_inspector) or Features (http://drupal.org/project/features) to export the field config and instance arrays since they can be pretty big. You can create them on a test content type and just remember to change the 'bundle', and 'entity_type' properties to 'commerce_order'. The order edit page uses field_attach_form() so adding these fields to the commerce_order bundle should have them automatically added to the order edit form.

You can then use hook_commerce_checkout_pane_info() and field_attach_form() to place the desired fields (from your updated commerce_order bundle) as form elements in a checkout page. You can always just unset() fields you don't want before returning the form array.

So now you have the form in checkout with all the data you'd like to collect from a customer, and you have the means of seeing that data via order edit. I think the tricky part is payment being an asynchronous process. It will depend on your chosen payment gateway, and whether you want to leave the order in a 'Shopping Cart' state and email the user a link to get back there (with the proper permissions, and the gateway enabled), or to send them a link directly to the gateway making sure you've got all the details pre-populated so they don't need to fill in their info again. Either way you're looking at creating some Rules that fire on event 'After updating an existing commerce order' and have a condition be that order status is 'Complete' or some custom status you want it to be to mark that the order can move forward to payment (use hook_commerce_order_status_info()).

Answer by: michfuer
Posted: May 13, 2013