Newer
Older
<?php
/**
* Implements hook_install().
*/
function commerce_product_ui_install() {
// Create the basic product type.
$product_type = commerce_product_ui_product_type_new();
$product_type['type'] = 'product';
$product_type['name'] = t('Product');
$product_type['description'] = t('A basic product type.');
$product_type['is_new'] = TRUE;
Ryan Szrama
committed
commerce_product_ui_product_type_save($product_type, FALSE);
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
}
/**
* Implements hook_schema().
*/
function commerce_product_ui_schema() {
$schema = array();
$schema['commerce_product_type'] = array(
'description' => 'Stores information about {commerce_product} types created via Product UI.',
'fields' => array(
'type' => array(
'description' => 'The machine-readable name of this type.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'name' => array(
'description' => 'The human-readable name of this type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'description' => array(
'description' => 'A brief description of this type.',
'type' => 'text',
'not null' => TRUE,
'size' => 'medium',
),
'help' => array(
'description' => 'Help information shown to the user when creating a {commerce_product} of this type.',
'type' => 'text',
'not null' => TRUE,
'size' => 'medium',
),
Andrei Mateescu
committed
'revision' => array(
'description' => 'Determine whether to create a new revision when a product of this type is updated.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array('type'),
);
return $schema;
}
Andrei Mateescu
committed
/**
* Add support for product revisions.
*/
function commerce_product_ui_update_7100() {
$product_type_revision_spec = array(
'description' => 'Determine whether to create a new revision when a product of this type is updated.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
);
db_add_field('commerce_product_type', 'revision', $product_type_revision_spec);
return t('Support for product revisions has been added to product types.');
}