Quick Inventory Search Widget

The quick search widget provides 4 different view types, allowing a user to search for a show or event and/or search for an appropriate performance. All views are responsive, provided you are using the pre-built CSS.

Embedding the Widget

  1. Get your channel-d (affiliate id).
    1. Request this from your account manager or reach out to using the contact us button
  2. Create a new html page and add the following markup, switching the configurable data in braces with your own.
<!doctype html>
<html lang="en">
  <head>
    <title>Quick search example</title>
  </head>
  <body>
    <div
        data-app="inventory-app"
        data-action-url="{http://your-website-url/destination-page.html}"
        data-channel-id="{your-channel-id}"
        data-view-name="quick-search-with-validation"
        data-with-calendar="true"
        data-api-path="https://inventory-service.tixuk.io"
    ></div>
    <script type="text/javascript" src="https://inventory-service.tixuk.io/v5/js/quicksearch.js"></script>
  </body>
</html>
  1. Customise where you want
    1. the following data attributes are used to customise the behaviour or 'look and feel' of the Quick Search widget.
NameMandatoryTypeSourced From String QueryDescription
data-appyesstringn/aIndicates the host app to communicate with.
Example: inventory-app
data-api-pathyesstringn/aThe host for the data service to use. This should be the fully qualified domain for the relevant capability service.
Example: <https://inventory-service.tixuk.io/
data-product-typeyesstringn/aValid values are: show and attraction
data-product-idyesnumberproduct_idIdentifier of the product to limit the quick search to. This also requires product type to be set. If a value is provided, the search box will not be visible. (
data-affiliate-idyesstringn/aGiven to you by TTG
data-view namenostringn/asee below section
data-action-urlnostringn/aDestination to redirect to on quick search submission.
Example: http://your-website-url/destination-page.html
data-booking-startsno*datebooking_startsRepresents the first date a user can select (the availability is calculated "from" this date).

*Data-attr can be omitted in favour of property being supplied via query string. Query string values override data-attrs.
data-booking-endsno*datebooking_endsepresents the last date a user can select (the availability is calculated "to" this date)

*Data-attr can be omitted in favour of property being supplied via query string. Query string values override data-attrs.
data-css-modenostringn/a
data-labels-confignojson objectSet of labels to use for the Quick Search widget. See "Configuring labels" below for more details.
data-product-id-for-contentno*numbercontent_product_idIdentifier of the product for content-service api calls.
Default value: data-product-id

- Data-attr can be omitted in favor of property being supplied via query string. Query string values override data-attrs.
data-venue-idnostringvenue_idIdentifier of the location where product is shown
data-with-calendarnobooleann/aA flag indicating if the date and time selectors are to be displayed in the Quick Search widget.
data-user-localenostringn/aA string indicating language for labels display (check "configuring labels" section below)
data-target-blanknobooleann/aA flag indicating opening data-action-url in the current/new tab
data-show-matineenobooleann/aA flag indicating if the calendar will highlight dates with matinee shows
data-show-from-pricenobooleann/aA flag indicating if the calendar will show from price for each day available
data-show-spinner-during-widget-loadingnobooleann/adata-show-spinner-during-widget-loading

Supported view modes

Search with calendar

This view displays a full search, additional data attribute:

  • data-with-calendar="true"
<div
    data-app="inventory-app"
    data-action-url="{http://your-website-url}"
    data-channel-id="{your-channel-id}"
    data-api-path="https://inventory-service.tixuk.io"
    data-with-calendar="true"
></div>

Search with ticket selector

Display a search box without the calendar selectors. No additional data attributes.

<div
    data-app="inventory-app"
    data-action-url="{http://your-website-url}"
    data-channel-id="{your-channel-id}"
    data-api-path="https://inventory-service.tixuk.io"
></div>

Product ticket selector

Display a ticket selector for a pre-selected Product. Additional data attributes:

  • data-product-id
  • data-product-type
  • data-venue-id
<div
    data-app="inventory-app"
    data-action-url="{http://your-website-url}"
    data-channel-id="{your-channel-id}"
    data-api-path="https://inventory-service.tixuk.io"
    data-product-id="{product-id}"
    data-product-type="{show|attraction}"
    data-venue-id="{venue-id}"
></div>

Product ticket selector with calendar

Display a ticket with calendar selector for a pre-selected product. Additional data attrinbutes:

  • data-product-id
  • data-venue-id
  • data-product-type
  • data-with-calendar
<div
    data-app="inventory-app"
    data-action-url="{http://your-website-url}"
    data-channel-id="{your-channel-id}"
    data-with-calendar="true"
    data-product-id="{product-id}"
    data-product-type="{show|attraction}"
    data-venue-id="{venue-id}"
    data-booking-ends="{booking start date e.g. 2019-01-10}"
    data-booking-starts="{booking end date e.g. 2020-10-10}"
    data-api-path="https://inventory-service.tixuk.io"
></div>

Product ticket selector with calendar and validation

Display a ticket with calendar selector for a pre-selected product and validation. Additional attributes:

  • data-view-name
  • data-product-id
  • data-venue-id
  • data-product-type
  • data-with-calendar
<div
    data-app="inventory-app"
    data-view-name="quick-search-with-validation"
    data-action-url="{http://your-website-url}"
    data-channel-id="{your-channel-id}"
    data-with-calendar="true"
    data-product-id="{product-id}"
    data-product-type="{show|attraction}"
    data-venue-id="{venue-id}"
    data-booking-ends="{2019-09-29}"
    data-booking-starts="{2019-03-19}"
    data-api-path="https://inventory-service.tixuk.io"
></div>

Configuring labels

The Quick Search widget comes with some default text labels, but these can be customised to your liking. To do so, use the "data-labels-config" attribute, like so:


<div
    data-app="inventory-app"
    data-view-name="quick-search-with-validation"
    data-action-url="https://ticket.londontheatre.co.uk/booking#/seating-plan"
    data-channel-id="londontheatredd"
    data-css-mode="full"
    data-with-calendar=true
    data-api-path="https://inventory-service.tixuk.io"
    data-user-locale="en-GB"
    data-labels-config='{
        "searchFieldPlaceholder": {
          "en-GB": "Find a show...",
          "fr-FR": "Trouver un spectacle..."
        },
        "singleTicketLabel": {
          "en-GB": "Item",
          "fr-FR": "Item"
        },
        "multipleTicketsLabel": {
          "en-GB": "Items",
          "fr-FR": "Éléments"
        },
        "datePlaceholder": {
          "en-GB": "Pick a date",
          "fr-FR": "Choisissez une date"
        }, 
        "timePlaceholder": {
          "en-GB": "Choose a time",
          "fr-FR": "Choisissez une heure"
        }, 
        "searchButton": {
          "en-GB": "Search Now!",
          "fr-FR": "Rechercher maintenant!"
        }
    }'
>
</div>

Listening to events

The following events are raised by the Inventory widget:

EventDescriptionRaised when using...
inventory-app_quicksearch-submitRaised on quicksearch submissionInventory widget on any quicksearch view
inventory-app_quicksearch_focusRaised on quicksearch focus (any field)Inventory widget on any quicksearch view
inventory-app_quicksearch_on_availability_responseRaised on quicksearch rendering when widget check for date availabilityInventory widget on quicksearch compact view (with preselected product)
inventory-app_number-of-tickets_openRaised on Number of Tickets click by optionInventory widget on Number of Tickets view
inventory-app_time_openRaised on Time selector opening and time selectionTime selector in any Inventory widget view
inventory-app_data-attributes-validation-failedRaised when data-atrribute validation failedAll quicksearch widgets

Example code for listening to these events (and logging to console):

window.addEventListener("inventory-app_quicksearch-submit", function(e) {
  console.log("inventory-app_quicksearch-submit", e);
});