@@ -193,7 +193,10 @@ protected function getSimpleProductData($qty = 1000)
193
193
if ($ qty != null ) {
194
194
$ productData [self ::KEY_CUSTOM_ATTRIBUTES ] = [
195
195
[self ::KEY_ATTRIBUTE_CODE => 'description ' , 'value ' => 'My Product Description ' ],
196
- [self ::KEY_ATTRIBUTE_CODE => self ::CODE_QUANTITY_AND_STOCK_STATUS , 'value ' => [true , $ qty ]],
196
+ [
197
+ self ::KEY_ATTRIBUTE_CODE => self ::CODE_QUANTITY_AND_STOCK_STATUS ,
198
+ 'value ' => ['is_in_stock ' => true , 'qty ' => $ qty ]
199
+ ],
197
200
];
198
201
}
199
202
@@ -271,6 +274,15 @@ protected function getProduct($sku)
271
274
*/
272
275
protected function saveProduct ($ product )
273
276
{
277
+ if (isset ($ product ['custom_attributes ' ])) {
278
+ for ($ i =0 ; $ i <sizeof ($ product ['custom_attributes ' ]); $ i ++) {
279
+ if ($ product ['custom_attributes ' ][$ i ]['attribute_code ' ] == 'category_ids '
280
+ && !is_array ($ product ['custom_attributes ' ][$ i ]['value ' ])
281
+ ) {
282
+ $ product ['custom_attributes ' ][$ i ]['value ' ] = ["" ];
283
+ }
284
+ }
285
+ }
274
286
$ serviceInfo = [
275
287
'rest ' => [
276
288
'resourcePath ' => self ::RESOURCE_PATH ,
@@ -295,6 +307,15 @@ protected function saveProduct($product)
295
307
*/
296
308
protected function updateProduct ($ product )
297
309
{
310
+ if (isset ($ product ['custom_attributes ' ])) {
311
+ for ($ i =0 ; $ i <sizeof ($ product ['custom_attributes ' ]); $ i ++) {
312
+ if ($ product ['custom_attributes ' ][$ i ]['attribute_code ' ] == 'category_ids '
313
+ && !is_array ($ product ['custom_attributes ' ][$ i ]['value ' ])
314
+ ) {
315
+ $ product ['custom_attributes ' ][$ i ]['value ' ] = ["" ];
316
+ }
317
+ }
318
+ }
298
319
$ sku = $ product [ProductInterface::SKU ];
299
320
if (TESTS_WEB_API_ADAPTER == self ::ADAPTER_REST ) {
300
321
$ product [ProductInterface::SKU ] = null ;
0 commit comments