1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace GFG\DTOMarketplace\Context\Venture\Product; |
4
|
|
|
|
5
|
|
|
use GFG\DTOMarketplace\Context\Base; |
6
|
|
|
use GFG\DTOMarketplace\DataWrapper\Catalog\Simple; |
7
|
|
|
|
8
|
|
|
class Update extends Base |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* {@inheritdoc} |
12
|
|
|
*/ |
13
|
1 |
|
public function getHttpMethod() |
14
|
|
|
{ |
15
|
1 |
|
return 'put'; |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* {@inheritdoc} |
20
|
|
|
*/ |
21
|
1 |
|
public function exportContextData() |
22
|
|
|
{ |
23
|
1 |
|
$dataWrapper = $this->getDataWrapper(); |
24
|
1 |
|
$simpleCollection = []; |
25
|
1 |
|
$imageCollection = []; |
26
|
|
|
|
27
|
|
|
/** @var Simple $simple */ |
28
|
1 |
|
foreach ($dataWrapper->getSimpleCollection() as $simple) { |
29
|
1 |
|
$simpleCollection[] = [ |
30
|
1 |
|
'sku' => $simple->getSku(), |
31
|
1 |
|
'partner_sku' => $simple->getPartnerSku(), |
32
|
1 |
|
'venture_product_id' => $simple->getVentureProductId(), |
33
|
1 |
|
'variation' => $simple->getVariation(), |
34
|
1 |
|
'ean' => $simple->getEan(), |
35
|
1 |
|
'attributes' => $simple->getAttributes(), |
36
|
1 |
|
'status' => $simple->getStatus() |
37
|
1 |
|
]; |
38
|
1 |
|
} |
39
|
|
|
|
40
|
1 |
|
foreach ($dataWrapper->getImageCollection() as $image) { |
41
|
1 |
|
$imageCollection[] = [ |
42
|
1 |
|
'url' => $image->getUrl(), |
43
|
1 |
|
'position' => $image->getPosition() |
44
|
1 |
|
]; |
45
|
1 |
|
} |
46
|
|
|
|
47
|
1 |
|
return $this->prepareExport([ |
48
|
1 |
|
'sku' => $dataWrapper->getSku(), |
49
|
1 |
|
'partner_sku' => $dataWrapper->getPartnerSku(), |
50
|
1 |
|
'name' => $dataWrapper->getName(), |
51
|
1 |
|
'description' => $dataWrapper->getDescription(), |
52
|
1 |
|
'brand' => $dataWrapper->getBrand(), |
53
|
1 |
|
'attributes' => $dataWrapper->getAttributes(), |
54
|
1 |
|
'attribute_set' => $dataWrapper->getAttributeSet(), |
55
|
1 |
|
'image_collection' => $imageCollection, |
56
|
1 |
|
'simple_collection' => $simpleCollection, |
57
|
1 |
|
'supplier_delivery_time' => $dataWrapper->getSupplierDeliveryTime(), |
58
|
1 |
|
'shipment_type' => $dataWrapper->getShipmentType(), |
59
|
1 |
|
'status' => $dataWrapper->getStatus() |
60
|
1 |
|
]); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|