i18n_commerce_product.install in Internationalization for commerce product 7
Installation file for i18n_commerce_product module.
File
i18n_commerce_product.installView source
<?php
/**
* @file
* Installation file for i18n_commerce_product module.
*/
/**
* Implements hook_schema_alter().
*/
function i18n_commerce_product_schema_alter(&$schema) {
// Add field to existing schema.
$schema['commerce_product']['fields']['tproduct_id'] = array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => 0,
'description' => 'The translation set id for this commerce product, which equals the product id of the source post in each set.',
);
}
/**
* Implements hook_install().
*/
function i18n_commerce_product_install() {
if (!db_field_exists('commerce_product', 'tproduct_id')) {
db_add_field('commerce_product', 'tproduct_id', array(
'description' => 'The translation set id for this commerce product, which equals the product id of the source post in each set.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => 0,
));
}
db_drop_unique_key('commerce_product', 'sku');
db_add_unique_key('commerce_product', 'sku', array(
'sku',
'language',
));
}
/**
* Implements hook_uninstall().
*/
function i18n_commerce_product_uninstall() {
if (db_field_exists('commerce_product', 'tproduct_id')) {
db_drop_field('commerce_product', 'tproduct_id');
}
db_drop_unique_key('commerce_product', 'sku');
db_add_unique_key('commerce_product', 'sku', array(
'sku',
));
}
Functions
Name | Description |
---|---|
i18n_commerce_product_install | Implements hook_install(). |
i18n_commerce_product_schema_alter | Implements hook_schema_alter(). |
i18n_commerce_product_uninstall | Implements hook_uninstall(). |