Reference

Ticket

Whenever you’re dealing with a ticket in your template, you’re actually working with a Ticket object.

Properties

id

Type: int|null

The ID of the ticket.

title

Type: string|null

The ticket title.

event

Type: Event|null

The ticket’s associated Event.

eventId

Type: int|null

The ID of the event this ticket belongs to.

type

Type: TicketType|null

The ticket’s associated ticket type.

typeId

Type: int|null

The ID of the ticket’s type.

sku

The SKU (Stock Keeping Unit) of the ticket.

price

Type: float

The listing price of the ticket.

Methods

getCpEditUrl()

Returns the URL to edit this ticket in the control panel.

getIsAvailable()

Returns: bool

Whether this ticket is available for purchase. This will be true unless the 'Available From/To' dates do not match the current time, or if the ticket has been fully purchased.

Read Session and Type Details

Use ticket.stock for the number of whole tickets available to purchase and ticket.remainingSeats for the number of seats remaining. They differ when a ticket admits more than one person. Capacity and purchased-seat counts continue to use seats.

A Ticket combines a session and a ticket type. Read the date from its session and the sale window from its type. For example, in a template where ticket is a Ticket returned by a ticket query:

{% if ticket.session %}
    <p>{{ ticket.session.startDate | date('medium') }}</p>
{% endif %}

{% if ticket.type and ticket.type.availableFrom %}
    <p>Available from {{ ticket.type.availableFrom | date('medium') }}</p>
{% endif %}

Use the cart or order line item for the quantity being purchased. A generated Ticket is the purchasable definition, not a customer's line-item quantity.