|
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 category IDs the product is related with. |
|
129
|
|
|
* |
|
130
|
|
|
* @var array |
|
131
|
|
|
*/ |
|
132
|
|
|
protected $productCategoryIds = array(); |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* Set's the attribute set of the product that has to be created. |
|
136
|
|
|
* |
|
137
|
|
|
* @param array $attributeSet The attribute set |
|
138
|
|
|
* |
|
139
|
|
|
* @return void |
|
140
|
|
|
*/ |
|
141
|
1 |
|
public function setAttributeSet(array $attributeSet) |
|
142
|
|
|
{ |
|
143
|
1 |
|
$this->attributeSet = $attributeSet; |
|
144
|
1 |
|
} |
|
145
|
|
|
|
|
146
|
|
|
/** |
|
147
|
|
|
* Return's the attribute set of the product that has to be created. |
|
148
|
|
|
* |
|
149
|
|
|
* @return array The attribute set |
|
150
|
|
|
*/ |
|
151
|
|
|
public function getAttributeSet() |
|
152
|
|
|
{ |
|
153
|
|
|
return $this->attributeSet; |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
/** |
|
157
|
|
|
* Clean up the global data after importing the bunch. |
|
158
|
|
|
* |
|
159
|
|
|
* @return void |
|
160
|
|
|
*/ |
|
161
|
|
|
public function tearDown() |
|
162
|
|
|
{ |
|
163
|
|
|
|
|
164
|
|
|
// invoke parent method |
|
165
|
|
|
parent::tearDown(); |
|
166
|
|
|
|
|
167
|
|
|
// export the artefacts |
|
168
|
|
|
$this->exportArtefacts(); |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* Export's the artefacts to CSV files. |
|
173
|
|
|
* |
|
174
|
|
|
* @return void |
|
175
|
|
|
*/ |
|
176
|
|
|
protected function exportArtefacts() |
|
177
|
|
|
{ |
|
178
|
|
|
|
|
179
|
|
|
// load the target directory and the actual timestamp |
|
180
|
|
|
$targetDir = $this->getTargetDir(); |
|
181
|
|
|
$timestamp = date('Ymd-His'); |
|
182
|
|
|
|
|
183
|
|
|
// iterate over the artefacts and export them |
|
184
|
|
|
foreach ($this->getArtefacts() as $artefactType => $artefacts) { |
|
185
|
|
|
// initialize the bunch and the exporter |
|
186
|
|
|
$bunch = array(); |
|
187
|
|
|
$exporter = new Exporter($this->getExportConfig()); |
|
188
|
|
|
|
|
189
|
|
|
// iterate over the artefact types artefacts |
|
190
|
|
|
foreach ($artefacts as $entityArtefacts) { |
|
191
|
|
|
// set the bunch header and append the artefact data |
|
192
|
|
|
if (sizeof($bunch) === 0) { |
|
193
|
|
|
$first = reset($entityArtefacts); |
|
194
|
|
|
$second = reset($first); |
|
195
|
|
|
$bunch[] = array_keys($second); |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
// export the artefacts |
|
199
|
|
|
foreach ($entityArtefacts as $entityArtefact) { |
|
200
|
|
|
$bunch = array_merge($bunch, $entityArtefact); |
|
201
|
|
|
} |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
// export the artefact (bunch) |
|
205
|
|
|
$exporter->export(sprintf('%s/%s-%s_01.csv', $targetDir, $artefactType, $timestamp), $bunch); |
|
206
|
|
|
} |
|
207
|
|
|
} |
|
208
|
|
|
|
|
209
|
|
|
/** |
|
210
|
|
|
* Return's the target directory for the artefact export. |
|
211
|
|
|
* |
|
212
|
|
|
* @return string The target directory for the artefact export |
|
213
|
|
|
*/ |
|
214
|
|
|
protected function getTargetDir() |
|
215
|
|
|
{ |
|
216
|
|
|
return $this->getNewSourceDir(); |
|
|
|
|
|
|
217
|
|
|
} |
|
218
|
|
|
|
|
219
|
|
|
/** |
|
220
|
|
|
* Initialize and return the exporter configuration. |
|
221
|
|
|
* |
|
222
|
|
|
* @return \Goodby\CSV\Export\Standard\ExporterConfig The exporter configuration |
|
223
|
|
|
*/ |
|
224
|
|
|
protected function getExportConfig() |
|
225
|
|
|
{ |
|
226
|
|
|
|
|
227
|
|
|
// initialize the lexer configuration |
|
228
|
|
|
$config = new ExporterConfig(); |
|
229
|
|
|
|
|
230
|
|
|
// query whether or not a delimiter character has been configured |
|
231
|
|
|
if ($delimiter = $this->getConfiguration()->getDelimiter()) { |
|
232
|
|
|
$config->setDelimiter($delimiter); |
|
233
|
|
|
} |
|
234
|
|
|
|
|
235
|
|
|
// query whether or not a custom escape character has been configured |
|
236
|
|
|
if ($escape = $this->getConfiguration()->getEscape()) { |
|
237
|
|
|
$config->setEscape($escape); |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
// query whether or not a custom enclosure character has been configured |
|
241
|
|
|
if ($enclosure = $this->getConfiguration()->getEnclosure()) { |
|
242
|
|
|
$config->setEnclosure($enclosure); |
|
243
|
|
|
} |
|
244
|
|
|
|
|
245
|
|
|
// query whether or not a custom source charset has been configured |
|
246
|
|
|
if ($fromCharset = $this->getConfiguration()->getFromCharset()) { |
|
247
|
|
|
$config->setFromCharset($fromCharset); |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
// query whether or not a custom target charset has been configured |
|
251
|
|
|
if ($toCharset = $this->getConfiguration()->getToCharset()) { |
|
252
|
|
|
$config->setToCharset($toCharset); |
|
253
|
|
|
} |
|
254
|
|
|
|
|
255
|
|
|
// query whether or not a custom file mode has been configured |
|
256
|
|
|
if ($fileMode = $this->getConfiguration()->getFileMode()) { |
|
257
|
|
|
$config->setFileMode($fileMode); |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
// return the lexer configuratio |
|
261
|
|
|
return $config; |
|
262
|
|
|
} |
|
263
|
|
|
|
|
264
|
|
|
/** |
|
265
|
|
|
* Cast's the passed value based on the backend type information. |
|
266
|
|
|
* |
|
267
|
|
|
* @param string $backendType The backend type to cast to |
|
268
|
|
|
* @param mixed $value The value to be casted |
|
269
|
|
|
* |
|
270
|
|
|
* @return mixed The casted value |
|
271
|
|
|
*/ |
|
272
|
1 |
|
public function castValueByBackendType($backendType, $value) |
|
273
|
|
|
{ |
|
274
|
|
|
|
|
275
|
|
|
// cast the value to a valid timestamp |
|
276
|
1 |
|
if ($backendType === 'datetime') { |
|
277
|
|
|
return \DateTime::createFromFormat($this->getSourceDateFormat(), $value)->format('Y-m-d H:i:s'); |
|
278
|
|
|
} |
|
279
|
|
|
|
|
280
|
|
|
// cast the value to a float value |
|
281
|
1 |
|
if ($backendType === 'float') { |
|
282
|
1 |
|
return (float) $value; |
|
283
|
|
|
} |
|
284
|
|
|
|
|
285
|
|
|
// cast the value to an integer |
|
286
|
1 |
|
if ($backendType === 'int') { |
|
287
|
1 |
|
return (int) $value; |
|
288
|
|
|
} |
|
289
|
|
|
|
|
290
|
|
|
// we don't need to cast strings |
|
291
|
|
|
return $value; |
|
292
|
|
|
} |
|
293
|
|
|
|
|
294
|
|
|
/** |
|
295
|
|
|
* Return's the mappings for the table column => CSV column header. |
|
296
|
|
|
* |
|
297
|
|
|
* @return array The header stock mappings |
|
298
|
|
|
*/ |
|
299
|
1 |
|
public function getHeaderStockMappings() |
|
300
|
|
|
{ |
|
301
|
1 |
|
return $this->headerStockMappings; |
|
302
|
|
|
} |
|
303
|
|
|
|
|
304
|
|
|
/** |
|
305
|
|
|
* Return's mapping for the supported backend types (for the product entity) => persist methods. |
|
306
|
|
|
* |
|
307
|
|
|
* @return array The mapping for the supported backend types |
|
308
|
|
|
*/ |
|
309
|
|
|
public function getBackendTypes() |
|
310
|
|
|
{ |
|
311
|
|
|
return $this->backendTypes; |
|
312
|
|
|
} |
|
313
|
|
|
|
|
314
|
|
|
/** |
|
315
|
|
|
* Return's the artefacts for post-processing. |
|
316
|
|
|
* |
|
317
|
|
|
* @return array The artefacts |
|
318
|
|
|
*/ |
|
319
|
|
|
public function getArtefacts() |
|
320
|
|
|
{ |
|
321
|
|
|
return $this->artefacs; |
|
322
|
|
|
} |
|
323
|
|
|
|
|
324
|
|
|
/** |
|
325
|
|
|
* Return's the visibility key for the passed visibility string. |
|
326
|
|
|
* |
|
327
|
|
|
* @param string $visibility The visibility string to return the key for |
|
328
|
|
|
* |
|
329
|
|
|
* @return integer The requested visibility key |
|
330
|
|
|
* @throws \Exception Is thrown, if the requested visibility is not available |
|
331
|
|
|
*/ |
|
332
|
|
View Code Duplication |
public function getVisibilityIdByValue($visibility) |
|
|
|
|
|
|
333
|
|
|
{ |
|
334
|
|
|
|
|
335
|
|
|
// query whether or not, the requested visibility is available |
|
336
|
|
|
if (isset($this->availableVisibilities[$visibility])) { |
|
337
|
|
|
return $this->availableVisibilities[$visibility]; |
|
338
|
|
|
} |
|
339
|
|
|
|
|
340
|
|
|
// throw an exception, if not |
|
341
|
|
|
throw new \Exception( |
|
342
|
|
|
sprintf( |
|
343
|
|
|
'Found invalid visibility %s in file %s on line %d', |
|
344
|
|
|
$visibility, |
|
345
|
|
|
$this->getFilename(), |
|
346
|
|
|
$this->getLineNumber() |
|
|
|
|
|
|
347
|
|
|
) |
|
348
|
|
|
); |
|
349
|
|
|
} |
|
350
|
|
|
|
|
351
|
|
|
/** |
|
352
|
|
|
* Map the passed attribute code, if a header mapping exists and return the |
|
353
|
|
|
* mapped mapping. |
|
354
|
|
|
* |
|
355
|
|
|
* @param string $attributeCode The attribute code to map |
|
356
|
|
|
* |
|
357
|
|
|
* @return string The mapped attribute code, or the original one |
|
358
|
|
|
*/ |
|
359
|
|
|
public function mapAttributeCodeByHeaderMapping($attributeCode) |
|
360
|
|
|
{ |
|
361
|
|
|
|
|
362
|
|
|
// query weather or not we've a mapping, if yes, map the attribute code |
|
363
|
|
|
if (isset($this->headerMappings[$attributeCode])) { |
|
364
|
|
|
$attributeCode = $this->headerMappings[$attributeCode]; |
|
365
|
|
|
} |
|
366
|
|
|
|
|
367
|
|
|
// return the (mapped) attribute code |
|
368
|
|
|
return $attributeCode; |
|
369
|
|
|
} |
|
370
|
|
|
|
|
371
|
|
|
/** |
|
372
|
|
|
* Add the passed product type artefacts to the product with the |
|
373
|
|
|
* last entity ID. |
|
374
|
|
|
* |
|
375
|
|
|
* @param string $type The artefact type, e. g. configurable |
|
376
|
|
|
* @param array $artefacts The product type artefacts |
|
377
|
|
|
* |
|
378
|
|
|
* @return void |
|
379
|
|
|
* @uses \TechDivision\Import\Product\Subjects\BunchSubject::getLastEntityId() |
|
380
|
|
|
*/ |
|
381
|
|
|
public function addArtefacts($type, array $artefacts) |
|
382
|
|
|
{ |
|
383
|
|
|
|
|
384
|
|
|
// query whether or not, any artefacts are available |
|
385
|
|
|
if (sizeof($artefacts) === 0) { |
|
386
|
|
|
return; |
|
387
|
|
|
} |
|
388
|
|
|
|
|
389
|
|
|
// append the artefacts to the stack |
|
390
|
|
|
$this->artefacs[$type][$this->getLastEntityId()][] = $artefacts; |
|
391
|
|
|
} |
|
392
|
|
|
|
|
393
|
|
|
/** |
|
394
|
|
|
* Add the passed category ID to the product's category list. |
|
395
|
|
|
* |
|
396
|
|
|
* @param integer $categoryId The category ID to add |
|
397
|
|
|
* |
|
398
|
|
|
* @return void |
|
399
|
|
|
*/ |
|
400
|
|
|
public function addProductCategoryId($categoryId) |
|
401
|
|
|
{ |
|
402
|
|
|
$this->productCategoryIds[$this->getLastEntityId()][$categoryId] = $this->getLastEntityId(); |
|
403
|
|
|
} |
|
404
|
|
|
|
|
405
|
|
|
/** |
|
406
|
|
|
* Return's the list with category IDs the product is related with. |
|
407
|
|
|
* |
|
408
|
|
|
* @return array The product's category IDs |
|
409
|
|
|
*/ |
|
410
|
|
|
public function getProductCategoryIds() |
|
411
|
|
|
{ |
|
412
|
|
|
|
|
413
|
|
|
// initialize the array with the product's category IDs |
|
414
|
|
|
$categoryIds = array(); |
|
415
|
|
|
|
|
416
|
|
|
// query whether or not category IDs are available for the actual product entity |
|
417
|
|
|
if (isset($this->productCategoryIds[$lastEntityId = $this->getLastEntityId()])) { |
|
418
|
|
|
$categoryIds = $this->productCategoryIds[$lastEntityId]; |
|
419
|
|
|
} |
|
420
|
|
|
|
|
421
|
|
|
// return the array with the product's category IDs |
|
422
|
|
|
return $categoryIds; |
|
423
|
|
|
} |
|
424
|
|
|
|
|
425
|
|
|
/** |
|
426
|
|
|
* Return's the attribute option value with the passed value and store ID. |
|
427
|
|
|
* |
|
428
|
|
|
* @param mixed $value The option value |
|
429
|
|
|
* @param integer $storeId The ID of the store |
|
430
|
|
|
* |
|
431
|
|
|
* @return array|boolean The attribute option value instance |
|
432
|
|
|
*/ |
|
433
|
|
|
public function getEavAttributeOptionValueByOptionValueAndStoreId($value, $storeId) |
|
434
|
|
|
{ |
|
435
|
|
|
return $this->getProductProcessor()->getEavAttributeOptionValueByOptionValueAndStoreId($value, $storeId); |
|
436
|
|
|
} |
|
437
|
|
|
|
|
438
|
|
|
/** |
|
439
|
|
|
* Return's the URL rewrites for the passed URL entity type and ID. |
|
440
|
|
|
* |
|
441
|
|
|
* @param string $entityType The entity type to load the URL rewrites for |
|
442
|
|
|
* @param integer $entityId The entity ID to laod the rewrites for |
|
443
|
|
|
* |
|
444
|
|
|
* @return array The URL rewrites |
|
445
|
|
|
*/ |
|
446
|
1 |
|
public function getUrlRewritesByEntityTypeAndEntityId($entityType, $entityId) |
|
447
|
|
|
{ |
|
448
|
1 |
|
return $this->getProductProcessor()->getUrlRewritesByEntityTypeAndEntityId($entityType, $entityId); |
|
449
|
|
|
} |
|
450
|
|
|
|
|
451
|
|
|
/** |
|
452
|
|
|
* Load's and return's the product with the passed SKU. |
|
453
|
|
|
* |
|
454
|
|
|
* @param string $sku The SKU of the product to load |
|
455
|
|
|
* |
|
456
|
|
|
* @return array The product |
|
457
|
|
|
*/ |
|
458
|
|
|
public function loadProduct($sku) |
|
459
|
|
|
{ |
|
460
|
|
|
return $this->getProductProcessor()->loadProduct($sku); |
|
461
|
|
|
} |
|
462
|
|
|
|
|
463
|
|
|
/** |
|
464
|
|
|
* Load's and return's the product website relation with the passed product and website ID. |
|
465
|
|
|
* |
|
466
|
|
|
* @param string $productId The product ID of the relation |
|
467
|
|
|
* @param string $websiteId The website ID of the relation |
|
468
|
|
|
* |
|
469
|
|
|
* @return array The product website |
|
470
|
|
|
*/ |
|
471
|
|
|
public function loadProductWebsite($productId, $websiteId) |
|
472
|
|
|
{ |
|
473
|
|
|
return $this->getProductProcessor()->loadProductWebsite($productId, $websiteId); |
|
474
|
|
|
} |
|
475
|
|
|
|
|
476
|
|
|
/** |
|
477
|
|
|
* Return's the category product relation with the passed category/product ID. |
|
478
|
|
|
* |
|
479
|
|
|
* @param integer $categoryId The category ID of the category product relation to return |
|
480
|
|
|
* @param integer $productId The product ID of the category product relation to return |
|
481
|
|
|
* |
|
482
|
|
|
* @return array The category product relation |
|
483
|
|
|
*/ |
|
484
|
|
|
public function loadCategoryProduct($categoryId, $productId) |
|
485
|
|
|
{ |
|
486
|
|
|
return $this->getProductProcessor()->loadCategoryProduct($categoryId, $productId); |
|
487
|
|
|
} |
|
488
|
|
|
|
|
489
|
|
|
/** |
|
490
|
|
|
* Load's and return's the stock status with the passed product/website/stock ID. |
|
491
|
|
|
* |
|
492
|
|
|
* @param integer $productId The product ID of the stock status to load |
|
493
|
|
|
* @param integer $websiteId The website ID of the stock status to load |
|
494
|
|
|
* @param integer $stockId The stock ID of the stock status to load |
|
495
|
|
|
* |
|
496
|
|
|
* @return array The stock status |
|
497
|
|
|
*/ |
|
498
|
|
|
public function loadStockStatus($productId, $websiteId, $stockId) |
|
499
|
|
|
{ |
|
500
|
|
|
return $this->getProductProcessor()->loadStockStatus($productId, $websiteId, $stockId); |
|
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 item to load |
|
507
|
|
|
* @param integer $websiteId The website ID of the stock item to load |
|
508
|
|
|
* @param integer $stockId The stock ID of the stock item to load |
|
509
|
|
|
* |
|
510
|
|
|
* @return array The stock item |
|
511
|
|
|
*/ |
|
512
|
|
|
public function loadStockItem($productId, $websiteId, $stockId) |
|
513
|
|
|
{ |
|
514
|
|
|
return $this->getProductProcessor()->loadStockItem($productId, $websiteId, $stockId); |
|
515
|
|
|
} |
|
516
|
|
|
|
|
517
|
|
|
/** |
|
518
|
|
|
* Load's and return's the datetime attribute with the passed entity/attribute/store ID. |
|
519
|
|
|
* |
|
520
|
|
|
* @param integer $entityId The entity ID of the attribute |
|
521
|
|
|
* @param integer $attributeId The attribute ID of the attribute |
|
522
|
|
|
* @param integer $storeId The store ID of the attribute |
|
523
|
|
|
* |
|
524
|
|
|
* @return array|null The datetime attribute |
|
525
|
|
|
*/ |
|
526
|
|
|
public function loadProductDatetimeAttribute($entityId, $attributeId, $storeId) |
|
527
|
|
|
{ |
|
528
|
|
|
return $this->getProductProcessor()->loadProductDatetimeAttribute($entityId, $attributeId, $storeId); |
|
529
|
|
|
} |
|
530
|
|
|
|
|
531
|
|
|
/** |
|
532
|
|
|
* Load's and return's the decimal 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 decimal attribute |
|
539
|
|
|
*/ |
|
540
|
|
|
public function loadProductDecimalAttribute($entityId, $attributeId, $storeId) |
|
541
|
|
|
{ |
|
542
|
|
|
return $this->getProductProcessor()->loadProductDecimalAttribute($entityId, $attributeId, $storeId); |
|
543
|
|
|
} |
|
544
|
|
|
|
|
545
|
|
|
/** |
|
546
|
|
|
* Load's and return's the integer 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 integer attribute |
|
553
|
|
|
*/ |
|
554
|
|
|
public function loadProductIntAttribute($entityId, $attributeId, $storeId) |
|
555
|
|
|
{ |
|
556
|
|
|
return $this->getProductProcessor()->loadProductIntAttribute($entityId, $attributeId, $storeId); |
|
557
|
|
|
} |
|
558
|
|
|
|
|
559
|
|
|
/** |
|
560
|
|
|
* Load's and return's the text 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 text attribute |
|
567
|
|
|
*/ |
|
568
|
|
|
public function loadProductTextAttribute($entityId, $attributeId, $storeId) |
|
569
|
|
|
{ |
|
570
|
|
|
return $this->getProductProcessor()->loadProductTextAttribute($entityId, $attributeId, $storeId); |
|
571
|
|
|
} |
|
572
|
|
|
|
|
573
|
|
|
/** |
|
574
|
|
|
* Load's and return's the varchar 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 varchar attribute |
|
581
|
|
|
*/ |
|
582
|
|
|
public function loadProductVarcharAttribute($entityId, $attributeId, $storeId) |
|
583
|
|
|
{ |
|
584
|
|
|
return $this->getProductProcessor()->loadProductVarcharAttribute($entityId, $attributeId, $storeId); |
|
585
|
|
|
} |
|
586
|
|
|
|
|
587
|
|
|
/** |
|
588
|
|
|
* Persist's the passed product data and return's the ID. |
|
589
|
|
|
* |
|
590
|
|
|
* @param array $product The product data to persist |
|
591
|
|
|
* |
|
592
|
|
|
* @return string The ID of the persisted entity |
|
593
|
|
|
*/ |
|
594
|
|
|
public function persistProduct($product) |
|
595
|
|
|
{ |
|
596
|
|
|
return $this->getProductProcessor()->persistProduct($product); |
|
597
|
|
|
} |
|
598
|
|
|
|
|
599
|
|
|
/** |
|
600
|
|
|
* Persist's the passed product varchar attribute. |
|
601
|
|
|
* |
|
602
|
|
|
* @param array $attribute The attribute to persist |
|
603
|
|
|
* |
|
604
|
|
|
* @return void |
|
605
|
|
|
*/ |
|
606
|
|
|
public function persistProductVarcharAttribute($attribute) |
|
607
|
|
|
{ |
|
608
|
|
|
$this->getProductProcessor()->persistProductVarcharAttribute($attribute); |
|
609
|
|
|
} |
|
610
|
|
|
|
|
611
|
|
|
/** |
|
612
|
|
|
* Persist's the passed product integer attribute. |
|
613
|
|
|
* |
|
614
|
|
|
* @param array $attribute The attribute to persist |
|
615
|
|
|
* |
|
616
|
|
|
* @return void |
|
617
|
|
|
*/ |
|
618
|
|
|
public function persistProductIntAttribute($attribute) |
|
619
|
|
|
{ |
|
620
|
|
|
$this->getProductProcessor()->persistProductIntAttribute($attribute); |
|
621
|
|
|
} |
|
622
|
|
|
|
|
623
|
|
|
/** |
|
624
|
|
|
* Persist's the passed product decimal attribute. |
|
625
|
|
|
* |
|
626
|
|
|
* @param array $attribute The attribute to persist |
|
627
|
|
|
* |
|
628
|
|
|
* @return void |
|
629
|
|
|
*/ |
|
630
|
|
|
public function persistProductDecimalAttribute($attribute) |
|
631
|
|
|
{ |
|
632
|
|
|
$this->getProductProcessor()->persistProductDecimalAttribute($attribute); |
|
633
|
|
|
} |
|
634
|
|
|
|
|
635
|
|
|
/** |
|
636
|
|
|
* Persist's the passed product datetime attribute. |
|
637
|
|
|
* |
|
638
|
|
|
* @param array $attribute The attribute to persist |
|
639
|
|
|
* |
|
640
|
|
|
* @return void |
|
641
|
|
|
*/ |
|
642
|
|
|
public function persistProductDatetimeAttribute($attribute) |
|
643
|
|
|
{ |
|
644
|
|
|
$this->getProductProcessor()->persistProductDatetimeAttribute($attribute); |
|
645
|
|
|
} |
|
646
|
|
|
|
|
647
|
|
|
/** |
|
648
|
|
|
* Persist's the passed product text attribute. |
|
649
|
|
|
* |
|
650
|
|
|
* @param array $attribute The attribute to persist |
|
651
|
|
|
* |
|
652
|
|
|
* @return void |
|
653
|
|
|
*/ |
|
654
|
|
|
public function persistProductTextAttribute($attribute) |
|
655
|
|
|
{ |
|
656
|
|
|
$this->getProductProcessor()->persistProductTextAttribute($attribute); |
|
657
|
|
|
} |
|
658
|
|
|
|
|
659
|
|
|
/** |
|
660
|
|
|
* Persist's the passed product website data and return's the ID. |
|
661
|
|
|
* |
|
662
|
|
|
* @param array $productWebsite The product website data to persist |
|
663
|
|
|
* |
|
664
|
|
|
* @return void |
|
665
|
|
|
*/ |
|
666
|
|
|
public function persistProductWebsite($productWebsite) |
|
667
|
|
|
{ |
|
668
|
|
|
$this->getProductProcessor()->persistProductWebsite($productWebsite); |
|
669
|
|
|
} |
|
670
|
|
|
|
|
671
|
|
|
/** |
|
672
|
|
|
* Persist's the passed category product relation. |
|
673
|
|
|
* |
|
674
|
|
|
* @param array $categoryProduct The category product relation to persist |
|
675
|
|
|
* |
|
676
|
|
|
* @return void |
|
677
|
|
|
*/ |
|
678
|
|
|
public function persistCategoryProduct($categoryProduct) |
|
679
|
|
|
{ |
|
680
|
|
|
$this->getProductProcessor()->persistCategoryProduct($categoryProduct); |
|
681
|
|
|
} |
|
682
|
|
|
|
|
683
|
|
|
/** |
|
684
|
|
|
* Persist's the passed stock item data and return's the ID. |
|
685
|
|
|
* |
|
686
|
|
|
* @param array $stockItem The stock item data to persist |
|
687
|
|
|
* |
|
688
|
|
|
* @return void |
|
689
|
|
|
*/ |
|
690
|
|
|
public function persistStockItem($stockItem) |
|
691
|
|
|
{ |
|
692
|
|
|
$this->getProductProcessor()->persistStockItem($stockItem); |
|
693
|
|
|
} |
|
694
|
|
|
|
|
695
|
|
|
/** |
|
696
|
|
|
* Persist's the passed stock status data and return's the ID. |
|
697
|
|
|
* |
|
698
|
|
|
* @param array $stockStatus The stock status data to persist |
|
699
|
|
|
* |
|
700
|
|
|
* @return void |
|
701
|
|
|
*/ |
|
702
|
|
|
public function persistStockStatus($stockStatus) |
|
703
|
|
|
{ |
|
704
|
|
|
$this->getProductProcessor()->persistStockStatus($stockStatus); |
|
705
|
|
|
} |
|
706
|
|
|
|
|
707
|
|
|
/** |
|
708
|
|
|
* Persist's the URL write with the passed data. |
|
709
|
|
|
* |
|
710
|
|
|
* @param array $row The URL rewrite to persist |
|
711
|
|
|
* |
|
712
|
|
|
* @return void |
|
713
|
|
|
*/ |
|
714
|
1 |
|
public function persistUrlRewrite($row) |
|
715
|
|
|
{ |
|
716
|
1 |
|
$this->getProductProcessor()->persistUrlRewrite($row); |
|
717
|
1 |
|
} |
|
718
|
|
|
|
|
719
|
|
|
/** |
|
720
|
|
|
* Delete's the entity with the passed attributes. |
|
721
|
|
|
* |
|
722
|
|
|
* @param array $row The attributes of the entity to delete |
|
723
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
|
724
|
|
|
* |
|
725
|
|
|
* @return void |
|
726
|
|
|
*/ |
|
727
|
|
|
public function deleteProduct($row, $name = null) |
|
728
|
|
|
{ |
|
729
|
|
|
$this->getProductProcessor()->deleteProduct($row, $name); |
|
730
|
|
|
} |
|
731
|
|
|
|
|
732
|
|
|
/** |
|
733
|
|
|
* Delete's the URL rewrite(s) with the passed attributes. |
|
734
|
|
|
* |
|
735
|
|
|
* @param array $row The attributes of the entity to delete |
|
736
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
|
737
|
|
|
* |
|
738
|
|
|
* @return void |
|
739
|
|
|
*/ |
|
740
|
1 |
|
public function deleteUrlRewrite($row, $name = null) |
|
741
|
|
|
{ |
|
742
|
1 |
|
$this->getProductProcessor()->deleteUrlRewrite($row, $name); |
|
743
|
1 |
|
} |
|
744
|
|
|
|
|
745
|
|
|
/** |
|
746
|
|
|
* Delete's the stock item(s) with the passed attributes. |
|
747
|
|
|
* |
|
748
|
|
|
* @param array $row The attributes of the entity to delete |
|
749
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
|
750
|
|
|
* |
|
751
|
|
|
* @return void |
|
752
|
|
|
*/ |
|
753
|
|
|
public function deleteStockItem($row, $name = null) |
|
754
|
|
|
{ |
|
755
|
|
|
$this->getProductProcessor()->deleteStockItem($row, $name); |
|
756
|
|
|
} |
|
757
|
|
|
|
|
758
|
|
|
/** |
|
759
|
|
|
* Delete's the stock status with the passed attributes. |
|
760
|
|
|
* |
|
761
|
|
|
* @param array $row The attributes of the entity to delete |
|
762
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
|
763
|
|
|
* |
|
764
|
|
|
* @return void |
|
765
|
|
|
*/ |
|
766
|
|
|
public function deleteStockStatus($row, $name = null) |
|
767
|
|
|
{ |
|
768
|
|
|
$this->getProductProcessor()->deleteStockStatus($row, $name); |
|
769
|
|
|
} |
|
770
|
|
|
|
|
771
|
|
|
/** |
|
772
|
|
|
* Delete's the product website relations with the passed attributes. |
|
773
|
|
|
* |
|
774
|
|
|
* @param array $row The attributes of the entity to delete |
|
775
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
|
776
|
|
|
* |
|
777
|
|
|
* @return void |
|
778
|
|
|
*/ |
|
779
|
|
|
public function deleteProductWebsite($row, $name = null) |
|
780
|
|
|
{ |
|
781
|
|
|
$this->getProductProcessor()->deleteProductWebsite($row, $name); |
|
782
|
|
|
} |
|
783
|
|
|
|
|
784
|
|
|
/** |
|
785
|
|
|
* Delete's the category product relations with the passed attributes. |
|
786
|
|
|
* |
|
787
|
|
|
* @param array $row The attributes of the entity to delete |
|
788
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
|
789
|
|
|
* |
|
790
|
|
|
* @return void |
|
791
|
|
|
*/ |
|
792
|
|
|
public function deleteCategoryProduct($row, $name = null) |
|
793
|
|
|
{ |
|
794
|
|
|
$this->getProductProcessor()->deleteCategoryProduct($row, $name); |
|
795
|
|
|
} |
|
796
|
|
|
} |
|
797
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.