You are here

function commerce_multicurrency_rules_action_info in Commerce Multicurrency 7

Implements hook_rules_action_info().

File

./commerce_multicurrency.rules.inc, line 52
Commerce Multicurrency rules integration.

Code

function commerce_multicurrency_rules_action_info() {
  $actions = array();

  // Register method to set currency code as rules action.
  $actions['commerce_multicurrency_set_user_currency_code'] = array(
    'label' => t('Set the user currency to use'),
    'parameter' => array(
      'currency_code' => array(
        'type' => 'text',
        'label' => t('The currency code to use'),
        'options list' => 'commerce_currency_code_options_list',
        'save' => FALSE,
      ),
      'overwrite_cookie' => array(
        'type' => 'boolean',
        'label' => t("Set currency even if it's defined in a cookie."),
        'optional' => TRUE,
        'default value' => TRUE,
        'save' => FALSE,
      ),
    ),
    'group' => t('Commerce Multicurrency'),
  );

  // Register method to make a simple currency conversion.
  $actions['commerce_multicurrency_currency_conversion'] = array(
    'label' => t('Convert price to another currency'),
    'parameter' => array(
      'commerce_price' => array(
        'type' => 'commerce_price',
        'label' => t('The commerce price to use'),
        'save' => FALSE,
      ),
      'currency' => array(
        'type' => 'text',
        'label' => t('The target currency'),
        'options list' => 'commerce_currency_code_options_list',
        'save' => FALSE,
      ),
    ),
    'provides' => array(
      'result' => array(
        'type' => 'commerce_price',
        'label' => t('Converted price'),
      ),
    ),
    'group' => t('Commerce Multicurrency'),
  );
  return $actions;
}