Permalink
Browse files

[-] INSTALLER : Last fix of bug #PSCFV-8168 loyalty ADD id_shop to la…

…yered_product_attribute
  • Loading branch information...
1 parent e1f3f16 commit 65ef8c705335536de1309f2a4326dbd3cd90e475 @gRoussac gRoussac committed Mar 26, 2013
Showing with 16 additions and 3 deletions.
  1. +16 −3 install-dev/upgrade/php/p1540_add_missing_columns.php
@@ -27,17 +27,30 @@
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`');
foreach ($list_fields as $k => $field)
$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)) ;
}

0 comments on commit 65ef8c7

Please sign in to comment.