fillup / walmart-partner-api-sdk-php

PHP client for Walmart Partner APIs
MIT License
37 stars 51 forks source link

Trying to list bulk items with Variant Group #55

Open nikhil9191 opened 7 years ago

nikhil9191 commented 7 years ago

Hi, I am trying to list items with Variant group using API. As the documentation (XML example) provided on https://developer.walmart.com/#/apicenter/marketPlace/v3#bulkCreateUpdateItems, it can be done using version 3.1 and the SDK I installed have the example using version 2.1. The problem here is I don't know how to do it using version 2.1 as there is no XML example provided on Walmart documentation to add a variant group using 2.1. At this point, I am wondering if this can be done using version 2.1 and I tried converting the SDK code to version 3.1 here is the code.

$feed = $item->bulk([
            'MPItemFeed' => [
                'MPItemFeedHeader' => [
                    'version' => '3.1',
                    'requestId' => $time,
                    'requestBatchId' => $time,
                    'mart' => 'WALMART_US'
                ],
                'MPItem' => [
                    [   
                        'sku' => 'TEST1234-Black-S',
                        'productIdentifiers' => [
                            'productIdentifier' =>[
                                'productIdType' => 'GTIN',
                                'productId' => '01234567896756',
                            ]
                        ],
                        'MPProduct' => [
                            'SkuUpdate' => 'No',
                            'msrp' => 24.75,
                            'productName' => 'TEST HOG004 Black',
                            'ProductIdUpdate' => 'No',

                            'category' => [
                                'ClothingCategory' =>[
                                    'Clothing' => [
                                        'shortDescription' => "Demo Description",
                                        'manufacturer' => 'Test',
                                        'manufacturerPartNumber' => '1234567896756',
                                        'modelNumber' => 'TEST1234-Black',
                                        'mainImageUrl' => 'http://www.mysite.com/test-Black-M.jpg',
                                        'productSecondaryImageURL' => [
                                                'productSecondaryImageURLValue' => 'http://www.mysite.com/test-Black-A1.jpg'
                                        ],
                                        'color' => 'Black',
                                        'colorCategory' => [
                                            'colorCategoryValue' => 'Black'
                                        ],
                                        'gender' => 'Male',
                                        'clothingSize' => 'Small',
                                        'variantGroupId' => 'TEST12340001',
                                        'variantAttributeNames' => [
                                            'variantAttributeName' => 'color',
                                            'variantAttributeName' => 'clothingSize',
                                        ],
                                        'isPrimaryVariant' => 'Yes',
                                        'countryOfOriginTextiles' => 'USA',
                                        'waistSize' => [
                                            'measure' => 29.00,
                                            'unit' => 'in'
                                        ],
                                        'underwearStyle' => 'Test',
                                        'swatchImages' => [
                                            'swatchImage' => [
                                                'swatchVariantAttribute' => 'color',
                                                'swatchImageUrl' => 'http://www.mysite.com/black.jpg'
                                            ],
                                        ],
                                    ],
                                ],
                            ],
                        ],
                        'MPOffer' => [
                            'price' => 24.75,
                            'shippingWeight' => [
                                    'measure' => 10,
                                    'unit' => 'lb'
                            ],
                            'productTaxCode' => '2043068',
                            'shipsInOriginalPackaging' => 'Yes',

                        ],

                    ]
                ],
            ],
         ]);

Not sure if this is the right way to do this but doing so does not give any validation error and feed gets successfully submited but it gives two different error after processing.

I would really appreciate if you can help me move in the right direction as it is very important for me.