[-] INSTALLER : Last fix of bug #PSCFV-8168 loyalty ADD id_shop to layered_product_attribute
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
function p1540_add_missing_columns()
|
||||
{
|
||||
$errors = array();
|
||||
$id_module = Db::getInstance()->getValue('SELECT id_module FROM `'._DB_PREFIX_.'module` WHERE name="loyalty"');
|
||||
$id_module = Db::getInstance()->getValue('SELECT id_module FROM `'._DB_PREFIX_.'module` WHERE name LIKE "loyalty"');
|
||||
if ($id_module)
|
||||
{
|
||||
$list_fields = Db::getInstance()->executeS('SHOW FIELDS FROM `'._DB_PREFIX_.'loyalty`');
|
||||
@@ -35,9 +35,22 @@ function p1540_add_missing_columns()
|
||||
$list_fields[$k] = $field['Field'];
|
||||
|
||||
if (in_array('id_discount', $list_fields))
|
||||
if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'loyalty` CHANGE `id_discount` `id_cart_rule` INT( 10 ) UNSIGNED NULL DEFAULT NULL '))
|
||||
$errors[] = Db::getInstance()->getMsgError();;
|
||||
if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'loyalty` CHANGE `id_discount` `id_cart_rule` INT( 10 ) UNSIGNED NULL DEFAULT NULL'))
|
||||
$errors[] = Db::getInstance()->getMsgError();
|
||||
}
|
||||
|
||||
$id_module = Db::getInstance()->getValue('SELECT id_module FROM `'._DB_PREFIX_.'module` WHERE name LIKE "blocklayered"');
|
||||
if ($id_module)
|
||||
{
|
||||
$list_fields = Db::getInstance()->executeS('SHOW FIELDS FROM `'._DB_PREFIX_.'layered_product_attribute`');
|
||||
foreach ($list_fields as $k => $field)
|
||||
$list_fields[$k] = $field['Field'];
|
||||
|
||||
if (!in_array('id_shop', $list_fields))
|
||||
if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'layered_product_attribute` ADD `id_shop` INT( 10 ) UNSIGNED NOT NULL DEFAULT "1" AFTER `id_attribute_group` '))
|
||||
$errors[] = Db::getInstance()->getMsgError();
|
||||
}
|
||||
|
||||
if (count($errors))
|
||||
return array('error' => 1, 'msg' => implode(',', $errors)) ;
|
||||
}
|
||||
Reference in New Issue
Block a user