Drupal - How do I sell tickets?
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
- Commerce
- Commerce_agree_terms
- Commerce_autosku
- Commerce_cart_expiration
- Commerce_event_ticket (For PDF creation)
- Commerce_stock
- Date API
- Inline Entity Form
- Rules
- 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
- Enable all modules.
- Create a commerce product called "Ticket" (Or re-name the default enabled product).
- 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.
- Enable Commerce Stock on the Ticket Product to allow an admin to define the amount of tickets available for each ticket.
- Create a content type called "Event".
- 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.
- 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
- Next you will need to manage the display for the content type "Event" and hide the display of the tickets field.
- Create a new view Block Display called "Ticket Display" for products. Add a field to show products (Tickets) as an add to cart form.
- Add a contextual filter "nid" and set the default value as "get content ID from URL".
- 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".
- 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
- Manage the fields of the line items. Store > Configuration > Line item types > Product (Ticket) > Manage fields. Add a field for "Ticket holders name".
- 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
- 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!