-
Notifications
You must be signed in to change notification settings - Fork 0
/
enable.php
330 lines (304 loc) · 17.1 KB
/
enable.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
<?php
if (!defined('IN_CMS')) { exit(); }
/**
* Catalog
*
* The catalog plugin adds a catalog or webshop to Wolf CMS.
*
* @package Plugins
* @subpackage catalog
*
* @author Nic Wortel <[email protected]>
* @copyright Nic Wortel, 2012
* @version 0.1.0
*/
Plugin::setAllSettings(array(
'layout_id' => 0,
'decimal_seperator' => 'point',
'brands_title' => 'Brands',
'brands_slug' => 'brands'
), 'catalog');
$PDO = Record::getConnection();
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_brand` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(255) NOT NULL ,
`slug` VARCHAR(255) NOT NULL ,
`description` TEXT NULL DEFAULT NULL ,
`website` VARCHAR(255) NULL DEFAULT NULL ,
`logo_id` INT UNSIGNED NULL DEFAULT NULL ,
`created_on` DATETIME NOT NULL ,
`updated_on` DATETIME NOT NULL ,
`created_by_id` INT UNSIGNED NOT NULL ,
`updated_by_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) ,
UNIQUE INDEX `name_UNIQUE` (`name` ASC) ,
UNIQUE INDEX `slug_UNIQUE` (`slug` ASC) )
ENGINE = InnoDB");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_category` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`title` VARCHAR(255) NOT NULL ,
`slug` VARCHAR(255) NOT NULL ,
`description` TEXT NULL DEFAULT NULL ,
`parent_id` INT UNSIGNED NULL DEFAULT NULL ,
`position` INT UNSIGNED NULL DEFAULT NULL ,
`created_on` DATETIME NOT NULL ,
`updated_on` DATETIME NOT NULL ,
`created_by_id` INT UNSIGNED NOT NULL ,
`updated_by_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_category_parent` (`parent_id` ASC) ,
UNIQUE INDEX `slug_UNIQUE` (`parent_id` ASC, `slug` ASC) ,
CONSTRAINT `fk_category_parent`
FOREIGN KEY (`parent_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_category` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_category` (`id`,`title`,`slug`,`description`,`parent_id`,`position`,`created_on`,`updated_on`,`created_by_id`,`updated_by_id`) VALUES (1,'Products','products',NULL,NULL,NULL,NOW(),NOW(),1,1);");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_product` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(255) NOT NULL ,
`slug` VARCHAR(255) NOT NULL ,
`description` TEXT NULL DEFAULT NULL ,
`type` VARCHAR(25) NOT NULL DEFAULT 'simple' ,
`category_id` INT UNSIGNED NOT NULL DEFAULT 1 ,
`brand_id` INT UNSIGNED NULL DEFAULT NULL ,
`created_on` DATETIME NOT NULL ,
`updated_on` DATETIME NOT NULL ,
`created_by_id` INT UNSIGNED NOT NULL ,
`updated_by_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_product_category` (`category_id` ASC) ,
INDEX `fk_product_brand` (`brand_id` ASC) ,
UNIQUE INDEX `slug_UNIQUE` (`category_id` ASC, `slug` ASC) ,
CONSTRAINT `fk_product_category`
FOREIGN KEY (`category_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_category` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_product_brand`
FOREIGN KEY (`brand_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_brand` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_vat` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(255) NOT NULL ,
`percentage` FLOAT UNSIGNED NOT NULL DEFAULT 0 ,
PRIMARY KEY (`id`) ,
UNIQUE INDEX `name_UNIQUE` (`name` ASC) )
ENGINE = InnoDB");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_product_variant` (
`id` INT NOT NULL ,
`sku` VARCHAR(50) NULL DEFAULT NULL ,
`name` VARCHAR(255) NULL DEFAULT NULL ,
`weight` FLOAT UNSIGNED NULL DEFAULT NULL ,
`price` DOUBLE UNSIGNED NULL DEFAULT NULL ,
`vat_id` INT UNSIGNED NULL DEFAULT NULL ,
`stock` INT UNSIGNED NULL DEFAULT NULL ,
`product_id` INT UNSIGNED NOT NULL ,
`created_on` DATETIME NOT NULL ,
`updated_on` DATETIME NOT NULL ,
`created_by_id` INT UNSIGNED NOT NULL ,
`updated_by_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_product_variant_product` (`product_id` ASC) ,
UNIQUE INDEX `sku_UNIQUE` (`sku` ASC) ,
INDEX `fk_product_variant_vat` (`vat_id` ASC) ,
CONSTRAINT `fk_product_variant_product`
FOREIGN KEY (`product_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_product` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
CONSTRAINT `fk_product_variant_vat`
FOREIGN KEY (`vat_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_vat` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_attribute_unit_system` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit_system` (`id`, `name`) VALUES (1, 'Metric');");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_attribute_type` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
`data_type` ENUM('BOOLEAN','INTEGER','FLOAT','VARCHAR','DATE','DATETIME') NOT NULL DEFAULT 'INT' ,
PRIMARY KEY (`id`) ,
UNIQUE INDEX `name_UNIQUE` (`name` ASC) )
ENGINE = InnoDB");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_type` (`id`, `name`, `data_type`) VALUES (1, 'Distance', 'FLOAT');");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_type` (`id`, `name`, `data_type`) VALUES (2, 'Weight', 'FLOAT');");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_type` (`id`, `name`, `data_type`) VALUES (3, 'Volume', 'FLOAT');");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_type` (`id`, `name`, `data_type`) VALUES (4, 'Temperature', 'FLOAT');");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_type` (`id`, `name`, `data_type`) VALUES (5, 'Surface', 'FLOAT');");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_type` (`id`, `name`, `data_type`) VALUES (6, 'Text', 'VARCHAR');");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_type` (`id`, `name`, `data_type`) VALUES (7, 'Color', 'VARCHAR');");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_type` (`id`, `name`, `data_type`) VALUES (8, 'Yes/No', 'BOOLEAN');");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_type` (`id`, `name`, `data_type`) VALUES (9, 'Duration', 'FLOAT');");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_type` (`id`, `name`, `data_type`) VALUES (10, 'Number', 'FLOAT');");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_attribute_unit` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
`abbreviation` VARCHAR(10) NOT NULL ,
`multiplier` FLOAT UNSIGNED NULL DEFAULT NULL ,
`parent_id` INT UNSIGNED NULL DEFAULT NULL ,
`attribute_unit_system_id` INT UNSIGNED NOT NULL ,
`attribute_type_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_attribute_unit_attribute_unit` (`parent_id` ASC) ,
INDEX `fk_attribute_unit_attribute_unit_system` (`attribute_unit_system_id` ASC) ,
INDEX `fk_attribute_unit_attribute_type` (`attribute_type_id` ASC) ,
CONSTRAINT `fk_attribute_unit_attribute_unit`
FOREIGN KEY (`parent_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_attribute_unit` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_attribute_unit_attribute_unit_system`
FOREIGN KEY (`attribute_unit_system_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_attribute_unit_system` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_attribute_unit_attribute_type`
FOREIGN KEY (`attribute_type_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_attribute_type` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit` (`id`, `name`, `abbreviation`, `multiplier`, `parent_id`, `attribute_unit_system_id`, `attribute_type_id`) VALUES (1, 'Millimeter', 'mm', 0.001, 4, 1, 1);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit` (`id`, `name`, `abbreviation`, `multiplier`, `parent_id`, `attribute_unit_system_id`, `attribute_type_id`) VALUES (2, 'Centimeter', 'cm', 0.01, 4, 1, 1);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit` (`id`, `name`, `abbreviation`, `multiplier`, `parent_id`, `attribute_unit_system_id`, `attribute_type_id`) VALUES (3, 'Decimeter', 'dm', 0.1, 4, 1, 1);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit` (`id`, `name`, `abbreviation`, `multiplier`, `parent_id`, `attribute_unit_system_id`, `attribute_type_id`) VALUES (4, 'Meter', 'm', 1, NULL, 1, 1);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit` (`id`, `name`, `abbreviation`, `multiplier`, `parent_id`, `attribute_unit_system_id`, `attribute_type_id`) VALUES (5, 'Decameter', 'dam', 10, 4, 1, 1);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit` (`id`, `name`, `abbreviation`, `multiplier`, `parent_id`, `attribute_unit_system_id`, `attribute_type_id`) VALUES (6, 'Hectometer', 'hm', 100, 4, 1, 1);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit` (`id`, `name`, `abbreviation`, `multiplier`, `parent_id`, `attribute_unit_system_id`, `attribute_type_id`) VALUES (7, 'Kilometer', 'km', 1000, 4, 1, 1);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit` (`id`, `name`, `abbreviation`, `multiplier`, `parent_id`, `attribute_unit_system_id`, `attribute_type_id`) VALUES (8, 'Milligram', 'mg', 0.001, 11, 1, 2);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit` (`id`, `name`, `abbreviation`, `multiplier`, `parent_id`, `attribute_unit_system_id`, `attribute_type_id`) VALUES (9, 'Centigram', 'cg', 0.01, 11, 1, 2);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit` (`id`, `name`, `abbreviation`, `multiplier`, `parent_id`, `attribute_unit_system_id`, `attribute_type_id`) VALUES (10, 'Decigram', 'dg', 0.1, 11, 1, 2);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit` (`id`, `name`, `abbreviation`, `multiplier`, `parent_id`, `attribute_unit_system_id`, `attribute_type_id`) VALUES (11, 'Gram', 'g', 1, NULL, 1, 2);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit` (`id`, `name`, `abbreviation`, `multiplier`, `parent_id`, `attribute_unit_system_id`, `attribute_type_id`) VALUES (12, 'Decagram', 'dag', 10, 11, 1, 2);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit` (`id`, `name`, `abbreviation`, `multiplier`, `parent_id`, `attribute_unit_system_id`, `attribute_type_id`) VALUES (13, 'Hectagram', 'hg', 100, 11, 1, 2);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute_unit` (`id`, `name`, `abbreviation`, `multiplier`, `parent_id`, `attribute_unit_system_id`, `attribute_type_id`) VALUES (14, 'Kilogram', 'kg', 1000, 11, 1, 2);");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_attribute` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(255) NOT NULL ,
`description` TEXT NULL DEFAULT NULL ,
`attribute_type_id` INT UNSIGNED NOT NULL ,
`default_unit_id` INT UNSIGNED NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_attribute_attribute_unit` (`default_unit_id` ASC) ,
INDEX `fk_attribute_attribute_type` (`attribute_type_id` ASC) ,
CONSTRAINT `fk_attribute_attribute_unit`
FOREIGN KEY (`default_unit_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_attribute_unit` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_attribute_attribute_type`
FOREIGN KEY (`attribute_type_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_attribute_type` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute` (`id`, `name`, `description`, `attribute_type_id`, `default_unit_id`) VALUES (1, 'Height', NULL, 1, 2);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute` (`id`, `name`, `description`, `attribute_type_id`, `default_unit_id`) VALUES (2, 'Width', NULL, 1, 2);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute` (`id`, `name`, `description`, `attribute_type_id`, `default_unit_id`) VALUES (3, 'Depth', NULL, 1, 2);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_attribute` (`id`, `name`, `description`, `attribute_type_id`, `default_unit_id`) VALUES (4, 'Weight', NULL, 2, 14);");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_category_attribute` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`category_id` INT UNSIGNED NOT NULL ,
`attribute_id` INT UNSIGNED NOT NULL ,
`is_filter` TINYINT(1) NOT NULL DEFAULT 0 ,
`position` INT UNSIGNED NULL DEFAULT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_category_attribute_attribute` (`attribute_id` ASC) ,
INDEX `fk_category_attribute_category` (`category_id` ASC) ,
CONSTRAINT `fk_category_attribute_attribute`
FOREIGN KEY (`attribute_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_attribute` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_category_attribute_category`
FOREIGN KEY (`category_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_category` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_category_attribute` (`id`, `category_id`, `attribute_id`, `is_filter`, `position`) VALUES (1, 1, 1, 0, NULL);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_category_attribute` (`id`, `category_id`, `attribute_id`, `is_filter`, `position`) VALUES (2, 1, 2, 0, NULL);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_category_attribute` (`id`, `category_id`, `attribute_id`, `is_filter`, `position`) VALUES (3, 1, 3, 0, NULL);");
$PDO->exec("INSERT INTO `" . TABLE_PREFIX . "catalog_category_attribute` (`id`, `category_id`, `attribute_id`, `is_filter`, `position`) VALUES (4, 1, 4, 0, NULL);");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_value_boolean` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`value` BOOLEAN NOT NULL ,
`product_variant_value_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_value_boolean_product_variant_value` (`product_variant_value_id` ASC) ,
CONSTRAINT `fk_value_boolean_product_variant_value`
FOREIGN KEY (`product_variant_value_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_product_variant_value` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_value_date` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`value` DATE NOT NULL ,
`product_variant_value_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_value_date_product_variant_value` (`product_variant_value_id` ASC) ,
CONSTRAINT `fk_value_date_product_variant_value`
FOREIGN KEY (`product_variant_value_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_product_variant_value` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_value_datetime` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`value` DATETIME NOT NULL ,
`product_variant_value_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_value_datetime_product_variant_value` (`product_variant_value_id` ASC) ,
CONSTRAINT `fk_value_datetime_product_variant_value`
FOREIGN KEY (`product_variant_value_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_product_variant_value` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_value_float` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`value` FLOAT NOT NULL ,
`product_variant_value_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_value_float_product_variant_value` (`product_variant_value_id` ASC) ,
CONSTRAINT `fk_value_float_product_variant_value`
FOREIGN KEY (`product_variant_value_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_product_variant_value` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_value_integer` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`value` INT NOT NULL ,
`product_variant_value_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_value_integer_product_variant_value` (`product_variant_value_id` ASC) ,
CONSTRAINT `fk_value_integer_product_variant_value`
FOREIGN KEY (`product_variant_value_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_product_variant_value` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB");
$PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "catalog_value_varchar` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`value` VARCHAR(255) NOT NULL ,
`product_variant_value_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_value_varchar_product_variant_value` (`product_variant_value_id` ASC) ,
CONSTRAINT `fk_value_varchar_product_variant_value`
FOREIGN KEY (`product_variant_value_id` )
REFERENCES `" . TABLE_PREFIX . "catalog_product_variant_value` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB");