Skip to content

$elementName issue on A2X.php page #1

Description

@jpnathannew

Dear @fillup ,
Hope you are doing great,

I am using your one of the SDK walmart-partner-api-sdk-php. when I tried create configurable product I face one issue on variantAttributeNames array preparation.

My sample request array given below
requestArray.txt

For eg:
My prepared array under Footwear->Shoes category

'variantAttributeNames' => [
          'variantAttributeName' => ['color', 'shoeSize']
],

Expected XML

<variantAttributeNames>
      <variantAttributeName>color</variantAttributeName>
      <variantAttributeName>clothingSize</variantAttributeName>
</variantAttributeNames>

But I got the different type of XML. I got the following xml from A2X.php

<variantAttributeNames>
      <variantAttributeName>
            <item>color</item>
      </variantAttributeName>
      <variantAttributeName>
            <item>clothingSize</item>
      </variantAttributeName>
</variantAttributeNames>

item tag automatically added after array to xml conversion. After that I checked the A2X.php. I found one static name item on line number 121

$elementName = 'item'

After that I modified my array and modified A2X,php file.
I removed variantAttributeName from my array and replace the item to variantAttributeName in A2X.php

My updated request array given below
requestArray.txt

Now I get the expected result

<variantAttributeNames>
      <variantAttributeName>color</variantAttributeName>
      <variantAttributeName>clothingSize</variantAttributeName>
</variantAttributeNames>

Will my changes affect any other parts of SDK?
Do you have any functions that create products XML like the expected xml above? if you have the function in SDK then I can use that function to prepare XML from array. I can revert my changes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions