Variablen in PDF-Rechnung

Hallo Leute! Ich würde gerne in die PDF Rechnung die Telefonnummer und E-Mail Adresse des Kunden einfügen. Mit {$User.$address.phone} hab ich es geschafft die Telefonnummer einzufügen. Leider wird mir die E-Mail Adresse weder mit {$User.$additional.user.email} noch {$sUserData.additional.user.email} angezeigt. Hat da jemand einen Tipp? Danke

mit {$User|var_dump} werden dir alle verfügbaren Variablen angezeigt :wink:

Danke für die schnelle Antwort. Wo starte ich {$User|var_dump}? Lg

[quote=“apoolco”]Danke für die schnelle Antwort. Wo starte ich {$User|var_dump}? Lg[/quote] du schreibst die Variable direkt in das Dokument, so wie die anderen auch.

Hallo nochmal, leider schaffe ich es nicht in die Variable einzugeben bzw. in welches Dokument soll diese eingegeben werden? wäre jemand so lieb und könnte mir das schrittweise erklären, sozusagen “deppensicher” :wink: danke und lg

Du schreibst doch oben: Mit {$User.$address.phone} hab ich es geschafft die Telefonnummer einzufügen. Also hast du doch schon das Dokument bearbeitet, sonst hättest du {$User.$address.phone} nicht einfügen können, oder? Und jetzt fügst du einfach noch {$User|var_dump} ein!

es funktioniert einfach nicht, das gibts doch nicht!!! woran könnte es liegen?? dieses thema macht mich noch wahnsinnig :wtf:

Hi, öffne mal die Datei: /_default/documents/index.tpl Dort kannst du temporär 2 Zeilen eintragen: [code]

{$User|print\_r}

{$Order|print\_r}

[/code] Jetzt im Backend bei einer Bestellung auf Belege klicken und die Vorschau aufrufen. Dann sieht du alle Variablen im Beleg. Die Telefonnummer kannst du von der Rechnungsadresse wie folgt ausgeben: {$User.billing.phone} und die eMail-Adresse so: {$Order._user.email} Das Array auf dem PDF würde ich mir einmal ausdrucken. Dann kannst du nach diesen beiden Beispiel-Variablen und mit Hilfe des Arrays schnell und einfach auf deine gewünschten Variablen zugreifen.

2 „Gefällt mir“

poste mal den Code des Dokuments.

Meinst du mich ? :wink: Na, hier mal die Arrays mit Testdaten. Dann kann man sich das Passende hier raussuchen… [code] Array ( [shipping] => ArrayObject Object ( [id] => 138 [userID] => 55 [orderID] => 492 [company] => [department] => [salutation] => mr [firstname] => Paul [lastname] => Positiv [street] => Hauptstr. [streetnumber] => 36 [zipcode] => 49084 [city] => Osnabrück [countryID] => 2 [text1] => [text2] => [text3] => [text4] => [text5] => [text6] => [country] => ArrayObject Object ( [id] => 2 [countryname] => Deutschland [countryiso] => DE [countryarea] => deutschland [countryen] => GERMANY [position] => 1 [notice] => [shippingfree] => 0 [taxfree] => 0 [taxfree_ustid] => 0 [taxfree_ustid_checked] => 0 [active] => 1 [iso3] => DEU ) ) [billing] => ArrayObject Object ( [id] => 138 [userID] => 55 [orderID] => 492 [company] => [department] => [salutation] => mr [customernumber] => 20039 [firstname] => Paul [lastname] => Positiv [street] => Hauptstr. [streetnumber] => 36 [zipcode] => 49084 [city] => Osnabrück [phone] => 02555-997500 [fax] => [countryID] => 2 [ustid] => [text1] => [text2] => [text3] => [text4] => [text5] => [text6] => [country] => ArrayObject Object ( [id] => 2 [countryname] => Deutschland [countryiso] => DE [countryarea] => deutschland [countryen] => GERMANY [position] => 1 [notice] => [shippingfree] => 0 [taxfree] => 0 [taxfree_ustid] => 0 [taxfree_ustid_checked] => 0 [active] => 1 [iso3] => DEU ) ) [additional] => Array ( [countryShipping] => ArrayObject Object ( [id] => 2 [countryname] => Deutschland [countryiso] => DE [countryarea] => deutschland [countryen] => GERMANY [position] => 1 [notice] => [shippingfree] => 0 [taxfree] => 0 [taxfree_ustid] => 0 [taxfree_ustid_checked] => 0 [active] => 1 [iso3] => DEU ) [country] => ArrayObject Object ( [id] => 2 [countryname] => Deutschland [countryiso] => DE [countryarea] => deutschland [countryen] => GERMANY [position] => 1 [notice] => [shippingfree] => 0 [taxfree] => 0 [taxfree_ustid] => 0 [taxfree_ustid_checked] => 0 [active] => 1 [iso3] => DEU ) ) ) 1
Array ( [_id] => 492 [_order] => Array ( [id] => 492 [ordernumber] => 50500000011 [userID] => 55 [invoice_amount] => 104.95 [invoice_amount_net] => 88.19 [invoice_shipping] => 4.95 [invoice_shipping_net] => 4.16 [ordertime] => 2011-11-14 17:00:31 [status] => 0 [cleared] => 10 [paymentID] => 37 [transactionID] => 8143946 [comment] => [customercomment] => [internalcomment] => [net] => 0 [taxfree] => 0 [partnerID] => [temporaryID] => bcbff05b215e1e317ca8659a33f7e889 [referer] => [cleareddate] => 0000-00-00 00:00:00 [trackingcode] => [language] => de [dispatchID] => 9 [currency] => EUR [currencyFactor] => 1 [subshopID] => 1 [o_attr1] => [o_attr2] => [o_attr3] => [o_attr4] => [o_attr5] => [o_attr6] => [remote_addr] => 87.139.198.xxx [factor] => 1 [currencyID] => 1 [templatechar] => € [currencyName] => Euro ) [_positions] => Array ( [0] => Array ( [id] => 971 [orderID] => 492 [ordernumber] => 50500000011 [articleID] => 1 [articleordernumber] => SW10000 [price] => 100 [quantity] => 1 [name] => Testartikel [status] => 0 [shipped] => 0 [shippedgroup] => 0 [releasedate] => 0000-00-00 [modus] => 0 [esdarticle] => 0 [taxID] => 1 [config] => [od_attr1] => [od_attr2] => [od_attr3] => [od_attr4] => [od_attr5] => [od_attr6] => [attr1] => 0 [attr2] => 0 [attr3] => 0 [attr4] => [attr5] => 0 [attr6] => [attr7] => [attr8] => [attr9] => [attr10] => [attr11] => [attr12] => [attr13] => 0 [attr14] => [attr15] => [attr16] => [attr17] => 0000-00-00 [attr18] => [attr19] => [attr20] => [meta] => Array ( [articleID] => 1 [articleDetailsID] => 1 [ordernumber] => SW10000 [datum] => 2010-12-09 [sales] => 23 [highlight] => 0 [description] => [description_long] => TEXT [supplierName] => Testhersteller [supplierImg] => [articleName] => Testartikel [price] => 85,00 [pseudoprice] => 0 [tax] => 19 [attr1] => 0 [attr2] => 0 [attr3] => 0 [attr4] => [attr5] => 0 [attr6] => [attr7] => [attr8] => [attr9] => [attr10] => [attr11] => [attr12] => [attr13] => 0 [attr14] => [attr15] => [attr16] => [attr17] => 0000-00-00 [attr18] => [attr19] => [attr20] => [instock] => 99 [weight] => 0 [shippingtime] => 3 [pricegroup] => EK [pricegroupID] => 1 [pricegroupActive] => 0 [filtergroupID] => 0 [purchaseunit] => 0 [referenceunit] => 0 [unitID] => 0 [laststock] => 0 [additionaltext] => [sConfigurator] => 0 [esd] => 0 [sVoteAverange] => Array ( [averange] => 0 [count] => 0 ) [newArticle] => 0 [topseller] => 0 [sUpcoming] => 0 [sReleasedate] => [liveshopping] => [sVariantArticle] => [priceStartingFrom] => 85,00 [image] => Array ( [src] => Array ( [original] => http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6.jpg [0] => http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6_0.jpg [1] => http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6_1.jpg [2] => http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6_2.jpg [3] => http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6_3.jpg [4] => http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6_4.jpg [5] => http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6_5.jpg ) [res] => Array ( [original] => Array ( [width] => 1024 [height] => 768 ) [description] => [relations] => ) [position] => 1 [extension] => jpg [main] => 1 ) [linkBasket] => shopware.php?sViewport=basket&sAdd=SW10000 [linkDetails] => shopware.php?sViewport=detail&sArticle=1 [mode] => fix ) [tax] => 19 [netto] => 84.033613445378 [amount_netto] => 84.033613445378 [amount] => 100 ) [1] => Array ( [quantity] => 1 [netto] => 4.1596638655462 [tax] => 19 [price] => 4.95 [amount] => 4.95 [modus] => 1 [amount_netto] => 4.1596638655462 [articleordernumber] => [name] => Versandkosten ) ) [_userID] => 55 [_user] => Array ( [id] => 55 [password] => cb32154ec178b88cb055c4b8f50aeaae [email] => pp@shopware.de [active] => 1 [accountmode] => 0 [confirmationkey] => [paymentID] => 37 [firstlogin] => 2011-10-20 [lastlogin] => 2011-11-14 17:20:20 [sessionID] => f74f63abe5a75c290bcca42f98ca0e60 [newsletter] => 0 [validation] => [affiliate] => 0 [customergroup] => EK [paymentpreset] => 0 [language] => de [subshopID] => 1 [referer] => [pricegroupID] => [internalcomment] => [failedlogins] => 0 [lockeduntil] => 0000-00-00 00:00:00 ) [_billing] => Array ( [id] => 138 [userID] => 55 [orderID] => 492 [company] => [department] => [salutation] => mr [customernumber] => 20039 [firstname] => Paul [lastname] => Positiv [street] => Hauptstr. [streetnumber] => 36 [zipcode] => 49084 [city] => Osnabrück [phone] => 02555-997500 [fax] => [countryID] => 2 [ustid] => [text1] => [text2] => [text3] => [text4] => [text5] => [text6] => [country] => ArrayObject Object ( [id] => 2 [countryname] => Deutschland [countryiso] => DE [countryarea] => deutschland [countryen] => GERMANY [position] => 1 [notice] => [shippingfree] => 0 [taxfree] => 0 [taxfree_ustid] => 0 [taxfree_ustid_checked] => 0 [active] => 1 [iso3] => DEU ) ) [_shipping] => Array ( [id] => 138 [userID] => 55 [orderID] => 492 [company] => [department] => [salutation] => mr [firstname] => Paul [lastname] => Positiv [street] => Hauptstr. [streetnumber] => 36 [zipcode] => 49084 [city] => Osnabrück [countryID] => 2 [text1] => [text2] => [text3] => [text4] => [text5] => [text6] => [country] => ArrayObject Object ( [id] => 2 [countryname] => Deutschland [countryiso] => DE [countryarea] => deutschland [countryen] => GERMANY [position] => 1 [notice] => [shippingfree] => 0 [taxfree] => 0 [taxfree_ustid] => 0 [taxfree_ustid_checked] => 0 [active] => 1 [iso3] => DEU ) ) [_payment] => Array ( [id] => 37 [name] => billsafe_invoice [description] => BillSAFE [template] => [class] => [table] => [hide] => 0 [additionaldescription] =>

Bezahlen Sie bequem per Rechnung. [debit_percent] => 0 [surcharge] => 0 [surchargestring] => [position] => 0 [active] => 1 [esdactive] => 0 [embediframe] => [hideprospect] => 0 [action] => payment_billsafe [pluginID] => 105 ) [_dispatch] => Array ( [name] => Normal Versand [description] => Die ist meine Beschreibung ) [_net] => [_summaryNet] => [_amountNetto] => 88.193277310924 [_amount] => 104.95 [_tax] => Array ( [19] => 16.756722689076 ) [_currency] => Array ( [currency] => EUR [name] => Euro [factor] => 1 [char] => € ) [_shippingCosts] => 4.95 [_shippingCostsAsPosition] => 1 [_discount] => ) [/code]

super danke! es hat endlich geklappt :thumbup: danke euch für die unterstützung!!

@SebastianKlöpper schrieb:

Hi,

öffne mal die Datei: /_default/documents/index.tpl

Dort kannst du temporär 2 Zeilen eintragen:

{$User|print_r}

{$Order|print_r}

Jetzt im Backend bei einer Bestellung auf Belege klicken und die Vorschau aufrufen.
Dann sieht du alle Variablen im Beleg.

Die Telefonnummer kannst du von der Rechnungsadresse wie folgt ausgeben: {$User.billing.phone} und die eMail-Adresse so: {$Order._user.email}

Das Array auf dem PDF würde ich mir einmal ausdrucken. Dann kannst du nach diesen beiden Beispiel-Variablen und mit Hilfe des Arrays schnell und einfach auf deine gewünschten Variablen zugreifen.

 

Wie funktioniert das ab Shopware 5, dort funktionieren diese Variablen scheinbar nicht: Ich habe folgendes in die Header_Box_Right des Rechnungs-PDFs eingebaut:

Kunden-Tel.: {$User.billing.phone}
Kunden-E-Mail: {$Order._user.email}

Danach gespeichert und in der Vorschau steht nichts hinter dem Doppelpunkt. Dann noch in einer Bestellung ein Dokument neu generiert, auch keine Telefonnummer und E-Mail zu sehen. Laut diesem 6 Monate alten Post und Beitrag von Moritz gibt es im Array aber diese Variablen: Freitextfeld der Tabelle s_order_attributes in PDF Dokument ausgeben - Administration - Shopware Community Forum.

Wie lässt sich das einbauen?