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