# nats\_list\_options

Alias: list\_options

## Parameters

(*Required parameters in bold)*

| Parameter | Description                                         | Possible Values            | Default Value                | Example    |
| --------- | --------------------------------------------------- | -------------------------- | ---------------------------- | ---------- |
| site      | The I.D. number of the site to get join options for | Any valid site I.D. number | The default site I.D. number | site="123" |

## Output

A list of all the available join options for a site in the {$options} Smarty variable. A list of option details for a site in the {$options\_details} Smarty variable.

## Notes

You can use the list\_options function to add more information (Ex: price) to the Join Page for each site.<br>

By calling {list\_options site=1} in your template, you can populate the $options array, and the $option\_details array with all the join options available for site 1. An example of the contents of these arrays is as follows.

$option\_details

```
Array (2)
4 => Array (14)
  optionid => "4"
  siteid => "5"
  networkid => "0"
  deleted => "0"
  enabled => "1"
  orderid => "1"
  option_type_id => "0"
  billerid => "0"
  programid => "0"
  initial => "10"
  initial_days => "30"
  rebill => "5"
  rebill_days => "30"
  name => "Our most popular service!"
5 => Array (15)
  optionid => "5"
  siteid => "5"
  networkid => "0"
  deleted => "0"
  enabled => "0"
  orderid => "2"
  option_type_id => "0"
  billerid => "0"
  programid => "0"
  initial_free => "1"
  initial => "100"
  initial_days => "2"
  rebill => "60"
  rebill_days => "30"
  name => "Our next most popular service"
```

$options

```
Array (2)
4 => "Our most popular service!"
5 => "Our next most popular service!"
```

The arrays generated by {list\_options} will contain all the join options for a given site, regardless of whether they satisfy the display rules. If you need to access the join options that satisfy the join option rules, you can use the $join\_options array. This will contain the name of all the join options that satisfy the join option rules. An example of its contents are follows:

```
Array (1)
4 => "Our most popular service!"
```

## Example

For example, to add the price of each join option next to its description you can edit the join page template as follows.\
Replace the line below:\
{html\_options options=$join\_options selected=$vars.optionid}\
with:

```
        {list_options site=$site}
	{foreach from=$join_options key=k item=v}
		<option>{$v} - ${$option_details[$k].initial}</option>
		{*shows the description of the join_option followed by a '-', followed by the initial price of the join option*}
	{/foreach}
```

Instead of displaying "Our most popular service" in the list box, this will display "Our most popular service - $10".
