WPAllImport: multiple attributes per product in different nodes

140 Views Asked by At

In the xml to be imported each node has a SKU, a characteristic label and its value. A SKU has multiple characteristics so there are multiple nodes for the same SKU. I want to add the characteristics in the description field of each matched product. But I don't know how I can append each characteristic to a new line every time a product is matched by the sku. And how I can delete the description in the first occurence of the SKU in order not to have huge repititive description...

Here is a part of the xml:

<chars>
  <product>SKU1</product>
  <atribute>Label1</atribute>
  <value>Value1</value>
</chars>
<chars>
  <product>SKU1</product>
  <atribute>Label2</atribute>
  <value>Value2</value>
</chars>
<chars>
  <product>SKU2</product>
  <atribute>Label21</atribute>
  <value>Value21</value>
</chars>
<chars>
  <product>SKU3</product>
  <atribute>Label31</atribute>
  <value>Value31</value>
</chars>
<chars>
  <product>SKU3</product>
  <atribute>Label32</atribute>
  <value>Value32</value>
</chars>
<chars>....</chars>

Given this example I want product with SKU1's description: Label1:Value1 Label2:Value2 etc.

0

There are 0 best solutions below