You are here

function uc_restrict_qty_settings in Ubercart Restrict Qty 6.2

Same name and namespace in other branches
  1. 6 uc_restrict_qty.module \uc_restrict_qty_settings()
  2. 7 uc_restrict_qty.module \uc_restrict_qty_settings()
1 string reference to 'uc_restrict_qty_settings'
uc_restrict_qty_product_feature in ./uc_restrict_qty.module
Implementation of hook_product_feature().

File

./uc_restrict_qty.module, line 36
Restrict the quantity on specified products so that only specified quantity may be purchased at a time.

Code

function uc_restrict_qty_settings() {
  $form['#description'] = t('This feature is limited in scope to preventing a user from adding different products to the cart.  This does not restrict the quantity of products in the cart if updated after being added, so this feature is best used on sites where all products have a restrict quantity feature on them.');
  $form['uc_restrict_qty_global'] = array(
    '#title' => t('Global limit'),
    '#type' => 'textfield',
    '#size' => 5,
    '#maxlength' => 5,
    '#description' => t('The number of different products that can be added to a cart. Set to 0 for unlimited.'),
    '#default_value' => variable_get('uc_restrict_qty_global', 0),
  );
  $form['uc_restrict_qty_global_replace'] = array(
    '#title' => t('Replace Contents'),
    '#type' => 'checkbox',
    '#description' => t('Enabling this feature will cause the users cart to be emptied if they add more items than the Global Limit set above. This is best used when you offer mutually exclusive content (such as subscription services) where purchasing more then one product is not a valid option.'),
    '#default_value' => variable_get('uc_restrict_qty_global_replace', FALSE),
  );
  $form['defaults'] = array(
    '#title' => t('Defaults'),
    '#type' => 'fieldset',
    '#description' => t('These options will take action, only if product has the "Restrict quantity" feature activated.'),
  );
  $form['defaults']['uc_restrict_qty_default_qty'] = array(
    '#title' => t("Default maximum limit for a product"),
    '#type' => 'textfield',
    '#size' => 5,
    '#maxlength' => 5,
    '#description' => t('The number of products of single type that can be added to a cart. Set to 0 for unlimited.'),
    '#default_value' => variable_get('uc_restrict_qty_default_qty', 0),
  );
  $form['defaults']['uc_restrict_qty_default_lifetime'] = array(
    '#title' => t("Is restriction is the user's lifetime limit"),
    '#type' => 'checkbox',
    '#description' => t("Useful when you want to prevent double ordering of a product."),
    '#default_value' => variable_get('uc_restrict_qty_default_lifetime', FALSE),
  );
  return $form;
}