1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Product\Subjects\BunchSubject |
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 |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Product\Subjects; |
22
|
|
|
|
23
|
|
|
use Goodby\CSV\Export\Standard\Exporter; |
24
|
|
|
use Goodby\CSV\Export\Standard\ExporterConfig; |
25
|
|
|
use TechDivision\Import\Utils\RegistryKeys; |
26
|
|
|
use TechDivision\Import\Services\RegistryProcessor; |
27
|
|
|
use TechDivision\Import\Product\Utils\VisibilityKeys; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* The subject implementation that handles the business logic to persist products. |
31
|
|
|
* |
32
|
|
|
* @author Tim Wagner <[email protected]> |
33
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
34
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
35
|
|
|
* @link https://github.com/techdivision/import-product |
36
|
|
|
* @link http://www.techdivision.com |
37
|
|
|
*/ |
38
|
|
|
class BunchSubject extends AbstractProductSubject |
39
|
|
|
{ |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* The mapping for the supported backend types (for the product entity) => persist methods. |
43
|
|
|
* |
44
|
|
|
* @var array |
45
|
|
|
*/ |
46
|
|
|
protected $backendTypes = array( |
47
|
|
|
'datetime' => array('persistProductDatetimeAttribute', 'loadProductDatetimeAttribute'), |
48
|
|
|
'decimal' => array('persistProductDecimalAttribute', 'loadProductDecimalAttribute'), |
49
|
|
|
'int' => array('persistProductIntAttribute', 'loadProductIntAttribute'), |
50
|
|
|
'text' => array('persistProductTextAttribute', 'loadProductTextAttribute'), |
51
|
|
|
'varchar' => array('persistProductVarcharAttribute', 'loadProductVarcharAttribute') |
52
|
|
|
); |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Mappings for attribute code => CSV column header. |
56
|
|
|
* |
57
|
|
|
* @var array |
58
|
|
|
*/ |
59
|
|
|
protected $headerMappings = array( |
60
|
|
|
'status' => 'product_online', |
61
|
|
|
'tax_class_id' => 'tax_class_name', |
62
|
|
|
'price_type' => 'bundle_price_type', |
63
|
|
|
'sku_type' => 'bundle_sku_type', |
64
|
|
|
'price_view' => 'bundle_price_view', |
65
|
|
|
'weight_type' => 'bundle_weight_type', |
66
|
|
|
'image' => 'base_image', |
67
|
|
|
'image_label' => 'base_image_label', |
68
|
|
|
'thumbnail' => 'thumbnail_image', |
69
|
|
|
'thumbnail_label' => 'thumbnail_image_label', |
70
|
|
|
'shipment_type' => 'bundle_shipment_type' |
71
|
|
|
); |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Mappings for the table column => CSV column header. |
75
|
|
|
* |
76
|
|
|
* @var array |
77
|
|
|
*/ |
78
|
|
|
protected $headerStockMappings = array( |
79
|
|
|
'qty' => array('qty', 'float'), |
80
|
|
|
'min_qty' => array('out_of_stock_qty', 'float'), |
81
|
|
|
'use_config_min_qty' => array('use_config_min_qty', 'int'), |
82
|
|
|
'is_qty_decimal' => array('is_qty_decimal', 'int'), |
83
|
|
|
'backorders' => array('allow_backorders', 'int'), |
84
|
|
|
'use_config_backorders' => array('use_config_backorders', 'int'), |
85
|
|
|
'min_sale_qty' => array('min_cart_qty', 'float'), |
86
|
|
|
'use_config_min_sale_qty' => array('use_config_min_sale_qty', 'int'), |
87
|
|
|
'max_sale_qty' => array('max_cart_qty', 'float'), |
88
|
|
|
'use_config_max_sale_qty' => array('use_config_max_sale_qty', 'int'), |
89
|
|
|
'is_in_stock' => array('is_in_stock', 'int'), |
90
|
|
|
'notify_stock_qty' => array('notify_on_stock_below', 'float'), |
91
|
|
|
'use_config_notify_stock_qty' => array('use_config_notify_stock_qty', 'int'), |
92
|
|
|
'manage_stock' => array('manage_stock', 'int'), |
93
|
|
|
'use_config_manage_stock' => array('use_config_manage_stock', 'int'), |
94
|
|
|
'use_config_qty_increments' => array('use_config_qty_increments', 'int'), |
95
|
|
|
'qty_increments' => array('qty_increments', 'float'), |
96
|
|
|
'use_config_enable_qty_inc' => array('use_config_enable_qty_inc', 'int'), |
97
|
|
|
'enable_qty_increments' => array('enable_qty_increments', 'int'), |
98
|
|
|
'is_decimal_divided' => array('is_decimal_divided', 'int'), |
99
|
|
|
); |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* The array with the available visibility keys. |
103
|
|
|
* |
104
|
|
|
* @var array |
105
|
|
|
*/ |
106
|
|
|
protected $availableVisibilities = array( |
107
|
|
|
'Not Visible Individually' => VisibilityKeys::VISIBILITY_NOT_VISIBLE, |
108
|
|
|
'Catalog' => VisibilityKeys::VISIBILITY_IN_CATALOG, |
109
|
|
|
'Search' => VisibilityKeys::VISIBILITY_IN_SEARCH, |
110
|
|
|
'Catalog, Search' => VisibilityKeys::VISIBILITY_BOTH |
111
|
|
|
); |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* The attribute set of the product that has to be created. |
115
|
|
|
* |
116
|
|
|
* @var array |
117
|
|
|
*/ |
118
|
|
|
protected $attributeSet = array(); |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* The array containing the data for product type configuration (configurables, bundles, etc). |
122
|
|
|
* |
123
|
|
|
* @var array |
124
|
|
|
*/ |
125
|
|
|
protected $artefacs = array(); |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* The mapping for the SKUs to the created entity IDs. |
129
|
|
|
* |
130
|
|
|
* @var array |
131
|
|
|
*/ |
132
|
|
|
protected $skuEntityIdMapping = array(); |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* The category IDs the product is related with. |
136
|
|
|
* |
137
|
|
|
* @var array |
138
|
|
|
*/ |
139
|
|
|
protected $productCategoryIds = array(); |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* Set's the attribute set of the product that has to be created. |
143
|
|
|
* |
144
|
|
|
* @param array $attributeSet The attribute set |
145
|
|
|
* |
146
|
|
|
* @return void |
147
|
|
|
*/ |
148
|
1 |
|
public function setAttributeSet(array $attributeSet) |
149
|
|
|
{ |
150
|
1 |
|
$this->attributeSet = $attributeSet; |
151
|
1 |
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Return's the attribute set of the product that has to be created. |
155
|
|
|
* |
156
|
|
|
* @return array The attribute set |
157
|
|
|
*/ |
158
|
|
|
public function getAttributeSet() |
159
|
|
|
{ |
160
|
|
|
return $this->attributeSet; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* Clean up the global data after importing the bunch. |
165
|
|
|
* |
166
|
|
|
* @return void |
167
|
|
|
*/ |
168
|
|
|
public function tearDown() |
169
|
|
|
{ |
170
|
|
|
|
171
|
|
|
// invoke parent method |
172
|
|
|
parent::tearDown(); |
173
|
|
|
|
174
|
|
|
// export the artefacts |
175
|
|
|
$this->exportArtefacts(); |
176
|
|
|
|
177
|
|
|
// load the registry processor |
178
|
|
|
$registryProcessor = $this->getRegistryProcessor(); |
179
|
|
|
|
180
|
|
|
// update the status with the SKU => entity ID mapping |
181
|
|
|
$registryProcessor->mergeAttributesRecursive( |
182
|
|
|
$this->getSerial(), |
183
|
|
|
array(RegistryKeys::SKU_ENTITY_ID_MAPPING => $this->skuEntityIdMapping) |
184
|
|
|
); |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* Export's the artefacts to CSV files. |
189
|
|
|
* |
190
|
|
|
* @return void |
191
|
|
|
*/ |
192
|
|
|
public function exportArtefacts() |
193
|
|
|
{ |
194
|
|
|
|
195
|
|
|
// load the target directory and the actual timestamp |
196
|
|
|
$targetDir = $this->getConfiguration()->getTargetDir(); |
197
|
|
|
$timestamp = date('Ymd-His'); |
198
|
|
|
|
199
|
|
|
// initialize the counter |
200
|
|
|
$counter = 0; |
201
|
|
|
|
202
|
|
|
// iterate over the artefacts and export them |
203
|
|
|
foreach ($this->getArtefacts() as $artefactType => $artefacts) { |
204
|
|
|
foreach ($artefacts as $entityArtefacts) { |
205
|
|
|
// initialize the the exporter |
206
|
|
|
$exporter = new Exporter($this->getExportConfig()); |
207
|
|
|
|
208
|
|
|
// initialize the bunch |
209
|
|
|
$bunch = array(); |
210
|
|
|
|
211
|
|
|
// set the bunch header and append the artefact data |
212
|
|
|
$first = reset($entityArtefacts); |
213
|
|
|
$second = reset($first); |
214
|
|
|
$bunch[] = array_keys($second); |
215
|
|
|
|
216
|
|
|
// export the artefacts |
217
|
|
|
foreach ($entityArtefacts as $entityArtefact) { |
218
|
|
|
$bunch = array_merge($bunch, $entityArtefact); |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
// export the artefact (bunch) |
222
|
|
|
$exporter->export(sprintf('%s/%s-%s_%d.csv', $targetDir, $artefactType, $timestamp, $counter++), $bunch); |
223
|
|
|
} |
224
|
|
|
} |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* Initialize and return the exporter configuration. |
229
|
|
|
* |
230
|
|
|
* @return \Goodby\CSV\Export\Standard\ExporterConfig The exporter configuration |
231
|
|
|
*/ |
232
|
|
|
protected function getExportConfig() |
233
|
|
|
{ |
234
|
|
|
|
235
|
|
|
// initialize the lexer configuration |
236
|
|
|
$config = new ExporterConfig(); |
237
|
|
|
|
238
|
|
|
// query whether or not a delimiter character has been configured |
239
|
|
|
if ($delimiter = $this->getConfiguration()->getDelimiter()) { |
240
|
|
|
$config->setDelimiter($delimiter); |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
// query whether or not a custom escape character has been configured |
244
|
|
|
if ($escape = $this->getConfiguration()->getEscape()) { |
245
|
|
|
$config->setEscape($escape); |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
// query whether or not a custom enclosure character has been configured |
249
|
|
|
if ($enclosure = $this->getConfiguration()->getEnclosure()) { |
250
|
|
|
$config->setEnclosure($enclosure); |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
// query whether or not a custom source charset has been configured |
254
|
|
|
if ($fromCharset = $this->getConfiguration()->getFromCharset()) { |
255
|
|
|
$config->setFromCharset($fromCharset); |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
// query whether or not a custom target charset has been configured |
259
|
|
|
if ($toCharset = $this->getConfiguration()->getToCharset()) { |
260
|
|
|
$config->setToCharset($toCharset); |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
// query whether or not a custom file mode has been configured |
264
|
|
|
if ($fileMode = $this->getConfiguration()->getFileMode()) { |
265
|
|
|
$config->setFileMode($fileMode); |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
// return the lexer configuratio |
269
|
|
|
return $config; |
270
|
|
|
} |
271
|
|
|
|
272
|
|
|
/** |
273
|
|
|
* Cast's the passed value based on the backend type information. |
274
|
|
|
* |
275
|
|
|
* @param string $backendType The backend type to cast to |
276
|
|
|
* @param mixed $value The value to be casted |
277
|
|
|
* |
278
|
|
|
* @return mixed The casted value |
279
|
|
|
*/ |
280
|
1 |
|
public function castValueByBackendType($backendType, $value) |
281
|
|
|
{ |
282
|
|
|
|
283
|
|
|
// cast the value to a valid timestamp |
284
|
1 |
|
if ($backendType === 'datetime') { |
285
|
|
|
return \DateTime::createFromFormat($this->getSourceDateFormat(), $value)->format('Y-m-d H:i:s'); |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
// cast the value to a float value |
289
|
1 |
|
if ($backendType === 'float') { |
290
|
1 |
|
return (float) $value; |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
// cast the value to an integer |
294
|
1 |
|
if ($backendType === 'int') { |
295
|
1 |
|
return (int) $value; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
// we don't need to cast strings |
299
|
|
|
return $value; |
300
|
|
|
} |
301
|
|
|
|
302
|
|
|
/** |
303
|
|
|
* Return's the mappings for the table column => CSV column header. |
304
|
|
|
* |
305
|
|
|
* @return array The header stock mappings |
306
|
|
|
*/ |
307
|
1 |
|
public function getHeaderStockMappings() |
308
|
|
|
{ |
309
|
1 |
|
return $this->headerStockMappings; |
310
|
|
|
} |
311
|
|
|
|
312
|
|
|
/** |
313
|
|
|
* Return's mapping for the supported backend types (for the product entity) => persist methods. |
314
|
|
|
* |
315
|
|
|
* @return array The mapping for the supported backend types |
316
|
|
|
*/ |
317
|
|
|
public function getBackendTypes() |
318
|
|
|
{ |
319
|
|
|
return $this->backendTypes; |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
/** |
323
|
|
|
* Return's the artefacts for post-processing. |
324
|
|
|
* |
325
|
|
|
* @return array The artefacts |
326
|
|
|
*/ |
327
|
|
|
public function getArtefacts() |
328
|
|
|
{ |
329
|
|
|
return $this->artefacs; |
330
|
|
|
} |
331
|
|
|
|
332
|
|
|
/** |
333
|
|
|
* Return's the visibility key for the passed visibility string. |
334
|
|
|
* |
335
|
|
|
* @param string $visibility The visibility string to return the key for |
336
|
|
|
* |
337
|
|
|
* @return integer The requested visibility key |
338
|
|
|
* @throws \Exception Is thrown, if the requested visibility is not available |
339
|
|
|
*/ |
340
|
|
|
public function getVisibilityIdByValue($visibility) |
341
|
|
|
{ |
342
|
|
|
|
343
|
|
|
// query whether or not, the requested visibility is available |
344
|
|
|
if (isset($this->availableVisibilities[$visibility])) { |
345
|
|
|
return $this->availableVisibilities[$visibility]; |
346
|
|
|
} |
347
|
|
|
|
348
|
|
|
// throw an exception, if not |
349
|
|
|
throw new \Exception(sprintf('Found invalid visibility %s', $visibility)); |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
/** |
353
|
|
|
* Map the passed attribute code, if a header mapping exists and return the |
354
|
|
|
* mapped mapping. |
355
|
|
|
* |
356
|
|
|
* @param string $attributeCode The attribute code to map |
357
|
|
|
* |
358
|
|
|
* @return string The mapped attribute code, or the original one |
359
|
|
|
*/ |
360
|
|
|
public function mapAttributeCodeByHeaderMapping($attributeCode) |
361
|
|
|
{ |
362
|
|
|
|
363
|
|
|
// query weather or not we've a mapping, if yes, map the attribute code |
364
|
|
|
if (isset($this->headerMappings[$attributeCode])) { |
365
|
|
|
$attributeCode = $this->headerMappings[$attributeCode]; |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
// return the (mapped) attribute code |
369
|
|
|
return $attributeCode; |
370
|
|
|
} |
371
|
|
|
|
372
|
|
|
/** |
373
|
|
|
* Add the passed product type artefacts to the product with the |
374
|
|
|
* last entity ID. |
375
|
|
|
* |
376
|
|
|
* @param string $type The artefact type, e. g. configurable |
377
|
|
|
* @param array $artefacts The product type artefacts |
378
|
|
|
* |
379
|
|
|
* @return void |
380
|
|
|
* @uses \TechDivision\Import\Product\Subjects\BunchSubject::getLastEntityId() |
381
|
|
|
*/ |
382
|
|
|
public function addArtefacts($type, array $artefacts) |
383
|
|
|
{ |
384
|
|
|
|
385
|
|
|
// query whether or not, any artefacts are available |
386
|
|
|
if (sizeof($artefacts) === 0) { |
387
|
|
|
return; |
388
|
|
|
} |
389
|
|
|
|
390
|
|
|
// append the artefacts to the stack |
391
|
|
|
$this->artefacs[$type][$this->getLastEntityId()][] = $artefacts; |
392
|
|
|
} |
393
|
|
|
|
394
|
|
|
/** |
395
|
|
|
* Add the passed SKU => entity ID mapping. |
396
|
|
|
* |
397
|
|
|
* @param string $sku The SKU |
398
|
|
|
* |
399
|
|
|
* @return void |
400
|
|
|
* @uses \Import\Csv\Actions\ProductImportBunchAction::getLastEntityId() |
401
|
|
|
*/ |
402
|
|
|
public function addSkuEntityIdMapping($sku) |
403
|
|
|
{ |
404
|
|
|
$this->skuEntityIdMapping[$sku] = $this->getLastEntityId(); |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* Add the passed category ID to the product's category list. |
409
|
|
|
* |
410
|
|
|
* @param integer $categoryId The category ID to add |
411
|
|
|
* |
412
|
|
|
* @return void |
413
|
|
|
*/ |
414
|
|
|
public function addProductCategoryId($categoryId) |
415
|
|
|
{ |
416
|
|
|
$this->productCategoryIds[$this->getLastEntityId()][$categoryId] = $this->getLastEntityId(); |
417
|
|
|
} |
418
|
|
|
|
419
|
|
|
/** |
420
|
|
|
* Return's the list with category IDs the product is related with. |
421
|
|
|
* |
422
|
|
|
* @return array The product's category IDs |
423
|
|
|
*/ |
424
|
|
|
public function getProductCategoryIds() |
425
|
|
|
{ |
426
|
|
|
|
427
|
|
|
// initialize the array with the product's category IDs |
428
|
|
|
$categoryIds = array(); |
429
|
|
|
|
430
|
|
|
// query whether or not category IDs are available for the actual product entity |
431
|
|
|
if (isset($this->productCategoryIds[$lastEntityId = $this->getLastEntityId()])) { |
432
|
|
|
$categoryIds = $this->productCategoryIds[$lastEntityId]; |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
// return the array with the product's category IDs |
436
|
|
|
return $categoryIds; |
437
|
|
|
} |
438
|
|
|
|
439
|
|
|
/** |
440
|
|
|
* Return's the attribute option value with the passed value and store ID. |
441
|
|
|
* |
442
|
|
|
* @param mixed $value The option value |
443
|
|
|
* @param integer $storeId The ID of the store |
444
|
|
|
* |
445
|
|
|
* @return array|boolean The attribute option value instance |
446
|
|
|
*/ |
447
|
|
|
public function getEavAttributeOptionValueByOptionValueAndStoreId($value, $storeId) |
448
|
|
|
{ |
449
|
|
|
return $this->getProductProcessor()->getEavAttributeOptionValueByOptionValueAndStoreId($value, $storeId); |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
/** |
453
|
|
|
* Return's the URL rewrites for the passed URL entity type and ID. |
454
|
|
|
* |
455
|
|
|
* @param string $entityType The entity type to load the URL rewrites for |
456
|
|
|
* @param integer $entityId The entity ID to laod the rewrites for |
457
|
|
|
* |
458
|
|
|
* @return array The URL rewrites |
459
|
|
|
*/ |
460
|
1 |
|
public function getUrlRewritesByEntityTypeAndEntityId($entityType, $entityId) |
461
|
|
|
{ |
462
|
1 |
|
return $this->getProductProcessor()->getUrlRewritesByEntityTypeAndEntityId($entityType, $entityId); |
463
|
|
|
} |
464
|
|
|
|
465
|
|
|
/** |
466
|
|
|
* Load's and return's the product with the passed SKU. |
467
|
|
|
* |
468
|
|
|
* @param string $sku The SKU of the product to load |
469
|
|
|
* |
470
|
|
|
* @return array The product |
471
|
|
|
*/ |
472
|
|
|
public function loadProduct($sku) |
473
|
|
|
{ |
474
|
|
|
return $this->getProductProcessor()->loadProduct($sku); |
475
|
|
|
} |
476
|
|
|
|
477
|
|
|
/** |
478
|
|
|
* Load's and return's the product website relation with the passed product and website ID. |
479
|
|
|
* |
480
|
|
|
* @param string $productId The product ID of the relation |
481
|
|
|
* @param string $websiteId The website ID of the relation |
482
|
|
|
* |
483
|
|
|
* @return array The product website |
484
|
|
|
*/ |
485
|
|
|
public function loadProductWebsite($productId, $websiteId) |
486
|
|
|
{ |
487
|
|
|
return $this->getProductProcessor()->loadProductWebsite($productId, $websiteId); |
488
|
|
|
} |
489
|
|
|
|
490
|
|
|
/** |
491
|
|
|
* Return's the category product relation with the passed category/product ID. |
492
|
|
|
* |
493
|
|
|
* @param integer $categoryId The category ID of the category product relation to return |
494
|
|
|
* @param integer $productId The product ID of the category product relation to return |
495
|
|
|
* |
496
|
|
|
* @return array The category product relation |
497
|
|
|
*/ |
498
|
|
|
public function loadCategoryProduct($categoryId, $productId) |
499
|
|
|
{ |
500
|
|
|
return $this->getProductProcessor()->loadCategoryProduct($categoryId, $productId); |
501
|
|
|
} |
502
|
|
|
|
503
|
|
|
/** |
504
|
|
|
* Load's and return's the stock status with the passed product/website/stock ID. |
505
|
|
|
* |
506
|
|
|
* @param integer $productId The product ID of the stock status to load |
507
|
|
|
* @param integer $websiteId The website ID of the stock status to load |
508
|
|
|
* @param integer $stockId The stock ID of the stock status to load |
509
|
|
|
* |
510
|
|
|
* @return array The stock status |
511
|
|
|
*/ |
512
|
|
|
public function loadStockStatus($productId, $websiteId, $stockId) |
513
|
|
|
{ |
514
|
|
|
return $this->getProductProcessor()->loadStockStatus($productId, $websiteId, $stockId); |
515
|
|
|
} |
516
|
|
|
|
517
|
|
|
/** |
518
|
|
|
* Load's and return's the stock status with the passed product/website/stock ID. |
519
|
|
|
* |
520
|
|
|
* @param integer $productId The product ID of the stock item to load |
521
|
|
|
* @param integer $websiteId The website ID of the stock item to load |
522
|
|
|
* @param integer $stockId The stock ID of the stock item to load |
523
|
|
|
* |
524
|
|
|
* @return array The stock item |
525
|
|
|
*/ |
526
|
|
|
public function loadStockItem($productId, $websiteId, $stockId) |
527
|
|
|
{ |
528
|
|
|
return $this->getProductProcessor()->loadStockItem($productId, $websiteId, $stockId); |
529
|
|
|
} |
530
|
|
|
|
531
|
|
|
/** |
532
|
|
|
* Load's and return's the datetime attribute with the passed entity/attribute/store ID. |
533
|
|
|
* |
534
|
|
|
* @param integer $entityId The entity ID of the attribute |
535
|
|
|
* @param integer $attributeId The attribute ID of the attribute |
536
|
|
|
* @param integer $storeId The store ID of the attribute |
537
|
|
|
* |
538
|
|
|
* @return array|null The datetime attribute |
539
|
|
|
*/ |
540
|
|
|
public function loadProductDatetimeAttribute($entityId, $attributeId, $storeId) |
541
|
|
|
{ |
542
|
|
|
return $this->getProductProcessor()->loadProductDatetimeAttribute($entityId, $attributeId, $storeId); |
543
|
|
|
} |
544
|
|
|
|
545
|
|
|
/** |
546
|
|
|
* Load's and return's the decimal attribute with the passed entity/attribute/store ID. |
547
|
|
|
* |
548
|
|
|
* @param integer $entityId The entity ID of the attribute |
549
|
|
|
* @param integer $attributeId The attribute ID of the attribute |
550
|
|
|
* @param integer $storeId The store ID of the attribute |
551
|
|
|
* |
552
|
|
|
* @return array|null The decimal attribute |
553
|
|
|
*/ |
554
|
|
|
public function loadProductDecimalAttribute($entityId, $attributeId, $storeId) |
555
|
|
|
{ |
556
|
|
|
return $this->getProductProcessor()->loadProductDecimalAttribute($entityId, $attributeId, $storeId); |
557
|
|
|
} |
558
|
|
|
|
559
|
|
|
/** |
560
|
|
|
* Load's and return's the integer attribute with the passed entity/attribute/store ID. |
561
|
|
|
* |
562
|
|
|
* @param integer $entityId The entity ID of the attribute |
563
|
|
|
* @param integer $attributeId The attribute ID of the attribute |
564
|
|
|
* @param integer $storeId The store ID of the attribute |
565
|
|
|
* |
566
|
|
|
* @return array|null The integer attribute |
567
|
|
|
*/ |
568
|
|
|
public function loadProductIntAttribute($entityId, $attributeId, $storeId) |
569
|
|
|
{ |
570
|
|
|
return $this->getProductProcessor()->loadProductIntAttribute($entityId, $attributeId, $storeId); |
571
|
|
|
} |
572
|
|
|
|
573
|
|
|
/** |
574
|
|
|
* Load's and return's the text attribute with the passed entity/attribute/store ID. |
575
|
|
|
* |
576
|
|
|
* @param integer $entityId The entity ID of the attribute |
577
|
|
|
* @param integer $attributeId The attribute ID of the attribute |
578
|
|
|
* @param integer $storeId The store ID of the attribute |
579
|
|
|
* |
580
|
|
|
* @return array|null The text attribute |
581
|
|
|
*/ |
582
|
|
|
public function loadProductTextAttribute($entityId, $attributeId, $storeId) |
583
|
|
|
{ |
584
|
|
|
return $this->getProductProcessor()->loadProductTextAttribute($entityId, $attributeId, $storeId); |
585
|
|
|
} |
586
|
|
|
|
587
|
|
|
/** |
588
|
|
|
* Load's and return's the varchar attribute with the passed entity/attribute/store ID. |
589
|
|
|
* |
590
|
|
|
* @param integer $entityId The entity ID of the attribute |
591
|
|
|
* @param integer $attributeId The attribute ID of the attribute |
592
|
|
|
* @param integer $storeId The store ID of the attribute |
593
|
|
|
* |
594
|
|
|
* @return array|null The varchar attribute |
595
|
|
|
*/ |
596
|
|
|
public function loadProductVarcharAttribute($entityId, $attributeId, $storeId) |
597
|
|
|
{ |
598
|
|
|
return $this->getProductProcessor()->loadProductVarcharAttribute($entityId, $attributeId, $storeId); |
599
|
|
|
} |
600
|
|
|
|
601
|
|
|
/** |
602
|
|
|
* Persist's the passed product data and return's the ID. |
603
|
|
|
* |
604
|
|
|
* @param array $product The product data to persist |
605
|
|
|
* |
606
|
|
|
* @return string The ID of the persisted entity |
607
|
|
|
*/ |
608
|
|
|
public function persistProduct($product) |
609
|
|
|
{ |
610
|
|
|
return $this->getProductProcessor()->persistProduct($product); |
611
|
|
|
} |
612
|
|
|
|
613
|
|
|
/** |
614
|
|
|
* Persist's the passed product varchar attribute. |
615
|
|
|
* |
616
|
|
|
* @param array $attribute The attribute to persist |
617
|
|
|
* |
618
|
|
|
* @return void |
619
|
|
|
*/ |
620
|
|
|
public function persistProductVarcharAttribute($attribute) |
621
|
|
|
{ |
622
|
|
|
$this->getProductProcessor()->persistProductVarcharAttribute($attribute); |
623
|
|
|
} |
624
|
|
|
|
625
|
|
|
/** |
626
|
|
|
* Persist's the passed product integer attribute. |
627
|
|
|
* |
628
|
|
|
* @param array $attribute The attribute to persist |
629
|
|
|
* |
630
|
|
|
* @return void |
631
|
|
|
*/ |
632
|
|
|
public function persistProductIntAttribute($attribute) |
633
|
|
|
{ |
634
|
|
|
$this->getProductProcessor()->persistProductIntAttribute($attribute); |
635
|
|
|
} |
636
|
|
|
|
637
|
|
|
/** |
638
|
|
|
* Persist's the passed product decimal attribute. |
639
|
|
|
* |
640
|
|
|
* @param array $attribute The attribute to persist |
641
|
|
|
* |
642
|
|
|
* @return void |
643
|
|
|
*/ |
644
|
|
|
public function persistProductDecimalAttribute($attribute) |
645
|
|
|
{ |
646
|
|
|
$this->getProductProcessor()->persistProductDecimalAttribute($attribute); |
647
|
|
|
} |
648
|
|
|
|
649
|
|
|
/** |
650
|
|
|
* Persist's the passed product datetime attribute. |
651
|
|
|
* |
652
|
|
|
* @param array $attribute The attribute to persist |
653
|
|
|
* |
654
|
|
|
* @return void |
655
|
|
|
*/ |
656
|
|
|
public function persistProductDatetimeAttribute($attribute) |
657
|
|
|
{ |
658
|
|
|
$this->getProductProcessor()->persistProductDatetimeAttribute($attribute); |
659
|
|
|
} |
660
|
|
|
|
661
|
|
|
/** |
662
|
|
|
* Persist's the passed product text attribute. |
663
|
|
|
* |
664
|
|
|
* @param array $attribute The attribute to persist |
665
|
|
|
* |
666
|
|
|
* @return void |
667
|
|
|
*/ |
668
|
|
|
public function persistProductTextAttribute($attribute) |
669
|
|
|
{ |
670
|
|
|
$this->getProductProcessor()->persistProductTextAttribute($attribute); |
671
|
|
|
} |
672
|
|
|
|
673
|
|
|
/** |
674
|
|
|
* Persist's the passed product website data and return's the ID. |
675
|
|
|
* |
676
|
|
|
* @param array $productWebsite The product website data to persist |
677
|
|
|
* |
678
|
|
|
* @return void |
679
|
|
|
*/ |
680
|
|
|
public function persistProductWebsite($productWebsite) |
681
|
|
|
{ |
682
|
|
|
$this->getProductProcessor()->persistProductWebsite($productWebsite); |
683
|
|
|
} |
684
|
|
|
|
685
|
|
|
/** |
686
|
|
|
* Persist's the passed category product relation. |
687
|
|
|
* |
688
|
|
|
* @param array $categoryProduct The category product relation to persist |
689
|
|
|
* |
690
|
|
|
* @return void |
691
|
|
|
*/ |
692
|
|
|
public function persistCategoryProduct($categoryProduct) |
693
|
|
|
{ |
694
|
|
|
$this->getProductProcessor()->persistCategoryProduct($categoryProduct); |
695
|
|
|
} |
696
|
|
|
|
697
|
|
|
/** |
698
|
|
|
* Persist's the passed stock item data and return's the ID. |
699
|
|
|
* |
700
|
|
|
* @param array $stockItem The stock item data to persist |
701
|
|
|
* |
702
|
|
|
* @return void |
703
|
|
|
*/ |
704
|
|
|
public function persistStockItem($stockItem) |
705
|
|
|
{ |
706
|
|
|
$this->getProductProcessor()->persistStockItem($stockItem); |
707
|
|
|
} |
708
|
|
|
|
709
|
|
|
/** |
710
|
|
|
* Persist's the passed stock status data and return's the ID. |
711
|
|
|
* |
712
|
|
|
* @param array $stockStatus The stock status data to persist |
713
|
|
|
* |
714
|
|
|
* @return void |
715
|
|
|
*/ |
716
|
|
|
public function persistStockStatus($stockStatus) |
717
|
|
|
{ |
718
|
|
|
$this->getProductProcessor()->persistStockStatus($stockStatus); |
719
|
|
|
} |
720
|
|
|
|
721
|
|
|
/** |
722
|
|
|
* Persist's the URL write with the passed data. |
723
|
|
|
* |
724
|
|
|
* @param array $row The URL rewrite to persist |
725
|
|
|
* |
726
|
|
|
* @return void |
727
|
|
|
*/ |
728
|
1 |
|
public function persistUrlRewrite($row) |
729
|
|
|
{ |
730
|
1 |
|
$this->getProductProcessor()->persistUrlRewrite($row); |
731
|
1 |
|
} |
732
|
|
|
|
733
|
|
|
/** |
734
|
|
|
* Delete's the entity with the passed attributes. |
735
|
|
|
* |
736
|
|
|
* @param array $row The attributes of the entity to delete |
737
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
738
|
|
|
* |
739
|
|
|
* @return void |
740
|
|
|
*/ |
741
|
|
|
public function deleteProduct($row, $name = null) |
742
|
|
|
{ |
743
|
|
|
$this->getProductProcessor()->deleteProduct($row, $name); |
744
|
|
|
} |
745
|
|
|
|
746
|
|
|
/** |
747
|
|
|
* Delete's the URL rewrite(s) with the passed attributes. |
748
|
|
|
* |
749
|
|
|
* @param array $row The attributes of the entity to delete |
750
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
751
|
|
|
* |
752
|
|
|
* @return void |
753
|
|
|
*/ |
754
|
1 |
|
public function deleteUrlRewrite($row, $name = null) |
755
|
|
|
{ |
756
|
1 |
|
$this->getProductProcessor()->deleteUrlRewrite($row, $name); |
757
|
1 |
|
} |
758
|
|
|
|
759
|
|
|
/** |
760
|
|
|
* Delete's the stock item(s) with the passed attributes. |
761
|
|
|
* |
762
|
|
|
* @param array $row The attributes of the entity to delete |
763
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
764
|
|
|
* |
765
|
|
|
* @return void |
766
|
|
|
*/ |
767
|
|
|
public function deleteStockItem($row, $name = null) |
768
|
|
|
{ |
769
|
|
|
$this->getProductProcessor()->deleteStockItem($row, $name); |
770
|
|
|
} |
771
|
|
|
|
772
|
|
|
/** |
773
|
|
|
* Delete's the stock status with the passed attributes. |
774
|
|
|
* |
775
|
|
|
* @param array $row The attributes of the entity to delete |
776
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
777
|
|
|
* |
778
|
|
|
* @return void |
779
|
|
|
*/ |
780
|
|
|
public function deleteStockStatus($row, $name = null) |
781
|
|
|
{ |
782
|
|
|
$this->getProductProcessor()->deleteStockStatus($row, $name); |
783
|
|
|
} |
784
|
|
|
|
785
|
|
|
/** |
786
|
|
|
* Delete's the product website relations with the passed attributes. |
787
|
|
|
* |
788
|
|
|
* @param array $row The attributes of the entity to delete |
789
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
790
|
|
|
* |
791
|
|
|
* @return void |
792
|
|
|
*/ |
793
|
|
|
public function deleteProductWebsite($row, $name = null) |
794
|
|
|
{ |
795
|
|
|
$this->getProductProcessor()->deleteProductWebsite($row, $name); |
796
|
|
|
} |
797
|
|
|
|
798
|
|
|
/** |
799
|
|
|
* Delete's the category product relations with the passed attributes. |
800
|
|
|
* |
801
|
|
|
* @param array $row The attributes of the entity to delete |
802
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
803
|
|
|
* |
804
|
|
|
* @return void |
805
|
|
|
*/ |
806
|
|
|
public function deleteCategoryProduct($row, $name = null) |
807
|
|
|
{ |
808
|
|
|
$this->getProductProcessor()->deleteCategoryProduct($row, $name); |
809
|
|
|
} |
810
|
|
|
} |
811
|
|
|
|