6

I started a project that required me to create a site selling tickets to a nightclub for special events.

People attending the event must be able to buy a ticket or multiple tickets, and add a ticket holders name for each ticket. They are then sent a confirmation e-mail with their tickets attached as individual tickets with bar codes.

  • I tried Ticket but this did not integrate with commerce as easily as I had liked.
  • I tried the COD distribution which has ticket installed, and their own custom module to link it to commerce. However, I personally don't like distributions. I find they have too much un-needed stuff with them, and I don't like waiting on them to update core when security updates are needed.
  • I also tried the Commerce Tickets module, which looked promising, but the ticket holder name data was not easily accessible, or available in views. As well as a series of bugs, and a maintainer who seemed non existent, this didnt seem like an option either.
  • I also tried Commerce Booking but that didnt do what I wanted it to, and if the cart module is enabled a lot of errors are generated

Therefore I determined my only option was to create the functionality myself, hopefully using only contributed modules, and not too much custom stuff. I am posting an immediate answer to provide help for anyone in the same situation. I am not looking for other answers to this question unless you have something really cool to share!

15

Here is the method I used. It covered all of the functionality I needed, and we ended up with a very robust website, using popular well maintained modules, and getting the exact results we needed.

Modules used

  1. Commerce
  2. Commerce_agree_terms
  3. Commerce_autosku
  4. Commerce_cart_expiration
  5. Commerce_event_ticket (For PDF creation)
  6. Commerce_stock
  7. Date API
  8. Inline Entity Form
  9. Rules
  10. Views

These were the main ones. There are also modules these rely on, and others I used for other purposes. But I am trying to keep this to the ticket functionality only, rather than explain how to build an entire site.

Method

  1. Enable all modules.
  2. Create a commerce product called "Ticket" (Or re-name the default enabled product).
  3. Manage the fields on the "Ticket" content type, and add a date field called "booking window". This should collect a start and end date, and will allow an admin to define when these tickets are available for sale.
  4. Enable Commerce Stock on the Ticket Product to allow an admin to define the amount of tickets available for each ticket.
  5. Create a content type called "Event".
  6. Add an In-line Entity field allowing the user to create new products (Tickets). Allow unlimited values on this field if you wish (This allows a user to add an Early Bird Ticket, Standard, VIP etc.). We also disable "Allow a user to add existing products" as we want unique products to be created for every event. This is where the autosku module comes in handy for auto generation.
  7. Add a date field for the event date.

Once that is done, you have the basic functionality. You can create an "Event" node, add a ticket or multiple tickets (defining price, stock and booking window), add your event date and click save.

Next Steps

  1. Next you will need to manage the display for the content type "Event" and hide the display of the tickets field.
  2. Create a new view Block Display called "Ticket Display" for products. Add a field to show products (Tickets) as an add to cart form.
  3. Add a contextual filter "nid" and set the default value as "get content ID from URL".
  4. Add a filter to the view for the product (Tickets) booking window start date and use relative date "now" to only show products with a start date less than "now" and another filter with end date greater than "now".
  5. Go to structure > blocks, find your view block display, and restrict the block to only show on "event" content types. This will now mean the tickets only show on their referenced nodes, and only if the booking window is open. They will also be disabled if out of stock.

Adding a ticket holders names

  1. Manage the fields of the line items. Store > Configuration > Line item types > Product (Ticket) > Manage fields. Add a field for "Ticket holders name".
  2. On the "Ticket holders name" field settings, make sure you select "Include this field on Add to Cart forms for line items of this type".

Sending tickets to customers

  1. After enabling the commerce event ticket module, follow the modules instructions to generate a PDF for every ticket product.

For a full working demo of this, look here.. http://www.dev.thelhp.co.uk/ Please note this site is in development for now, but will try and charge you when it goes live!

  • Cheers mate! :-) Almost finished! – Collins Sep 10 '15 at 15:08
  • 2
    It would be cool if you could make this into a base distribution that people could use to build such a site. – user5013 Sep 10 '15 at 18:41
  • Did you have different types of tickets per event? For example Adult, Child, Family? or would this maybe be a field on the ticket with just a select list of options? – Teegan Mar 1 '18 at 3:55
  • Sorry I re-read your answer and can see where you would have your different ticket types. One of my requirements is that we have a pool of 200 tickets, not 50 Adult, 50 Child, etc. Maybe I would have to do this with rules. – Teegan Mar 1 '18 at 5:19
0

Check out these modules :

commerce_booking

This module provides tools to use Drupal Commerce as a powerful event booking system. Any entity can be an 'event' and a single booking can contain any number of tickets.

commerce_event_ticket

Commerce Event Ticket automatically creates 'ticket' entities when customers purchase products in a Drupal Commerce store. There are submodules for creating ticket PDFs, and for validating tickets via a REST API.

A separate ticket is created for every unit purchased. In other words, the number of tickets is equal to the line item quantity.

Each ticket has a unique, random barcode.

  • In the answer I provided, I did use commerce event ticket. It doesnt provide any of the functionality needed in the OP, just a PDF ticket. I also tried commerce booking, but it wasnt suitable due to the amount of errors when cart is enabled. – Collins Sep 10 '15 at 15:20
0

I think you should consider adding 2 more modules to the list of modules you used, i.e. the Flag and Message modules. These modules would allow you to implement, with hardly any extra effort, additional features such as:

  • Bookmarking of events (by each user).
  • Something similar to a "like" button.
  • I'm interested in receiving more info about a specific event.
  • Keep me informed about similar events in the future.
  • Etc.

I bet your sales/marketing people would really like to know which kinds of events have been "flagged" by which users, or all sorts of statistics about these events.

Note: both modules integrate very well with the Rules module also.

  • Good suggestions. – user5013 Sep 10 '15 at 18:42
  • Yeah it wasn't necessary in our use case, but I can see how that addition would benefit other projects. – Collins Sep 11 '15 at 8:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.