• Resolved stea1978

    (@stea1978)


    Hello. I have an xml with prodcuts which have differnets attributes.
    For example one product has three attributes:
    <attributes>
    <attr>
    <name>Lumens</name>
    <text>2600</text>
    </attr>
    <attr>
    <name>Material</name>
    <text>Acrylic</text>
    </attr>
    <attr>
    <name>Color</name>
    <text>White</text>
    </attr>
    </attributes>

    and another has two of this three attributes:
    <attributes>
    <attr>
    <name>Lumens</name>
    <text>2900</text>
    </attr>
    <attr>
    <name>Color</name>
    <text>Black</text>
    </attr>
    </attributes>

    So i create three attributes in wp all import plugin and
    in field name i give the name of the slug lumens and i drag the attribute in value {attributes[1]/attr[1]/text[1]}
    in second field name i give the name of the slug material and i drag the attribute in value {attributes[1]/attr[2]/text[1]}
    and in third field name i give the name of the slug color and i drag the attribute in value {attributes[1]/attr[3]/text[1]}.

    The problem is that in second product which has two attributes and not three in attribute color instead of take the name of this attribute takes the name of attribute Material but with the right value of black.

    I dont know if i have a clear explanation..
    I wish you could help me, i made all the imports write and works fine but without the right attributes i can’t import the xml.

    Thanks in advance and i hope you can help me find out where i am wrong

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @stea1978,

    You can use XPath queries to make sure you’re getting the correct attribute names & values in each record. For example:

    Lumens: {attributes/attr[./name="Lumens"]/text[1]}
    Material: {attributes/attr[./name="Material"]/text[1]}
    Color: {attributes/attr[./name="Color"]/text[1]}

    See: https://d.pr/i/nBFugq.

    Thread Starter stea1978

    (@stea1978)

    Thank you for your response.
    I think it’s a solution of my problem. I’ll test it and i see if it will work.

    Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problem with attributes’ is closed to new replies.