You are here

function uc_catalog_install in Ubercart 6.2

Same name and namespace in other branches
  1. 8.4 uc_catalog/uc_catalog.install \uc_catalog_install()
  2. 5 uc_catalog/uc_catalog.install \uc_catalog_install()

Implements hook_install().

Creates a Catalog vocabulary or uses one by that name that may already exist.

File

uc_catalog/uc_catalog.install, line 71
Install hooks for uc_catalog.module.

Code

function uc_catalog_install() {
  $t = get_t();

  // Find possible Product Catalog vocabulary.
  $result = db_query("SELECT vid FROM {vocabulary} WHERE name = 'Catalog'");
  if ($vocab = db_fetch_object($result)) {
    $vid = $vocab->vid;
  }
  else {

    // If none, create one.
    db_query("INSERT INTO {vocabulary} (name, description, help, relations, hierarchy, multiple, required, tags, module, weight)\n      VALUES ('%s', '', '%s', 0, 1, 1, 0, 0, 'uc_catalog', 0)", $t('Catalog'), $t('Hold Ctrl while clicking to select multiple categories.'));
    $vid = db_last_insert_id('vocabulary', 'vid');
  }
  variable_set('uc_catalog_vid', $vid);
  variable_set('uc_catalog_name', $t('Catalog'));
  drupal_install_schema('uc_catalog');
}