|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* TechDivision\Import\Product\Variant\Utils\SqlStatements |
|
5
|
|
|
* |
|
6
|
|
|
* NOTICE OF LICENSE |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
|
9
|
|
|
* that is available through the world-wide-web at this URL: |
|
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
|
11
|
|
|
* |
|
12
|
|
|
* PHP version 5 |
|
13
|
|
|
* |
|
14
|
|
|
* @author Tim Wagner <[email protected]> |
|
15
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
|
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
17
|
|
|
* @link https://github.com/techdivision/import-product-variant |
|
18
|
|
|
* @link http://www.techdivision.com |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Product\Variant\Utils; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Utility class with the SQL statements to use. |
|
25
|
|
|
* |
|
26
|
|
|
* @author Tim Wagner <[email protected]> |
|
27
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
|
28
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
29
|
|
|
* @link https://github.com/techdivision/import-product-variant |
|
30
|
|
|
* @link http://www.techdivision.com |
|
31
|
|
|
*/ |
|
32
|
|
|
class SqlStatements extends \TechDivision\Import\Product\Utils\SqlStatements |
|
33
|
|
|
{ |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* The SQL statement to load an existing product relation with the passed parent/child ID. |
|
37
|
|
|
* |
|
38
|
|
|
* @var string |
|
39
|
|
|
*/ |
|
40
|
|
|
const PRODUCT_RELATION = 'SELECT * |
|
41
|
|
|
FROM catalog_product_relation |
|
42
|
|
|
WHERE parent_id = :parent_id |
|
43
|
|
|
AND child_id = :child_id'; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* The SQL statement to load an existing product super link with the passed prodcut/parent ID. |
|
47
|
|
|
* |
|
48
|
|
|
* @var string |
|
49
|
|
|
*/ |
|
50
|
|
|
const PRODUCT_SUPER_LINK = 'SELECT * |
|
51
|
|
|
FROM catalog_product_super_link |
|
52
|
|
|
WHERE product_id = :product_id |
|
53
|
|
|
AND parent_id = :parent_id'; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* The SQL statement to load an existing product super attribute with the passed product/attribute ID. |
|
57
|
|
|
* |
|
58
|
|
|
* @var string |
|
59
|
|
|
*/ |
|
60
|
|
|
const PRODUCT_SUPER_ATTRIBUTE = 'SELECT * |
|
61
|
|
|
FROM catalog_product_super_attribute |
|
62
|
|
|
WHERE product_id = :product_id |
|
63
|
|
|
AND attribute_id = :attribute_id'; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* The SQL statement to load an existing product super attribute label with the passed product super attribute/store ID. |
|
67
|
|
|
* |
|
68
|
|
|
* @var string |
|
69
|
|
|
*/ |
|
70
|
|
|
const PRODUCT_SUPER_ATTRIBUTE_LABEL = 'SELECT * |
|
71
|
|
|
FROM catalog_product_super_attribute_label |
|
72
|
|
|
WHERE product_super_attribute_id = :product_super_attribute_id |
|
73
|
|
|
AND store_id = :store_id'; |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* The SQL statement to create a new product relation. |
|
77
|
|
|
* |
|
78
|
|
|
* @var string |
|
79
|
|
|
*/ |
|
80
|
|
|
const CREATE_PRODUCT_RELATION = 'INSERT |
|
81
|
|
|
INTO catalog_product_relation ( |
|
82
|
|
|
parent_id, |
|
83
|
|
|
child_id |
|
84
|
|
|
) |
|
85
|
|
|
VALUES (:parent_id, |
|
86
|
|
|
:child_id)'; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* The SQL statement to create a new product super link. |
|
90
|
|
|
* |
|
91
|
|
|
* @var string |
|
92
|
|
|
*/ |
|
93
|
|
|
const CREATE_PRODUCT_SUPER_LINK = 'INSERT |
|
94
|
|
|
INTO catalog_product_super_link ( |
|
95
|
|
|
product_id, |
|
96
|
|
|
parent_id |
|
97
|
|
|
) |
|
98
|
|
|
VALUES (:product_id, |
|
99
|
|
|
:parent_id)'; |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* The SQL statement to create a new product super attribute. |
|
103
|
|
|
* |
|
104
|
|
|
* @var string |
|
105
|
|
|
*/ |
|
106
|
|
|
const CREATE_PRODUCT_SUPER_ATTRIBUTE = 'INSERT |
|
107
|
|
|
INTO catalog_product_super_attribute ( |
|
108
|
|
|
product_id, |
|
109
|
|
|
attribute_id, |
|
110
|
|
|
position |
|
111
|
|
|
) |
|
112
|
|
|
VALUES (:product_id, |
|
113
|
|
|
:attribute_id, |
|
114
|
|
|
:position)'; |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* The SQL statement to update an existing product super attribute. |
|
118
|
|
|
* |
|
119
|
|
|
* @var string |
|
120
|
|
|
*/ |
|
121
|
|
|
const UPDATE_PRODUCT_SUPER_ATTRIBUTE = 'UPDATE catalog_product_super_attribute |
|
122
|
|
|
SET product_id = :product_id, |
|
123
|
|
|
attribute_id = :attribute_id, |
|
124
|
|
|
position = :position |
|
125
|
|
|
WHERE product_super_attribute_id = :product_super_attribute_id'; |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* The SQL statement to create a new product super attribute label. |
|
129
|
|
|
* |
|
130
|
|
|
* @var string |
|
131
|
|
|
*/ |
|
132
|
|
|
const CREATE_PRODUCT_SUPER_ATTRIBUTE_LABEL = 'INSERT |
|
133
|
|
|
INTO catalog_product_super_attribute_label ( |
|
134
|
|
|
product_super_attribute_id, |
|
135
|
|
|
store_id, |
|
136
|
|
|
use_default, |
|
137
|
|
|
value |
|
138
|
|
|
) |
|
139
|
|
|
VALUES (:product_super_attribute_id, |
|
140
|
|
|
:store_id, |
|
141
|
|
|
:use_default, |
|
142
|
|
|
:value)'; |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* The SQL statement to update an existing product super attribute label. |
|
146
|
|
|
* |
|
147
|
|
|
* @var string |
|
148
|
|
|
*/ |
|
149
|
|
|
const UPDATE_PRODUCT_SUPER_ATTRIBUTE_LABEL = 'UPDATE catalog_product_super_attribute_label |
|
150
|
|
|
SET product_super_attribute_id = :product_super_attribute_id, |
|
151
|
|
|
store_id = :store_id, |
|
152
|
|
|
use_default = :use_default, |
|
153
|
|
|
value = :value |
|
154
|
|
|
WHERE value_id = :value_id'; |
|
155
|
|
|
} |
|
156
|
|
|
|