// MERGE product_multistore branch : product fields are now editable per shop
This commit is contained in:
@@ -1,38 +1,38 @@
|
||||
SET NAMES 'utf8';
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_group_shop` (
|
||||
`id_group_shop` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_shop_group` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(64) CHARACTER SET utf8 NOT NULL,
|
||||
`share_customer` TINYINT(1) NOT NULL,
|
||||
`share_order` TINYINT(1) NOT NULL,
|
||||
`share_stock` TINYINT(1) NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`deleted` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id_group_shop`)
|
||||
PRIMARY KEY (`id_shop_group`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
INSERT INTO `PREFIX_group_shop` (`id_group_shop`, `name`, `active`, `deleted`, `share_stock`, `share_customer`, `share_order`) VALUES (1, 'Default', 1, 0, 0, 0, 0);
|
||||
INSERT INTO `PREFIX_group_shop` (`id_shop_group`, `name`, `active`, `deleted`, `share_stock`, `share_customer`, `share_order`) VALUES (1, 'Default', 1, 0, 0, 0, 0);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_shop` (
|
||||
`id_shop` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_group_shop` int(11) unsigned NOT NULL,
|
||||
`id_shop_group` int(11) unsigned NOT NULL,
|
||||
`name` varchar(64) CHARACTER SET utf8 NOT NULL,
|
||||
`id_category` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_theme` INT(1) UNSIGNED NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`deleted` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`),
|
||||
KEY `id_shop_group` (`id_shop_group`),
|
||||
KEY `id_category` (`id_category`),
|
||||
KEY `id_theme` (`id_theme`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `PREFIX_shop`
|
||||
(`id_shop`, `id_group_shop`, `name`, `id_category`, `id_theme`, `active`, `deleted`)
|
||||
(`id_shop`, `id_shop_group`, `name`, `id_category`, `id_theme`, `active`, `deleted`)
|
||||
VALUES
|
||||
(1, 1, (SELECT value FROM `PREFIX_configuration` WHERE name = 'PS_SHOP_NAME'), 1, 1, 1, 0);
|
||||
|
||||
ALTER TABLE `PREFIX_configuration` ADD `id_group_shop` INT(11) UNSIGNED DEFAULT NULL AFTER `id_configuration` , ADD `id_shop` INT(11) UNSIGNED DEFAULT NULL AFTER `id_group_shop`;
|
||||
ALTER TABLE `PREFIX_configuration` ADD `id_shop_group` INT(11) UNSIGNED DEFAULT NULL AFTER `id_configuration` , ADD `id_shop` INT(11) UNSIGNED DEFAULT NULL AFTER `id_shop_group`;
|
||||
ALTER TABLE `PREFIX_configuration` DROP INDEX `name` , ADD INDEX `name` ( `name` ) ;
|
||||
ALTER TABLE `PREFIX_configuration` ADD INDEX (`id_group_shop`);
|
||||
ALTER TABLE `PREFIX_configuration` ADD INDEX (`id_shop_group`);
|
||||
ALTER TABLE `PREFIX_configuration` ADD INDEX (`id_shop`);
|
||||
INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, 'PS_SHOP_DEFAULT', '1', NOW(), NOW());
|
||||
|
||||
@@ -123,9 +123,9 @@ CREATE TABLE `PREFIX_currency_shop` (
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
INSERT INTO `PREFIX_currency_shop` (id_shop, id_currency) (SELECT 1, id_currency FROM PREFIX_currency);
|
||||
|
||||
ALTER TABLE `PREFIX_cart` ADD `id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_cart` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`, ADD INDEX `id_group_shop` (`id_group_shop`), ADD INDEX `id_shop` (`id_shop`);
|
||||
ALTER TABLE `PREFIX_cart` ADD `id_shop_group` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_cart` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_shop_group`, ADD INDEX `id_shop_group` (`id_shop_group`), ADD INDEX `id_shop` (`id_shop`);
|
||||
|
||||
ALTER TABLE `PREFIX_customer` ADD `id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_customer` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`, ADD INDEX `id_group_shop` (`id_group_shop`), ADD INDEX `id_shop` (`id_shop`);
|
||||
ALTER TABLE `PREFIX_customer` ADD `id_shop_group` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_customer` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_shop_group`, ADD INDEX `id_shop_group` (`id_group_shop`), ADD INDEX `id_shop` (`id_shop`);
|
||||
|
||||
ALTER TABLE `PREFIX_orders` ADD `id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_order` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`, ADD INDEX `id_group_shop` (`id_group_shop`), ADD INDEX `id_shop` (`id_shop`);
|
||||
|
||||
|
||||
@@ -2,4 +2,141 @@
|
||||
|
||||
ALTER TABLE `PREFIX_supplier` DROP `id_address`;
|
||||
|
||||
UPDATE `PREFIX_meta` SET `page` = 'contact' WHERE `page` = 'contact-form';
|
||||
UPDATE `PREFIX_meta` SET `page` = 'contact' WHERE `page` = 'contact-form';
|
||||
|
||||
RENAME TABLE `PREFIX_group_shop` TO `PREFIX_shop_group`;
|
||||
ALTER TABLE `PREFIX_shop_group` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `PREFIX_shop` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_stock_available` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_cart` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_configuration` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_connections` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_customer` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_delivery` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_orders` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_page_viewed` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_specific_price` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_product` ADD `id_tax_rules_group` int(10) unsigned NOT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_product_shop_TMP` (
|
||||
`id_product` int(10) unsigned NOT NULL,
|
||||
`id_shop` int(10) unsigned NOT NULL,
|
||||
`id_category_default` int(10) unsigned DEFAULT NULL,
|
||||
`id_tax_rules_group` INT(11) UNSIGNED NOT NULL,
|
||||
`on_sale` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`online_only` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`ecotax` decimal(17,6) NOT NULL DEFAULT '0.000000',
|
||||
`minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1',
|
||||
`price` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`wholesale_price` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`unity` varchar(255) DEFAULT NULL,
|
||||
`unit_price_ratio` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`additional_shipping_cost` decimal(20,2) NOT NULL DEFAULT '0.00',
|
||||
`customizable` tinyint(2) NOT NULL DEFAULT '0',
|
||||
`text_fields` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`active` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`available_for_order` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`available_date` date NOT NULL,
|
||||
`condition` enum('new','used','refurbished') NOT NULL DEFAULT 'new',
|
||||
`show_price` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`indexed` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`visibility` enum('both','catalog','search','none') NOT NULL DEFAULT 'both',
|
||||
`cache_default_attribute` int(10) unsigned DEFAULT NULL,
|
||||
`advanced_stock_management` tinyint(1) default '0' NOT NULL,
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_product`, `id_shop`),
|
||||
KEY `id_category_default` (`id_category_default`),
|
||||
KEY `date_add` (`date_add`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
INSERT INTO `PREFIX_product_shop_TMP` (`id_product`, `id_shop`, `id_category_default`, `on_sale`, `online_only`, `ecotax`, `minimal_quantity`, `price`, `wholesale_price`, `unity`, `unit_price_ratio`, `additional_shipping_cost`, `customizable`, `text_fields`, `active`, `available_for_order`, `available_date`, `condition`, `show_price`, `indexed`, `visibility`, `cache_default_attribute`, `advanced_stock_management`, `date_add`, `date_upd`, `id_tax_rules_group`)
|
||||
(SELECT a.`id_product`, a.`id_shop`, b.`id_category_default`, b.`on_sale`, b.`online_only`, b.`ecotax`, b.`minimal_quantity`, b.`price`, b.`wholesale_price`, b.`unity`, b.`unit_price_ratio`, b.`additional_shipping_cost`, b.`customizable`, b.`text_fields`, b.`active`, b.`available_for_order`, b.`available_date`, b.`condition`, b.`show_price`, b.`indexed`, b.`visibility`, b.`cache_default_attribute`, b.`advanced_stock_management`, b.`date_add`, b.`date_upd`, c.`id_tax_rules_group` FROM `PREFIX_product_shop` a INNER JOIN `PREFIX_product` b ON a.id_product = b.id_product LEFT JOIN `PREFIX_product_tax_rules_group_shop` c ON b.id_product = c.id_product AND a.id_shop = c.id_shop);
|
||||
DROP TABLE `PREFIX_product_shop`;
|
||||
DROP TABLE `PREFIX_product_tax_rules_group_shop`;
|
||||
RENAME TABLE `PREFIX_product_shop_TMP` TO `PREFIX_product_shop`;
|
||||
|
||||
CREATE TABLE `PREFIX_product_attribute_shop` (
|
||||
`id_product_attribute` int(10) unsigned NOT NULL,
|
||||
`id_shop` int(10) unsigned NOT NULL,
|
||||
`wholesale_price` decimal(20,6) NOT NULL default '0.000000',
|
||||
`price` decimal(20,6) NOT NULL default '0.000000',
|
||||
`ecotax` decimal(17,6) NOT NULL default '0.00',
|
||||
`unit_price_impact` decimal(17,2) NOT NULL default '0.00',
|
||||
`default_on` tinyint(1) unsigned NOT NULL default '0',
|
||||
`minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1',
|
||||
`available_date` date NOT NULL,
|
||||
PRIMARY KEY (`id_product_attribute`, `id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
INSERT INTO `PREFIX_product_attribute_shop` (`id_product_attribute`, `id_shop`, `wholesale_price`, `price`, `ecotax`, `unit_price_impact`, `default_on`, `minimal_quantity`, `available_date`) (SELECT `id_product_attribute`, (SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'PS_SHOP_DEFAULT'), `wholesale_price`, `price`, `ecotax`, `unit_price_impact`, `default_on`, `minimal_quantity`, `available_date` FROM `PREFIX_product_attribute`);
|
||||
|
||||
INSERT INTO `PREFIX_attribute_shop` (`id_attribute`, `id_shop`) (SELECT a.id_attribute, c.id_shop FROM PREFIX_attribute_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_attribute_shop` (
|
||||
`id_attribute` INT(11) UNSIGNED NOT NULL,
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_attribute`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_attribute_group_shop`;
|
||||
|
||||
INSERT INTO `PREFIX_feature_shop` (`id_feature`, `id_shop`) (SELECT a.id_feature, c.id_shop FROM PREFIX_feature_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_feature_shop` (
|
||||
`id_feature` INT(11) UNSIGNED NOT NULL,
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_feature`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_feature_group_shop`;
|
||||
|
||||
INSERT INTO `PREFIX_group_shop` (`id_group`, `id_shop`) (SELECT a.id_group, c.id_shop FROM PREFIX_group_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_group_shop` (
|
||||
`id_group` INT( 11 ) UNSIGNED NOT NULL,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_group`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_group_group_shop`;
|
||||
|
||||
INSERT INTO `PREFIX_attribute_group_shop` (`id_attribute_group`, `id_shop`) (SELECT a.id_attribute_group, c.id_shop FROM PREFIX_attribute_group_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_attribute_group_shop` (
|
||||
`id_attribute_group` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_attribute_group`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_attribute_group_group_shop`;
|
||||
|
||||
INSERT INTO `PREFIX_tax_rules_group_shop` (`id_tax_rules_group`, `id_shop`) (SELECT a.id_tax_rules_group, c.id_shop FROM PREFIX_tax_rules_group_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_tax_rules_group_shop` (
|
||||
`id_tax_rules_group` INT( 11 ) UNSIGNED NOT NULL,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_tax_rules_group`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_tax_rules_group_group_shop`;
|
||||
|
||||
INSERT INTO `PREFIX_zone_shop` (`id_zone`, `id_shop`) (SELECT a.id_zone, c.id_shop FROM PREFIX_zone_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_zone_shop` (
|
||||
`id_zone` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_zone`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_zone_group_shop`;
|
||||
|
||||
INSERT INTO `PREFIX_manufacturer_shop` (`id_manufacturer`, `id_shop`) (SELECT a.id_manufacturer, c.id_shop FROM PREFIX_manufacturer_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_manufacturer_shop` (
|
||||
`id_manufacturer` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL ,
|
||||
PRIMARY KEY (`id_manufacturer`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_manufacturer_group_shop`;
|
||||
|
||||
INSERT INTO `PREFIX_supplier_shop` (`id_supplier`, `id_shop`) (SELECT a.id_supplier, c.id_shop FROM PREFIX_supplier_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group);
|
||||
CREATE TABLE `PREFIX_supplier_shop` (
|
||||
`id_supplier` INT( 11 ) UNSIGNED NOT NULL,
|
||||
`id_shop` INT( 11 ) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_supplier`, `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
DROP TABLE `PREFIX_supplier_group_shop`;
|
||||
|
||||
@@ -19,7 +19,6 @@ CREATE TABLE `PREFIX_product_tax_rules_group_shop` (
|
||||
|
||||
INSERT INTO `PREFIX_product_tax_rules_group_shop` (`id_product`, `id_tax_rules_group`, `id_shop`)
|
||||
(SELECT `id_product`, `id_tax_rules_group`, `id_shop` FROM `PREFIX_product`, `PREFIX_shop`);
|
||||
ALTER TABLE `PREFIX_product` DROP `id_tax_rules_group`;
|
||||
|
||||
CREATE TABLE `PREFIX_carrier_tax_rules_group_shop` (
|
||||
`id_carrier` int( 11 ) unsigned NOT NULL,
|
||||
|
||||
Reference in New Issue
Block a user