You are here

function uc_product_settings_overview in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_product/uc_product.admin.inc \uc_product_settings_overview()

Display overview of product settings.

See also

uc_product_settings_form

uc_product_field_settings_form

1 string reference to 'uc_product_settings_overview'
uc_product_menu in uc_product/uc_product.module
Implementation of hook_menu().

File

uc_product/uc_product.module, line 1854
The product module for Ubercart.

Code

function uc_product_settings_overview() {
  $items[] = t('Teaser and catalog pages = %text', array(
    '%text' => variable_get('uc_teaser_add_to_cart_text', t('Add to cart')),
  ));
  $items[] = t('Product view pages = %text', array(
    '%text' => variable_get('uc_product_add_to_cart_text', t('Add to cart')),
  ));
  $buttons = t('<em>Add to Cart</em> submit button text:') . theme('item_list', $items);
  $sections[] = array(
    'edit' => 'admin/store/settings/products/edit',
    'title' => t('Product settings'),
    'items' => array(
      t('Showing !number products per page.', array(
        '!number' => variable_get('uc_product_nodes_per_page', 10),
      )),
      t('The <em>Add to Cart</em> form is !status in product teasers.', array(
        '!status' => variable_get('uc_product_add_to_cart_teaser', TRUE) ? t('enabled') : t('disabled'),
      )),
      t('The Quantity field in the <em>Add to Cart</em> form is !status.', array(
        '!status' => variable_get('uc_product_add_to_cart_qty', FALSE) ? t('enabled') : t('disabled'),
      )),
      $buttons,
    ),
  );
  $options = array(
    'model' => t('Model'),
    'image' => t('Image'),
    'display_price' => t('Display price'),
    'list_price' => t('List price'),
    'cost' => t("Cost (seen only by 'administer products' permission)"),
    'sell_price' => t('Sell price'),
    'weight' => t('Weight'),
    'dimensions' => t('Dimensions'),
    'add_to_cart' => variable_get('uc_product_add_to_cart_text', t('Add to cart')),
  );
  $enabled = variable_get('uc_product_field_enabled', array(
    'model' => 'model',
    'image' => 'image',
    'display_price' => 'display_price',
    'sell_price' => 'sell_price',
    'add_to_cart' => 'add_to_cart',
  ));
  $weight = variable_get('uc_product_field_weight', array(
    'image' => -2,
    'display_price' - 1,
    'model' => 0,
    'list_price' => 2,
    'cost' => 3,
    'sell_price' => 4,
    'weight' => 5,
    'dimensions' => 6,
    'add_to_cart' => 10,
  ));
  $fields = array();
  foreach ($options as $field => $label) {
    if ($enabled[$field]) {
      $fields[$field] = array(
        'enabled' => $enabled[$field],
        'weight' => $weight[$field],
        'data' => $label,
      );
    }
  }
  uasort($fields, 'uc_weight_sort');
  $sections[] = array(
    'edit' => 'admin/store/settings/products/edit/fields',
    'title' => t('Product fields'),
    'items' => array(
      t('Displayed product fields: !list', array(
        '!list' => theme('item_list', $fields),
      )),
    ),
  );
  foreach (module_invoke_all('product_feature') as $feature) {
    $features[] = $feature['title'];
  }
  if (!empty($features)) {
    $items = array(
      t('The following features are enabled: !list', array(
        '!list' => theme('item_list', $features),
      )),
    );
  }
  else {
    $items = array(
      t('No product features enabled.'),
    );
  }
  $sections[] = array(
    'edit' => 'admin/store/settings/products/edit/features',
    'title' => t('Product features'),
    'items' => $items,
  );
  $output = theme('uc_settings_overview', $sections);
  return $output;
}