# XML Import Problem

**URL:** <https://forum.shopware.com/t/xml-import-problem/71003>\
**Category:** Allgemein\
**Created:** [18. November 2020 um 16:21 UTC](https://forum.shopware.com/t/xml-import-problem/71003 "2020-11-18T16:21:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Koulis123](https://avatars.discourse-cdn.com/v4/letter/k/d9b06d/32.png) [@Koulis123](https://forum.shopware.com/u/Koulis123)\
**Post date:** [18. November 2020 um 16:21 UTC](https://forum.shopware.com/t/xml-import-problem/71003/1 "2020-11-18T16:21:26Z")

</div>

```
{if
    $categoryId == "A00" || 
    $categoryId == "A06" || 
    $categoryId == "A11" || 
    $categoryId == "A12" || 
    $categoryId == "A15" || 
    $categoryId == "A19" || 
    $categoryId == "A20" || 
    $categoryId == "A21" || 
    $categoryId == "A22" || 
    $categoryId == "A23" || 
    $categoryId == "A24" || 
    $categoryId == "A25" || 
    $categoryId == "A26" || 
    $categoryId == "A27" || 
    $categoryId == "A28" || 
    $categoryId == "A29" || 
    $categoryId == "A30" || 
    $categoryId == "A31" || 
    $categoryId == "A41" || 
    $categoryId == "A61" || 
    $categoryId == "B21" || 
    $categoryId == "G14" }113

{elseif
    $categoryId == "B00" ||
    $categoryId == "B61" ||
    $categoryId == "B71" }112

{elseif
    $categoryId == "B01" ||
    $categoryId == "B02" ||
    $categoryId == "B51" ||
    $categoryId == "B52" ||
    $categoryId == "B53" }41

{elseif
    $categoryId == "B11"}115

{elseif
    $categoryId == "B12" || 
    $categoryId == "E00" || 
    $categoryId == "E11" ||
    $categoryId == "E12" || 
    $categoryId == "E13" ||
    $categoryId == "E21" || 
    $categoryId == "E32" ||
    $categoryId == "E33" || 
    $categoryId == "E34" ||
    $categoryId == "E41" || 
    $categoryId == "E51" ||
    $categoryId == "E61" }114

{elseif
    $categoryId == "B13" }42

{elseif
    $categoryId == "C00" ||
    $categoryId == "C01" ||
    $categoryId == "C02" || 
    $categoryId == "C03" ||
    $categoryId == "C04" || 
    $categoryId == "C05" ||
    $categoryId == "C06" || 
    $categoryId == "C07" ||
    $categoryId == "C08" || 
    $categoryId == "C10" ||
    $categoryId == "C11" ||
    $categoryId == "C12" || 
    $categoryId == "C13" ||
    $categoryId == "C14" || 
    $categoryId == "C15" ||
    $categoryId == "C16" || 
    $categoryId == "C17" ||
    $categoryId == "C21" }84

{elseif
    $categoryId == "C31"}56

{elseif
    $categoryId == "C32"}58

{elseif
    $categoryId == "C33" ||
    $categoryId == "E14" }57

{elseif
    $categoryId == "C34"}60

{elseif
    $categoryId == "C41"}91

{elseif
    $categoryId == "C51"}55

{elseif
    $categoryId == "C31"}56

{elseif
    $categoryId == "C52" ||
    $categoryId == "C53" ||
    $categoryId == "F00" ||
    $categoryId == "F01" ||
    $categoryId == "F02" ||
    $categoryId == "F11" ||
    $categoryId == "F12" ||
    $categoryId == "F31" }54

{elseif
    $categoryId == "D00" ||
    $categoryId == "D01" ||
    $categoryId == "D11" ||
    $categoryId == "D21" ||
    $categoryId == "D31" ||
    $categoryId == "D41" ||
    $categoryId == "D42" ||
    $categoryId == "D51" ||
    $categoryId == "D61" ||
    $categoryId == "D71" ||
    $categoryId == "D72" ||
    $categoryId == "D73" ||
    $categoryId == "D74" ||
    $categoryId == "D75" ||
    $categoryId == "F03" ||
    $categoryId == "F21" ||
    $categoryId == "F42" ||
    $categoryId == "F51" ||
    $categoryId == "F52" ||
    $categoryId == "F53" ||
    $categoryId == "F54" ||
    $categoryId == "F55" ||
    $categoryId == "F56" ||
    $categoryId == "F61" ||
    $categoryId == "F71" ||
    $categoryId == "G00" ||
    $categoryId == "G01" ||
    $categoryId == "G02" ||
    $categoryId == "G03" ||
    $categoryId == "G04" ||
    $categoryId == "G05" ||
    $categoryId == "G06" ||
    $categoryId == "G07" ||
    $categoryId == "G08" ||
    $categoryId == "G09" ||
    $categoryId == "G10" ||
    $categoryId == "G11" ||
    $categoryId == "G12" ||
    $categoryId == "G13" ||
    $categoryId == "G15" ||
    $categoryId == "G16" ||
    $categoryId == "G18" ||
    $categoryId == "G21" ||
    $categoryId == "G22" ||
    $categoryId == "G23" ||
    $categoryId == "H00" ||
    $categoryId == "H01" ||
    $categoryId == "H02" ||
    $categoryId == "H03" ||
    $categoryId == "I00" ||
    $categoryId == "I01" ||
    $categoryId == "I03" ||
    $categoryId == "I11" ||
    $categoryId == "I21" ||
    $categoryId == "I22" ||
    $categoryId == "I31" ||
    $categoryId == "I41" ||
    $categoryId == "I51" ||
    $categoryId == "I99" ||
    $categoryId == "K00" ||
    $categoryId == "K01" ||
    $categoryId == "K02" ||
    $categoryId == "K03" ||
    $categoryId == "K11" ||
    $categoryId == "K12" ||
    $categoryId == "K21" ||
    $categoryId == "K22" ||
    $categoryId == "K31" ||
    $categoryId == "K45" ||
    $categoryId == "K51" ||
    $categoryId == "K61" ||
    $categoryId == "K71" ||
    $categoryId == "K80" ||
    $categoryId == "K81" ||
    $categoryId == "K82" ||
    $categoryId == "K83" ||
    $categoryId == "K84" ||
    $categoryId == "K85" ||
    $categoryId == "K86" ||
    $categoryId == "K87" ||
    $categoryId == "N00" ||
    $categoryId == "N01" ||
    $categoryId == "N02" ||
    $categoryId == "N03" ||
    $categoryId == "N04" ||
    $categoryId == "N05" ||
    $categoryId == "N06" ||
    $categoryId == "N07" ||
    $categoryId == "N08" ||
    $categoryId == "N09" ||
    $categoryId == "N10" ||
    $categoryId == "N11" ||
    $categoryId == "N15" ||
    $categoryId == "N20" ||
    $categoryId == "N40" ||
    $categoryId == "N41" ||
    $categoryId == "N42" ||
    $categoryId == "N43" ||
    $categoryId == "N44" ||
    $categoryId == "N45" ||
    $categoryId == "N46" ||
    $categoryId == "N47" ||
    $categoryId == "N48" ||
    $categoryId == "N49" ||
    $categoryId == "N51" ||
    $categoryId == "N52" ||
    $categoryId == "N60" ||
    $categoryId == "N61" ||
    $categoryId == "N62" ||
    $categoryId == "N63" ||
    $categoryId == "N64" ||
    $categoryId == "N65" ||
    $categoryId == "N70" ||
    $categoryId == "N71" ||
    $categoryId == "N72" ||
    $categoryId == "N73" ||
    $categoryId == "N74" ||
    $categoryId == "N75" ||
    $categoryId == "N76" ||
    $categoryId == "N77" ||
    $categoryId == "N78" ||
    $categoryId == "N90" ||
    $categoryId == "W00" ||
    $categoryId == "W01" ||
    $categoryId == "W03" ||
    $categoryId == "W11" ||
    $categoryId == "W12" ||
    $categoryId == "W35" ||
    $categoryId == "W36" ||
    $categoryId == "W40" ||
    $categoryId == "W41" ||
    $categoryId == "W42" ||
    $categoryId == "W43" ||
    $categoryId == "W44" ||
    $categoryId == "W45" ||
    $categoryId == "W46" ||
    $categoryId == "W47" }123

{/if}

```

Hallo alle zusammen,

ich möchte eine XML Artikel Datei importieren. Ich habe soweit die Kategorien des Lieferanten mit meinen Kategorien unter dem Importprofil -\> Konvertierungen -\> Import Umwandlung hinzugefügt. (s. Code)

Es tauch allerdings folgendes Problem auf:

Fehlermeldung

Fehler beim Import

Syntax Error 1a" on line 143 “$categoryId == “F71” ||” Stack overflow in template parser

&nbsp;

Kann mir jemand sagen, was ich genau falsch mache?

&nbsp;

Lieben Dank im voraus!  
&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [19. November 2020 um 07:53 UTC](https://forum.shopware.com/t/xml-import-problem/71003/2 "2020-11-19T07:53:10Z")

</div>

Vermutlich ist deine IF-ELSE-Orgie zuviel für die Smarty Engine.

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [19. November 2020 um 08:13 UTC](https://forum.shopware.com/t/xml-import-problem/71003/3 "2020-11-19T08:13:54Z")

</div>

Das ist eine ziemliche abendteurliche Methode. Ich würde es (wenn das unbedingt so sein muss) mal so versuchen (10 Minuten gebraucht für das umtippen):

```
{if $categoryId|in_array:["A00","A00","A06","A11","A12","A15","A19","A20","A21","A22","A23","A24","A25","A26","A27","A28","A29","A30","A31","A41","A61","B21","G14"]}
113

{elseif $categoryId|in_array:["B00","B61","B71"]}
112

{elseif $categoryId|in_array:["B01","B02","B51","B52","B53"]}
41

{elseif $categoryId|in_array:["B11"]}
115

{elseif $categoryId|in_array:["B12","E00","E11","E12","E13","E21","E32","E33","E34","E41","E51","E61"]}
114

{elseif $categoryId|in_array:["B13"]}
42

{elseif $categoryId|in_array:["C00","C01","C02","C03","C04","C05","C06","C07","C08","C10","C11","C12","C13","C14","C15","C16","C17","C21"]}
84

{elseif $categoryId|in_array:["C31"]}
56

{elseif $categoryId|in_array:["C32"]}
58

{elseif $categoryId|in_array:["C33","E14"]}
57

{elseif $categoryId|in_array:["C34"]}
60

{elseif $categoryId|in_array:["C41"]}
91

{elseif $categoryId|in_array:["C51"]}
55

{elseif $categoryId|in_array:["C31"]}
56

{elseif $categoryId|in_array:["C52","C53","F00","F01","F02","F11","F12","F31"]}
54

{elseif $categoryId|in_array:["D00","D01","D11","D21","D31","D41","D42","D51","D61","D71","D72","D73","D74","D75","F03","F21","F42","F51","F52","F53","F54","F55","F56","F61","F71","G00","G01","G02","G03","G04","G05","G06","G07","G08","G09","G10","G11","G12","G13","G15","G16","G18","G21","G22","G23","H00","H01","H02","H03","I00","I01","I03","I11","I21","I22","I31","I41","I51","I99","K00","K01","K02","K03","K11","K12","K21","K22","K31","K45","K51","K61","K71","K80","K81","K82","K83","K84","K85","K86","K87","N00","N01","N02","N03","N04","N05","N06","N07","N08","N09","N10","N11","N15","N20","N40","N41","N42","N43","N44","N45","N46","N47","N48","N49","N51","N52","N60","N61","N62","N63","N64","N65","N70","N71","N72","N73","N74","N75","N76","N77","N78","N90","W00","W01","W03","W11","W12","W35","W36","W40","W41","W42","W43","W44","W45","W46","W47"]}
123

{/if}

```

&nbsp;

---

<div class="post-metadata">

**Author:** ![Koulis123](https://avatars.discourse-cdn.com/v4/letter/k/d9b06d/32.png) [@Koulis123](https://forum.shopware.com/u/Koulis123)\
**Post date:** [19. November 2020 um 09:06 UTC](https://forum.shopware.com/t/xml-import-problem/71003/4 "2020-11-19T09:06:41Z")

</div>

Haha sorry tut mir leid 🙂

Vielen Lieben Dank für die Hilfe.

&nbsp;

Jetzt mal zwei weitere Fragen. Vielleicht kannst Du mir hierzu einen Ansatz geben.

Die Bilder der Artikel sitzen auf dem FTP Server von dem Lieferanten. Macht es Sinn, diese auf meinem Server zu laden und den IMG Pfad anzupassen?

Der Lieferant hat in der XML keinen Lagerbestand sondern nur eine Zeile Active oder nicht&nbsp; active. Wie kann ich ein Befehl für die Konvertierung erstellen, z.b. wenn active auf 1 dann bitte auch bei Lagerbestand 0 verkaufen.

&nbsp;

Danke im voraus 🙂

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [19. November 2020 um 09:23 UTC](https://forum.shopware.com/t/xml-import-problem/71003/5 "2020-11-19T09:23:29Z")

</div>

Hm,

wenn die Bilder beim Lieferanten auch von außerhalb erreichbar sind, also über die URL, muss man diese nicht unbedingt auf den eigenen Server holen. Sind sie aber nicht über die URL erreichbar, ja dann bleibt nicht anderes übrig.

Das mit dem Lagerbestand ist natürlich nicht so toll, wenn der Lieferant dazu keine Angaben hat. Solange wie im Shop der Artikel nicht als “abverkauf” markiert ist, kann man das mit Lagebestand 0 übernehmen. Da geht dann halt der Bestand ins Negative.

---

<div class="post-metadata">

**Author:** ![Koulis123](https://avatars.discourse-cdn.com/v4/letter/k/d9b06d/32.png) [@Koulis123](https://forum.shopware.com/u/Koulis123)\
**Post date:** [19. November 2020 um 14:46 UTC](https://forum.shopware.com/t/xml-import-problem/71003/6 "2020-11-19T14:46:33Z")

</div>

Hey danke 🙂

```
{if
    $lastStock == 1}1
    
    {else}0
{/if}

```

&nbsp;

Wie schreibe ich am besten die Funktion? Stimmt das so?

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [19. November 2020 um 14:52 UTC](https://forum.shopware.com/t/xml-import-problem/71003/7 "2020-11-19T14:52:25Z")

</div>

Das ist keine Funktion, sondern eine Abfrage. Aber stimmt so, wobei lastStock nur 1 oder 0 ausgibt. Eine zusätzliche Abfrage macht keinen Sinn.

---

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [19. November 2020 um 14:53 UTC](https://forum.shopware.com/t/xml-import-problem/71003/8 "2020-11-19T14:53:46Z")

</div>

Du solltest ggf mal darüber nachdenken direkt auf die Datenbank zu gehen statt diesen Import/Shopware Framework&nbsp;zu nutzen. Dann kannst du auch ordentliches PHP nutzen und wirst Weihnachten noch fertig 😛

Stichwörter:

- „LOAD XML INFILE“
- PHP PDO
- simple\_load\_file , unset, addchild

---

<div class="post-metadata">

**Author:** ![Koulis123](https://avatars.discourse-cdn.com/v4/letter/k/d9b06d/32.png) [@Koulis123](https://forum.shopware.com/u/Koulis123)\
**Post date:** [19. November 2020 um 14:55 UTC](https://forum.shopware.com/t/xml-import-problem/71003/9 "2020-11-19T14:55:29Z")

</div>

Funktioniert allerdings nicht also setzt den Verkauf unter 0 nicht auf aktiv.

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [19. November 2020 um 14:55 UTC](https://forum.shopware.com/t/xml-import-problem/71003/10 "2020-11-19T14:55:31Z")

</div>

Weihnachten fällt 2020 eh aus 🙂

---

<div class="post-metadata">

**Author:** ![Koulis123](https://avatars.discourse-cdn.com/v4/letter/k/d9b06d/32.png) [@Koulis123](https://forum.shopware.com/u/Koulis123)\
**Post date:** [19. November 2020 um 15:07 UTC](https://forum.shopware.com/t/xml-import-problem/71003/11 "2020-11-19T15:07:29Z")

</div>

Hast Du eine Idee woran das liegen kann? Also da wird absolut nichts auf aktiv gesetzt.

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [19. November 2020 um 15:12 UTC](https://forum.shopware.com/t/xml-import-problem/71003/12 "2020-11-19T15:12:53Z")

</div>

Lass dir doch die Variable mal anzeigen, einfach mal

```
{$lastStock}

```

setzen und ausgeben lassen.

---

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [19. November 2020 um 15:15 UTC](https://forum.shopware.com/t/xml-import-problem/71003/13 "2020-11-19T15:15:43Z")

</div>

laststock und active gibt es jeweil 2 mal. einmal in s\_articles und einmal in s\_articles\_details.

Guck mal ob ggf eines von den beiden vll doch ausgelöst wurde.

---

<div class="post-metadata">

**Author:** ![Koulis123](https://avatars.discourse-cdn.com/v4/letter/k/d9b06d/32.png) [@Koulis123](https://forum.shopware.com/u/Koulis123)\
**Post date:** [19. November 2020 um 15:16 UTC](https://forum.shopware.com/t/xml-import-problem/71003/14 "2020-11-19T15:16:32Z")

</div>

Kannst Du mir kurz weiterhelfen, wie genau mach ich das?&nbsp;

---

<div class="post-metadata">

**Author:** ![Koulis123](https://avatars.discourse-cdn.com/v4/letter/k/d9b06d/32.png) [@Koulis123](https://forum.shopware.com/u/Koulis123)\
**Post date:** [19. November 2020 um 16:25 UTC](https://forum.shopware.com/t/xml-import-problem/71003/15 "2020-11-19T16:25:34Z")

</div>

Wurde nicht ausgelöst… Ich habe in die Datenbank reingeschaut da war alles auf 0 gestellt.

---

<div class="post-metadata">

**Author:** ![Koulis123](https://avatars.discourse-cdn.com/v4/letter/k/d9b06d/32.png) [@Koulis123](https://forum.shopware.com/u/Koulis123)\
**Post date:** [20. November 2020 um 10:43 UTC](https://forum.shopware.com/t/xml-import-problem/71003/16 "2020-11-20T10:43:01Z")

</div>

Habt Ihr ne Lösung?

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [20. November 2020 um 11:51 UTC](https://forum.shopware.com/t/xml-import-problem/71003/17 "2020-11-20T11:51:16Z")

</div>

Ich nutze diesen Import über XML kaum, da kann ich jetzt nicht viel an Lösungen anbieten.

---

<div class="post-metadata">

**Author:** ![Koulis123](https://avatars.discourse-cdn.com/v4/letter/k/d9b06d/32.png) [@Koulis123](https://forum.shopware.com/u/Koulis123)\
**Post date:** [20. November 2020 um 11:57 UTC](https://forum.shopware.com/t/xml-import-problem/71003/18 "2020-11-20T11:57:40Z")

</div>

hm ok also nur das mit dem Abverkauf funktioniert irgendwie nicht.&nbsp;

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [20. November 2020 um 12:03 UTC](https://forum.shopware.com/t/xml-import-problem/71003/19 "2020-11-20T12:03:51Z")

</div>

Vielleicht muss die benutzte Variable “lastStock” hier komplett klein geschrieben werden. Wird im Standrad-Profil so angezeigt. Einfach mal testen.

---

<div class="post-metadata">

**Author:** ![Koulis123](https://avatars.discourse-cdn.com/v4/letter/k/d9b06d/32.png) [@Koulis123](https://forum.shopware.com/u/Koulis123)\
**Post date:** [20. November 2020 um 12:41 UTC](https://forum.shopware.com/t/xml-import-problem/71003/20 "2020-11-20T12:41:35Z")

</div>

ne funktioniert auch nicht. Das ist extrem komisch. Habt Ihr ne andere Idee wie man sowas abwickeln kann?

[Nächste Seite](https://forum.shopware.com/t/xml-import-problem/71003.md?page=2)
