You are here

function commerce_price_table_rules_action_info in Commerce Price Table 7

Implements hook_rules_action_info().

File

./commerce_price_table.rules.inc, line 6

Code

function commerce_price_table_rules_action_info() {
  $actions = array();
  $actions['commerce_price_table_set_price'] = array(
    'label' => t('Set the unit price to a table based price'),
    'parameter' => array(
      'commerce_line_item' => array(
        'type' => 'commerce_line_item',
        'label' => t('Line item'),
      ),
      'quantity' => array(
        'label' => t('Quantity'),
        'type' => 'decimal',
      ),
      'price_table' => array(
        'label' => t('Price table'),
        'type' => 'list<commerce_price_table>',
      ),
      'component_name' => array(
        'type' => 'text',
        'label' => t('Price component type'),
        'description' => t('Price components track changes to prices made during the price calculation process, and they are carried over from the unit price to the total price of a line item. When an order total is calculated, it combines all the components of every line item on the order. When the unit price is altered by this action, the selected type of price component will be added to its data array and reflected in the order total display when it is formatted with components showing. Defaults to base price, which displays as the order Subtotal.'),
        'options list' => 'commerce_price_table_price_component_options_list',
        'default value' => 'base_price',
      ),
    ),
    'group' => t('Commerce Price Table'),
  );
  $actions['commerce_price_table_sum_quantities'] = array(
    'label' => t('Sum quantities for products sharing a display'),
    'parameter' => array(
      'commerce_line_item' => array(
        'type' => 'commerce_line_item',
        'label' => t('Line item'),
        'wrapped' => TRUE,
      ),
    ),
    'provides' => array(
      'combined_product_sum' => array(
        'label' => t('Combined product sum'),
        'type' => 'decimal',
      ),
    ),
    'group' => t('Commerce Price Table'),
  );
  return $actions;
}