1

I run a local shoestore. I'm using woocommerce in wordpress with a import tool wp import all. This is using a xml file.

This file is a dump from de cash register in my store and look like this:

<product>
    <productid>435</productid>
    <productnaam>grey suede rice hand punch</productnaam>
    <type>430g</type>
    <opmerking />
    <kleur>Grijs</kleur>
    <merk>Gram</merk>
    <groep>Herenschoen</groep>
    <soort>sneaker laag</soort>
    <btw_percentage>0.2100</btw_percentage>  
    <leverancier>Areyouswedish</leverancier>
    <seizoen>15zomer</seizoen>
    <webwinkel>false</webwinkel>
</product>

<maat>
    <productid>435</productid>
    <barcode>100003356</barcode>
    <maat>45</maat>
    <maatprijs>119.95</maatprijs>
    <voorraad>0</voorraad>
  </maat>
  <maat>
    <productid>435</productid>
    <barcode>100003357</barcode>
    <maat>46</maat>
    <maatprijs>119.95</maatprijs>
    <voorraad>0</voorraad>
  </maat>

The tag <maat>45 </maat>must become <size>45</size>

And

The tag <productnaam>grey suede rice hand punch</productnaam> must be add between first <maat></maat>

It have to look something like this:

<product>
    <productid>435</productid>
    <productnaam>grey suede rice hand punch</productnaam>
    <type>430g</type>
    <opmerking />
    <kleur>Grijs</kleur>
    <merk>Gram</merk>
    <groep>Herenschoen</groep>
    <soort>sneaker laag</soort>
    <btw_percentage>0.2100</btw_percentage> 
    <leverancier>Areyouswedish</leverancier>
    <seizoen>15zomer</seizoen>
    <webwinkel>false</webwinkel>
</product>

<maat>
    <productid>435</productid>
    <productnaam>grey suede rice hand punch</productnaam>
    <barcode>100003356</barcode>
    <size>45</size>
    <maatprijs>119.95</maatprijs>
    <voorraad>0</voorraad>
  </maat>
  <maat>
    <productid>435</productid>
    <productnaam>grey suede rice hand punch</productnaam>
    <barcode>100003357</barcode>
    <size>46</size>
    <maatprijs>119.95</maatprijs>
    <voorraad>0</voorraad>
  </maat>

Is there a possibility to do this in php and how.

I hope that someone can help me with this issue

Thanks in advance

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • 1
    Possible duplicate of [How do you parse and process HTML/XML in PHP?](http://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php) – chris85 Jan 11 '17 at 14:05
  • It would seem to me that you need to fix the Cash register to generate the information in the format that you would like it to be in – RiggsFolly Jan 11 '17 at 14:14
  • That's the problem with the cash register it impossible to change the output format. – Hans Haverkate Jan 11 '17 at 14:19

0 Answers0