XML Import Problem

{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

 

Kann mir jemand sagen, was ich genau falsch mache?

 

Lieben Dank im voraus!
 

 

 

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

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}

 

Haha sorry tut mir leid :slight_smile:

Vielen Lieben Dank für die Hilfe.

 

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  active. Wie kann ich ein Befehl für die Konvertierung erstellen, z.b. wenn active auf 1 dann bitte auch bei Lagerbestand 0 verkaufen.

 

Danke im voraus :slight_smile:

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.

Hey danke :slight_smile:

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

 

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

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

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

Stichwörter:

  • „LOAD XML INFILE“
  • PHP PDO
  • simple_load_file , unset, addchild

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

Weihnachten fällt 2020 eh aus :slight_smile:

1 Like

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

Lass dir doch die Variable mal anzeigen, einfach mal

{$lastStock}

setzen und ausgeben lassen.

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.

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

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

Habt Ihr ne Lösung?

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

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

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

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