# Offer

### Content

| Key                  | Type    | Description                                         |
| -------------------- | ------- | --------------------------------------------------- |
| `name`               | String  |                                                     |
| `pre_title`          | String  | If you need a line before the name of the offer     |
| `sub_title`          | String  | If you need a line after the name of the offer      |
| `short_description`  | WYSIWYG |                                                     |
| `long_description`   | WYSIWYG |                                                     |
| `configuration_text` | WYSIWYG | Additional WYSIWYG                                  |
| `email`              | String  |                                                     |
| `external_link`      | String  |                                                     |
| `booking_engine_url` | String  | The booking engine url. Usually, opens in a new tab |
| `rate`               | String  | The price of the offer. This includes the currency  |

### Configuration

| key               | Type  |                                                      |
| ----------------- | ----- | ---------------------------------------------------- |
| is\_featured      | 0 / 1 | If the offer is featured                             |
| is\_guest\_portal | 0 / 1 | If the offer should also display on the Guest Portal |

### Photos

|                  |                              |
| ---------------- | ---------------------------- |
| has\_photo       | Returns 0 or 1               |
| nb\_photo        | Returns the number of photos |
| first\_photo     |                              |
| second\_photo    |                              |
| photos           | (loop)                       |
| photos\_featured | (loop)                       |

### Documents

{% tabs %}
{% tab title="Offer detail page" %}

```markup
{if=" '{{item.nb_document}}' != '0' "}
    <ul>
        #$loop|{{item.offer_document}}|{document}| $#
        <li><a href="{document.url}">{document.titre}</a></li>
        #$/loop|{{item.offer_document}}|{document}| $#
    </ul>
{/if}
```

{% endtab %}

{% tab title="Offer list" %}

```markup
#$loop|{offer}|{a}| $#
    {if=" '{a.nb_document}' != '0' "}
        <ul>
            #$loop|{a.offer_document}|{document}| $#
            <li><a href="{document.url}">{document.titre}</a></li>
            #$/loop|{a.offer_document}|{document}| $#
        </ul>
    {/if}
#$/loop|{offer}|{a}| $#
```

{% endtab %}
{% endtabs %}

## In context data

Offers can **linked to several hotels**, and some information can be different for each hotel. For example if your offer is for HOTEL A and HOTEL B, the booking url for each of this hotel can be different.&#x20;

### **item.booking\_engine\_url**

**item.booking\_engine\_url**  : this will automatically get the correct booking url based on the current context. For example, in the context of an hotel, this will return you the correct booking url (the one for the selected hotel, or fallback to the brand or master brand url)

### item.booking\_engine\_urls

**item.booking\_engine\_urls** (loop) : allows you to loop on the different booking url that have been set for each hotel in the BO.

```
#$loop|{{item.booking_engine_urls}}|{h}| $#
    <a href="{h.url}">{h.name}</a>
#$/loop|{{item.booking_engine_urls}}|{h}| $#
```

### Highlight / Conditions:

```
{{item.highlights_in_context}}
{{item.condition_in_context}}
```

### item.hotel

**item.hotel** (loop) : allows you to loop on the different hotels linked to this offer.

{% tabs %}
{% tab title="TC DEFAULT unit" %}

```markup
<!-- On offer detail page --->
#$loop|{{item.hotel}}|{h}| $#
    {h.id}
    {h.name}
    {h.brand_id}
    {h.region.id} - {h.region.name}
    {h.location.id} - {h.location.city}
    {h.country.id} - {h.country.name} - {h.country.continent}
    {h.telephone}
    {h.city}
    {h.googlecountry}
    {h.first_photo}
#$/loop|{{item.hotel}}|{h}| $#
```

{% endtab %}

{% tab title="TC GROUP unit" %}

```
#$loop|{{item.hotel}}|{h}| $#
    {h.id}
    {h.name}
    {h.brand_id}
    {h.region.id} - {h.region.name} 
    {h.location.id} - {h.location.city} 
    {h.country.id} - {h.country.name} - {h.country.continent}
    {h.telephone}
    {h.googlecountry}
    {h.offer_booking_url}
    {h.hotel_first_photo}
    {h.hotel_offer_rate}
#$/loop|{{item.hotel}}|{h}| $#
```

{% endtab %}
{% endtabs %}

## Get offers by category

If you want to let the user choose the category:

```markup
<!-- Get offers of a specific category.
#$variable|category$# is a variable type "unit", 
module name "category_offer_mb" -->

#$loop|{offer,[category_id=#$variable|category$#]}|{a}| $#
<div>{a.name}</div>
#$/loop|{offer,[category_id=#$variable|category$#]}|{a}| $#
```

## Get offers by hotel (group website)

If you are using a variable to decide which hotel:

```markup
#$loop|{offer,[hotel_id=#$variable|hotel$#]}|{a}| $#
<div>{a.name}</div>
#$/loop|{offer,[hotel_id=#$variable|hotel$#]}|{a}| $#
```

## Group Detail Offer linking to property detail offer

{% hint style="info" %}
This case is pretty complex, make sure you have the correct configuration (group website with detail page, property website with offer detail page)
{% endhint %}

If you have a configuration with:

* 1 group website (with offer detail page)
* N property websites (with offer detail page)

And from the detail page offer in a group website you have a list of linked hotels, with a link to the offer detail page in the hotel website. There is a specific function created for this use case.

Code inside the group **offer detail page** where you will use `{detail_page(a.id,3,'offer')}`

```markup
<!-- This needs to be inside an offer detail page -->
{if=" '{{item.nb_hotel}}' != '0' "}
  #$loop|{{item.hotel}}|{a}|$#
      <div>
        hotel name = {a.name} -
        {if=" '{detail_page(a.id,3,'offer')}' "}
          <a href="{detail_page(a.id,3,'offer')}">link to detail page in property website</a>
        {/if}
      </div>
  #$/loop|{{item.hotel}}|{a}|$#
{else}
  <div>No hotels</div>
{/if}
```

The only thing here that needs to be adapted is `a.id` , it can be different if your loop is not using "a" but something else. Make sure when you copy it not to add extra spaces.

This function will search for the offer detail page in the website that is attached to the hotel (`a.id`)

{% hint style="info" %}
The link of the offer detail page can be the "live URL" (with the domain) not the local website link.&#x20;
{% endhint %}
