hook_customer_info

Definition

hook_customer_info()
ecommerce-5--4/docs/developer/hooks/ec_customer.php, line 45

Description

General description.

Warning: at the moment if you don't specify 'store_addresses', some parts of ecommerce will make it 'true' by default (see third arg of ec_customer_get_attr() and the frequent calls which set the third arg to true.) This means that the attributes which are marked 'optional' below are not actually optional -- you should really set all these attributes for the time being.

Return value

An array of settings that define the customer type. The key of the array is: Customer type, something like 'user', 'anonymous'. Some like 'user' are special 'user' refers to a local user in your installation - you can then avoid additional customer hooks because they're already provided. The inner array has: 'name' = human readable 'module' = the implementing module 'settings_path' = a Drupal internal path to settings. 'weight' = default weight, can be configured later anyway. 'store_addresses' = true if the customer type manages storing addresses. 'add_address' = true if the customer type can handle adding additional addresses

Related topics

Namesort iconDescription
HooksAllow modules to interact with the Drupal core.

Code

<?php
function hook_customer_info() {
  return array('user' =>
    array(
      // Required
      'name' => t('Address module customers'),
      'description' => t('Attach addresses to Drupal users which can be used for transactions'),
      'module' => 'address',
      'settings_path' => 'admin/ecsettings/ctype/address', // Can be omitted.
      // The following can be omitted and the values indicate the defaults if omitted.
      'weight' => 0,
      'store_addresses' => false,
      'add_address' => false,
    );
  );
}
?>