@@ -39,6 +39,11 @@ class Converter
39
39
*/
40
40
protected $ serializer ;
41
41
42
+ /**
43
+ * @var \Magento\ConfigurableSampleData\Model\Product\ConverterFactory
44
+ */
45
+ private $ converterFactory ;
46
+
42
47
/**
43
48
* @param CustomerRepositoryInterface $customerAccount
44
49
* @param \Magento\Catalog\Model\ProductFactory $productFactory
@@ -55,6 +60,7 @@ public function __construct(
55
60
) {
56
61
$ this ->customerRepository = $ customerAccount ;
57
62
$ this ->productFactory = $ productFactory ;
63
+ $ this ->converterFactory = $ productConverterFactory ;
58
64
$ this ->productConverter = $ productConverterFactory ->create ();
59
65
$ this ->eavConfig = $ eavConfig ;
60
66
$ this ->serializer = $ serializer ?: ObjectManager::getInstance ()->get (Json::class);
@@ -175,9 +181,12 @@ protected function getAddresses(\Magento\Customer\Api\Data\AddressInterface $add
175
181
protected function convertProductData ($ productData )
176
182
{
177
183
$ productValues = $ this ->serializer ->unserialize ($ productData );
178
- $ productId = $ this ->getProductData ($ productValues ['sku ' ])->getId ();
184
+ $ product = $ this ->getProductData ($ productValues ['sku ' ]);
185
+ $ productId = $ product ->getId ();
179
186
$ productData = ['qty ' => $ productValues ['qty ' ]];
180
187
if (isset ($ productValues ['configurable_options ' ])) {
188
+ $ this ->productConverter = $ this ->converterFactory ->create ();
189
+ $ this ->productConverter ->setAttributeSetId ($ product ->getAttributeSetId ());
181
190
$ productData ['super_attribute ' ] = $ this ->getProductAttributes ($ productValues ['configurable_options ' ]);
182
191
}
183
192
return [$ productId => $ productData ];
0 commit comments