Skip to the content
Documentation

currency_list

No ratings yet

Summary

Fetches the available currencies.

Usage

fetch( 'shop', 'currency_list' [, hash( 'status', status )] )

Parameters

Name Type Description Required
status string The status of the target currencies. No.

Returns

An array of ezcurrencydata objects or FALSE.

Description

This function fetches the available currencies and returns an array of ezcurrencydata objects. The resulting array starts with the most recently added currency. When the optional "status" parameter is used then only currencies with the specified status will be fetched.

Examples

Example 1

{def $currency_list = fetch( 'shop', 'currency_list' )}
{if count( $currency_list )}
    {foreach $currency_list as $Currency}
          {$Currency.code} <br />
    {/foreach}
{else}
    There are no currencies.
{/if}

Outputs the currency codes for all the available currencies.

Example 2

{def $currency_list = fetch( 'shop', 'currency_list', hash( 'status', 'active' ) )}
{if count( $currency_list )}
    The following currencies are active: <br />
    {foreach $currency_list as $Currency}
          {$Currency.code} <br />
    {/foreach}
{else}
    There are no active currencies.
{/if}

Outputs the currency codes for active currencies only.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.