Getting the Category ID
The code itself is pretty simple.
First, we get the information we want to store in the cookie, by fetching the first TicketItem object, using the GetAt method, and then getting the object ID of the FilmCategory object it references.
—TicketConfirm.OnPreHTTP—
TicketConfirm.OnPreHTTP
ClassMethod OnPreHTTP() As %Boolean
{
If $data(%session.Data("Order")) {
Set ord = ##class(Cinema.TicketOrder).%OpenId(%session.Data("Order"))
Set itm = ord.Items.GetAt(1)
Set cat = itm.Show.Film.Category.%Id()
// ...
}
Quit 1
}