Skip to main content
Skip table of contents

Pack collections and pack collection header templates

Overview

A pack is a special kind of product that bundles together multiple products for sale as a single offering. For example, an operator might create a sports pack that includes a number of sports channels. There could be an HD version of the pack and a 4K version.

A pack collection is a collection of related packs. For example, an operator might create a sports pack collection that includes the HD sports pack and the 4K sports pack.

In Rails Builder, the operator can add pack collection items to a rail. For example, a rail could contain a sports pack collection, a movie channel pack collection, and so on.

A client application should handle pack collection items as follows:

  1. Each pack collection item in a rail will have an image associated with it. This will be a block of type internal_image or external_image in the extendedAttributes block for the item.
    The client should display this image for the item.

  2. If the user clicks on a pack collection item, the client should navigate to the template specified in the item’s template_id field in the configurationProperties block.
    The target template is a special kind of template called a Pack Collection Header template.
    Note: The template_id is specified in a key/value pair group set up specifically for this purpose. See Key/value pair groups.

  3. The client should call Content Discovery Facade to get the pack products that the pack collection contains.

  4. The client should render the Pack Collection Header template as explained below.

Rendering a Pack Collection Header template

A Pack Collection Header template is a special kind of template that is intended to be displayed when the user clicks on a pack collection in a rail.

A Pack Collection Header template does not have multiple layouts – it is intended to be applicable to all destinations.

It includes at least one rail (the header rail) that includes:

  • A placeholder block for each of the individual packs in the collection

  • Pack collection metadata (within the placeholder blocks)

  • An indication of whether the client should display a buy button for the pack

The template can be configured so that:

  • The rail that lists the packs does not include a buy button.

  • The buy button is contained in its own rail.

  • It includes other rails.

The client application needs to:

  1. In the same way as for regular templates and rails:

    1. Get the template, as explained in Retrieve the rail structure for a template

    2. Using the rail IDs from step 1, get the individual rails, as explained in Retrieve a specific rail and its contents.

  2. Call Content Discovery Facade to get the pack products for the pack collection. It does this by making a GET call to:

    BASH
    https://<host>:<port>/metadata/v1/products?pack_collection=<pack_collection_id>
  3. Render the header using the pack collection metadata. This may or may not include the buy button.

  4. Render the individual pack products from step 2 as a rail.

  5. Render any other rails in the response.

  6. Render the buy button in the appropriate location if it is returned as a separate rail in the template response.
    For example, if it is the last rail, render it below all the other rails.

The Pack Collection Header template contains a placeholder for each pack product. Each placeholder contains the details of the pack collection. This contains useful metadata (see below).

But what the client should render is the individual products that are returned by the above request.

The following sections explain the template response and the sections part of the rail responses. (The other rail fields are the same as for any other rail and are listed in Rail reponses.)

Template fields

The following table explains the fields that are returned when you request a Pack Collection Header template.

Field

Description

Meaning/actions

name

The template name

The client should display this as the title of the page if title is null.

title

The template title

If title is not null, the client should use this as the title of the page.

targets

The target destination(s) for the layout

If this is an empty array, it applies to all destinations.

You do not need to do anything with targets – the layout that is returned will always be the correct one for the client’s destination type.

properties

Additional properties that have been set for the template

Such properties may be used, for example, to tell the client that a particular template/page should be styled in a particular way.

rails

The rails that the template contains

There will be one or more rails:

  • One for the pack header, containing details of the pack collection (as sections within one rail), including a buy button
    This rail has a type of header in its configurationProperties.
    Note that the header can be configured to hide the buy button so that it can be added as a separate rail.

  • Optionally, one to display the buy button separately (so that additional rails can be added between the header and the buy button if required)
    This rail has a type of buttonContainer in its configurationProperties.

  • Any other rails that have been added to the template

The fields and objects in these rail objects are the same as those listed in Rail reponses.

In this case, you do not need to make additional calls to get the rail contents – they are included in the template response.

The client should render the rails to display the packs as required. (The client needs to retrieve the pack products through an additional request as explained above.)

See Sections, below.

If an additional drill-down level is required (so that clicking on a pack takes the user to a new page displaying the pack contents), the additional templates must be added in Rails Builder.

The packs in the rails in this template must have the appropriate key/value pair group added to them in Rails Builder so that each one has a template ID that the client can use to request and navigate to the correct destination template.

Sections

The Pack Collection Header rail contains one or more sections. These contain information about the pack collection, not the pack products that the pack collection contains. The sections contain information that the client should display, including the collection title, the collection description, and (optionally) the buy button.

As explained above, the client needs to make an additional call to get the actual pack products.

The following table explains the contents of each section:

Field

Description

Meaning/actions

properties

Any properties that have been set for the section

Usually not used

contents

The details of the pack collection

The following fields can be used when rendering the rail:

  • recurrence – the billing period recurrence

  • purchaseText – the text to be used on the buy button together with the price

  • currency – the currency for subscription purchases

  • purchasePrice – the purchase price (the lowest of the prices for the available packs)

  • locale – the locale. (If details have been provided for multiple locales, there will be one block for each locale.)

  • Title – the pack collection title

  • Description – the pack collection description

includeTrailers

Whether trailers are included

Not relevant here

trailerCount

Number of trailers included

Not relevant here

configurationProperties

The instance name and type

The values allow you to see which section is for the header and which for the buy button:

  • packCollectionDetails – header

  • packCollectionBuyButton – buy button

collectionId

The ID of the pack collection

N/A

type

The type, in this case, PackCollectionItem

N/A

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.