1 | <?php |
||
32 | class SqlStatements extends \TechDivision\Import\Product\Utils\SqlStatements |
||
33 | { |
||
34 | |||
35 | /** |
||
36 | * The SQL statement to load the actual product with the passed SKU. |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | const PRODUCT = 'SELECT * |
||
41 | FROM catalog_product_entity |
||
42 | WHERE sku = :sku |
||
43 | AND updated_in > unix_timestamp(now()) |
||
44 | ORDER BY created_in ASC'; |
||
45 | |||
46 | /** |
||
47 | * The SQL statement to load the product datetime attribute with the passed row/attribute/store ID. |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | const PRODUCT_DATETIME = 'SELECT * |
||
52 | FROM catalog_product_entity_datetime |
||
53 | WHERE row_id = :row_id |
||
54 | AND attribute_id = :attribute_id |
||
55 | AND store_id = :store_id'; |
||
56 | |||
57 | /** |
||
58 | * The SQL statement to load the product decimal attribute with the passed row/attribute/store ID. |
||
59 | * |
||
60 | * @var string |
||
61 | */ |
||
62 | const PRODUCT_DECIMAL = 'SELECT * |
||
63 | FROM catalog_product_entity_decimal |
||
64 | WHERE row_id = :row_id |
||
65 | AND attribute_id = :attribute_id |
||
66 | AND store_id = :store_id'; |
||
67 | |||
68 | /** |
||
69 | * The SQL statement to load the product integer attribute with the passed row/attribute/store ID. |
||
70 | * |
||
71 | * @var string |
||
72 | */ |
||
73 | const PRODUCT_INT = 'SELECT * |
||
74 | FROM catalog_product_entity_int |
||
75 | WHERE row_id = :row_id |
||
76 | AND attribute_id = :attribute_id |
||
77 | AND store_id = :store_id'; |
||
78 | |||
79 | /** |
||
80 | * The SQL statement to load the product text attribute with the passed row/attribute/store ID. |
||
81 | * |
||
82 | * @var string |
||
83 | */ |
||
84 | const PRODUCT_TEXT = 'SELECT * |
||
85 | FROM catalog_product_entity_text |
||
86 | WHERE row_id = :row_id |
||
87 | AND attribute_id = :attribute_id |
||
88 | AND store_id = :store_id'; |
||
89 | |||
90 | /** |
||
91 | * The SQL statement to load the product varchar attribute with the passed row/attribute/store ID. |
||
92 | * |
||
93 | * @var string |
||
94 | */ |
||
95 | const PRODUCT_VARCHAR = 'SELECT * |
||
96 | FROM catalog_product_entity_varchar |
||
97 | WHERE row_id = :row_id |
||
98 | AND attribute_id = :attribute_id |
||
99 | AND store_id = :store_id'; |
||
100 | |||
101 | /** |
||
102 | * The SQL statement to create a new sequence product value. |
||
103 | * |
||
104 | * @var string |
||
105 | */ |
||
106 | const CREATE_SEQUENCE_PRODUCT = 'INSERT INTO sequence_product VALUES ()'; |
||
107 | |||
108 | /** |
||
109 | * The SQL statement to create new products. |
||
110 | * |
||
111 | * @var string |
||
112 | */ |
||
113 | const CREATE_PRODUCT = 'INSERT |
||
114 | INTO catalog_product_entity (entity_id, |
||
115 | created_in, |
||
116 | updated_in, |
||
117 | sku, |
||
118 | created_at, |
||
119 | updated_at, |
||
120 | has_options, |
||
121 | required_options, |
||
122 | type_id, |
||
123 | attribute_set_id) |
||
124 | VALUES (:entity_id, |
||
125 | :created_in, |
||
126 | :updated_in, |
||
127 | :sku, |
||
128 | :created_at, |
||
129 | :updated_at, |
||
130 | :has_options, |
||
131 | :required_options, |
||
132 | :type_id, |
||
133 | :attribute_set_id)'; |
||
134 | |||
135 | /** |
||
136 | * The SQL statement to update an existing product. |
||
137 | * |
||
138 | * @var string |
||
139 | */ |
||
140 | const UPDATE_PRODUCT = 'UPDATE catalog_product_entity |
||
141 | SET entity_id = :entity_id, |
||
142 | created_in = :created_in, |
||
143 | updated_in = :updated_in, |
||
144 | sku = :sku, |
||
145 | created_at = :created_at, |
||
146 | updated_at = :updated_at, |
||
147 | has_options = :has_options, |
||
148 | required_options = :required_options, |
||
149 | type_id = :type_id, |
||
150 | attribute_set_id = :attribute_set_id |
||
151 | WHERE row_id = :row_id'; |
||
152 | |||
153 | /** |
||
154 | * The SQL statement to create a new product datetime value. |
||
155 | * |
||
156 | * @var string |
||
157 | */ |
||
158 | const CREATE_PRODUCT_DATETIME = 'INSERT |
||
159 | INTO catalog_product_entity_datetime ( |
||
160 | row_id, |
||
161 | attribute_id, |
||
162 | store_id, |
||
163 | value |
||
164 | ) |
||
165 | VALUES (:row_id, |
||
166 | :attribute_id, |
||
167 | :store_id, |
||
168 | :value)'; |
||
169 | |||
170 | /** |
||
171 | * The SQL statement to update an existing product datetime value. |
||
172 | * |
||
173 | * @var string |
||
174 | */ |
||
175 | const UPDATE_PRODUCT_DATETIME = 'UPDATE catalog_product_entity_datetime |
||
176 | SET row_id = :row_id, |
||
177 | attribute_id = :attribute_id, |
||
178 | store_id = :store_id, |
||
179 | value = :value |
||
180 | WHERE value_id = :value_id'; |
||
181 | |||
182 | /** |
||
183 | * The SQL statement to create a new product decimal value. |
||
184 | * |
||
185 | * @var string |
||
186 | */ |
||
187 | const CREATE_PRODUCT_DECIMAL = 'INSERT |
||
188 | INTO catalog_product_entity_decimal ( |
||
189 | row_id, |
||
190 | attribute_id, |
||
191 | store_id, |
||
192 | value |
||
193 | ) |
||
194 | VALUES (:row_id, |
||
195 | :attribute_id, |
||
196 | :store_id, |
||
197 | :value)'; |
||
198 | |||
199 | /** |
||
200 | * The SQL statement to update an existing product decimal value. |
||
201 | * |
||
202 | * @var string |
||
203 | */ |
||
204 | const UPDATE_PRODUCT_DECIMAL = 'UPDATE catalog_product_entity_decimal |
||
205 | SET row_id = :row_id, |
||
206 | attribute_id = :attribute_id, |
||
207 | store_id = :store_id, |
||
208 | value = :value |
||
209 | WHERE value_id = :value_id'; |
||
210 | |||
211 | /** |
||
212 | * The SQL statement to create a new product integer value. |
||
213 | * |
||
214 | * @var string |
||
215 | */ |
||
216 | const CREATE_PRODUCT_INT = 'INSERT |
||
217 | INTO catalog_product_entity_int ( |
||
218 | row_id, |
||
219 | attribute_id, |
||
220 | store_id, |
||
221 | value |
||
222 | ) |
||
223 | VALUES (:row_id, |
||
224 | :attribute_id, |
||
225 | :store_id, |
||
226 | :value)'; |
||
227 | |||
228 | /** |
||
229 | * The SQL statement to update an existing product integer value. |
||
230 | * |
||
231 | * @var string |
||
232 | */ |
||
233 | const UPDATE_PRODUCT_INT = 'UPDATE catalog_product_entity_int |
||
234 | SET row_id = :row_id, |
||
235 | attribute_id = :attribute_id, |
||
236 | store_id = :store_id, |
||
237 | value = :value |
||
238 | WHERE value_id = :value_id'; |
||
239 | |||
240 | /** |
||
241 | * The SQL statement to create a new product varchar value. |
||
242 | * |
||
243 | * @var string |
||
244 | */ |
||
245 | const CREATE_PRODUCT_VARCHAR = 'INSERT |
||
246 | INTO catalog_product_entity_varchar ( |
||
247 | row_id, |
||
248 | attribute_id, |
||
249 | store_id, |
||
250 | value |
||
251 | ) |
||
252 | VALUES (:row_id, |
||
253 | :attribute_id, |
||
254 | :store_id, |
||
255 | :value)'; |
||
256 | |||
257 | /** |
||
258 | * The SQL statement to update an existing product varchar value. |
||
259 | * |
||
260 | * @var string |
||
261 | */ |
||
262 | const UPDATE_PRODUCT_VARCHAR = 'UPDATE catalog_product_entity_varchar |
||
263 | SET row_id = :row_id, |
||
264 | attribute_id = :attribute_id, |
||
265 | store_id = :store_id, |
||
266 | value = :value |
||
267 | WHERE value_id = :value_id'; |
||
268 | |||
269 | /** |
||
270 | * The SQL statement to create a new product text value. |
||
271 | * |
||
272 | * @var string |
||
273 | */ |
||
274 | const CREATE_PRODUCT_TEXT = 'INSERT |
||
275 | INTO catalog_product_entity_text ( |
||
276 | row_id, |
||
277 | attribute_id, |
||
278 | store_id, |
||
279 | value |
||
280 | ) |
||
281 | VALUES (:row_id, |
||
282 | :attribute_id, |
||
283 | :store_id, |
||
284 | :value)'; |
||
285 | |||
286 | /** |
||
287 | * The SQL statement to update an existing product text value. |
||
288 | * |
||
289 | * @var string |
||
290 | */ |
||
291 | const UPDATE_PRODUCT_TEXT = 'UPDATE catalog_product_entity_text |
||
292 | SET row_id = :row_id, |
||
293 | attribute_id = :attribute_id, |
||
294 | store_id = :store_id, |
||
295 | value = :value |
||
296 | WHERE value_id = :value_id'; |
||
297 | |||
298 | /** |
||
299 | * The SQL statement to create a product's stock status. |
||
300 | * |
||
301 | * @var string |
||
302 | */ |
||
303 | const CREATE_STOCK_ITEM = 'INSERT |
||
304 | INTO cataloginventory_stock_item ( |
||
305 | product_id, |
||
306 | stock_id, |
||
307 | website_id, |
||
308 | qty, |
||
309 | min_qty, |
||
310 | use_config_min_qty, |
||
311 | is_qty_decimal, |
||
312 | backorders, |
||
313 | use_config_backorders, |
||
314 | min_sale_qty, |
||
315 | use_config_min_sale_qty, |
||
316 | max_sale_qty, |
||
317 | use_config_max_sale_qty, |
||
318 | is_in_stock, |
||
319 | notify_stock_qty, |
||
320 | use_config_notify_stock_qty, |
||
321 | manage_stock, |
||
322 | use_config_manage_stock, |
||
323 | use_config_qty_increments, |
||
324 | qty_increments, |
||
325 | use_config_enable_qty_inc, |
||
326 | enable_qty_increments, |
||
327 | is_decimal_divided, |
||
328 | deferred_stock_update, |
||
329 | use_config_deferred_stock_update |
||
330 | ) |
||
331 | VALUES (:product_id, |
||
332 | :stock_id, |
||
333 | :website_id, |
||
334 | :qty, |
||
335 | :min_qty, |
||
336 | :use_config_min_qty, |
||
337 | :is_qty_decimal, |
||
338 | :backorders, |
||
339 | :use_config_backorders, |
||
340 | :min_sale_qty, |
||
341 | :use_config_min_sale_qty, |
||
342 | :max_sale_qty, |
||
343 | :use_config_max_sale_qty, |
||
344 | :is_in_stock, |
||
345 | :notify_stock_qty, |
||
346 | :use_config_notify_stock_qty, |
||
347 | :manage_stock, |
||
348 | :use_config_manage_stock, |
||
349 | :use_config_qty_increments, |
||
350 | :qty_increments, |
||
351 | :use_config_enable_qty_inc, |
||
352 | :enable_qty_increments, |
||
353 | :is_decimal_divided, |
||
354 | :deferred_stock_update, |
||
355 | :use_config_deferred_stock_update)'; |
||
356 | |||
357 | /** |
||
358 | * The SQL statement to create a product's stock status. |
||
359 | * |
||
360 | * @var string |
||
361 | */ |
||
362 | const UPDATE_STOCK_ITEM = 'UPDATE cataloginventory_stock_item |
||
363 | SET product_id = :product_id, |
||
364 | stock_id = :stock_id, |
||
365 | website_id = :website_id, |
||
366 | qty = :qty, |
||
367 | min_qty = :min_qty, |
||
368 | use_config_min_qty = :use_config_min_qty, |
||
369 | is_qty_decimal = :is_qty_decimal, |
||
370 | backorders = :backorders, |
||
371 | use_config_backorders = :use_config_backorders, |
||
372 | min_sale_qty = :min_sale_qty, |
||
373 | use_config_min_sale_qty = :use_config_min_sale_qty, |
||
374 | max_sale_qty = :max_sale_qty, |
||
375 | use_config_max_sale_qty = :use_config_max_sale_qty, |
||
376 | is_in_stock = :is_in_stock, |
||
377 | low_stock_date = :low_stock_date, |
||
378 | notify_stock_qty = :notify_stock_qty, |
||
379 | use_config_notify_stock_qty = :use_config_notify_stock_qty, |
||
380 | manage_stock = :manage_stock, |
||
381 | use_config_manage_stock = :use_config_manage_stock, |
||
382 | stock_status_changed_auto = :stock_status_changed_auto, |
||
383 | use_config_qty_increments = :use_config_qty_increments, |
||
384 | qty_increments = :qty_increments, |
||
385 | use_config_enable_qty_inc = :use_config_enable_qty_inc, |
||
386 | enable_qty_increments = :enable_qty_increments, |
||
387 | is_decimal_divided = :is_decimal_divided, |
||
388 | deferred_stock_update = :deferred_stock_update, |
||
389 | use_config_deferred_stock_update = :use_config_deferred_stock_update |
||
390 | WHERE item_id = :item_id'; |
||
391 | } |
||
392 |