You are here

function _commerce_discount_extra_offer_field_instances in Commerce Discount Extra 7

Returns an array of field instances to be defined on this module's discount offer types.

1 call to _commerce_discount_extra_offer_field_instances()
commerce_discount_extra_install in ./commerce_discount_extra.install
Implements hook_install().

File

./commerce_discount_extra.install, line 222
Installs necessary fields for extra discounts.

Code

function _commerce_discount_extra_offer_field_instances() {
  return array(
    'commerce_trigger_qty' => array(
      'field_name' => 'commerce_trigger_qty',
      'entity_type' => 'commerce_discount_offer',
      'label' => t('Buy #'),
      'required' => TRUE,
      'widget' => array(
        'weight' => 0,
      ),
    ),
    'commerce_trigger_products' => array(
      'field_name' => 'commerce_trigger_products',
      'entity_type' => 'commerce_discount_offer',
      'label' => t('Of any of these trigger products'),
      'description' => t('Leave blank to trigger the discount when <em>any</em> product is purchased.'),
      'widget' => array(
        'type' => 'commerce_product_reference_autocomplete',
        'weight' => 5,
      ),
    ),
    'commerce_discount_products' => array(
      'field_name' => 'commerce_discount_products',
      'entity_type' => 'commerce_discount_offer',
      'label' => t('Of any of these offer products'),
      'required' => TRUE,
      'widget' => array(
        'type' => 'commerce_product_reference_autocomplete',
        'weight' => 15,
      ),
    ),
    'commerce_trigger_categories' => array(
      'field_name' => 'commerce_trigger_categories',
      'label' => t('Products in these trigger categories'),
      'description' => t('Category names will autocomplete as you type. Use commas to separate multiple values.'),
      'entity_type' => 'commerce_discount_offer',
      'required' => TRUE,
      'settings' => array(
        'text_processing' => 0,
      ),
      'widget' => array(
        'weight' => 5,
        'type' => 'text_textarea',
        'module' => 'text',
        'settings' => array(
          'rows' => 1,
        ),
      ),
    ),
    'commerce_offer_categories' => array(
      'field_name' => 'commerce_offer_categories',
      'label' => t('Products in these offer categories'),
      'description' => t('Category names will autocomplete as you type. Use commas to separate multiple values.'),
      'entity_type' => 'commerce_discount_offer',
      'required' => TRUE,
      'settings' => array(
        'text_processing' => 0,
      ),
      'widget' => array(
        'weight' => 15,
        'type' => 'text_textarea',
        'module' => 'text',
        'settings' => array(
          'rows' => 1,
        ),
      ),
    ),
    'commerce_offer_qty' => array(
      'field_name' => 'commerce_offer_qty',
      'entity_type' => 'commerce_discount_offer',
      'label' => t('Get up to #'),
      'required' => TRUE,
      'widget' => array(
        'weight' => 10,
      ),
    ),
    'commerce_percentage' => array(
      'field_name' => 'commerce_percentage',
      'entity_type' => 'commerce_discount_offer',
      'bundle' => 'per_quantity_percentage',
      'label' => t('Discounted by'),
      'required' => TRUE,
      'settings' => array(
        'suffix' => t('% as a decimal (e.g. .2 for 20% off)'),
      ),
      'widget' => array(
        'weight' => 20,
      ),
    ),
    'commerce_fixed_amount' => array(
      'field_name' => 'commerce_fixed_amount',
      'entity_type' => 'commerce_discount_offer',
      'label' => t('Discounted by'),
      'required' => TRUE,
      'widget' => array(
        'weight' => 20,
      ),
    ),
    'commerce_offer_limit' => array(
      'field_name' => 'commerce_offer_limit',
      'entity_type' => 'commerce_discount_offer',
      'default_value' => NULL,
      'required' => FALSE,
      'label' => t('On up to #'),
      'settings' => array(
        'min' => 0,
        'suffix' => t('different products (leave blank for no limit)'),
      ),
      'widget' => array(
        'weight' => 25,
      ),
    ),
    'commerce_pricing_strategy' => array(
      'label' => t('Use the following discounting strategy'),
      'widget' => array(
        'weight' => 30,
        'type' => 'options_buttons',
        'active' => TRUE,
        'settings' => array(),
      ),
      'required' => TRUE,
      'default_value' => array(
        0 => array(
          'value' => 'low_first',
        ),
      ),
      'field_name' => 'commerce_pricing_strategy',
      'entity_type' => 'commerce_discount_offer',
    ),
    'commerce_auto_add_behavior' => array(
      'label' => t('When enough trigger products are in the cart but no offer products have been added'),
      'widget' => array(
        'weight' => 35,
        'type' => 'options_buttons',
        'active' => TRUE,
        'settings' => array(),
      ),
      'required' => TRUE,
      'default_value' => array(
        0 => array(
          'value' => 'nothing',
        ),
      ),
      'field_name' => 'commerce_auto_add_behavior',
      'entity_type' => 'commerce_discount_offer',
    ),
  );
}