# Variablen in PDF-Rechnung

**URL:** https://forum.shopware.com/t/variablen-in-pdf-rechnung/5056
**Category:** Shopware 3.5
**Tags:** general
**Created:** [10. November 2011 um 13:08 UTC](https://forum.shopware.com/t/variablen-in-pdf-rechnung/5056 "2011-11-10T13:08:54Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![apoolco](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@apoolco](https://forum.shopware.com/u/apoolco)
#### Post date: [10. November 2011 um 13:08 UTC](https://forum.shopware.com/t/variablen-in-pdf-rechnung/5056/1 "2011-11-10T13:08:54Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ottscho](https://avatars.discourse-cdn.com/v4/letter/o/7ba0ec/32.png) [@ottscho](https://forum.shopware.com/u/ottscho)
#### Post date: [10. November 2011 um 13:48 UTC](https://forum.shopware.com/t/variablen-in-pdf-rechnung/5056/2 "2011-11-10T13:48:08Z")

</div>

mit {$User|var\_dump} werden dir alle verfügbaren Variablen angezeigt 😉

---

<div class="post-metadata">

### Author: ![apoolco](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@apoolco](https://forum.shopware.com/u/apoolco)
#### Post date: [10. November 2011 um 15:16 UTC](https://forum.shopware.com/t/variablen-in-pdf-rechnung/5056/3 "2011-11-10T15:16:16Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ottscho](https://avatars.discourse-cdn.com/v4/letter/o/7ba0ec/32.png) [@ottscho](https://forum.shopware.com/u/ottscho)
#### Post date: [11. November 2011 um 20:00 UTC](https://forum.shopware.com/t/variablen-in-pdf-rechnung/5056/4 "2011-11-11T20:00:50Z")

</div>

[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.

---

<div class="post-metadata">

### Author: ![apoolco](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@apoolco](https://forum.shopware.com/u/apoolco)
#### Post date: [15. November 2011 um 11:35 UTC](https://forum.shopware.com/t/variablen-in-pdf-rechnung/5056/5 "2011-11-15T11:35:27Z")

</div>

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” 😉 danke und lg

---

<div class="post-metadata">

### Author: ![ottscho](https://avatars.discourse-cdn.com/v4/letter/o/7ba0ec/32.png) [@ottscho](https://forum.shopware.com/u/ottscho)
#### Post date: [15. November 2011 um 12:04 UTC](https://forum.shopware.com/t/variablen-in-pdf-rechnung/5056/6 "2011-11-15T12:04:52Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![apoolco](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@apoolco](https://forum.shopware.com/u/apoolco)
#### Post date: [16. November 2011 um 09:51 UTC](https://forum.shopware.com/t/variablen-in-pdf-rechnung/5056/7 "2011-11-16T09:51:13Z")

</div>

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

---

<div class="post-metadata">

### Author: ![SebastianKloepper](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/sebastiankloepper/32/21435_2.png) [@SebastianKloepper](https://forum.shopware.com/u/SebastianKloepper)
#### Post date: [16. November 2011 um 10:51 UTC](https://forum.shopware.com/t/variablen-in-pdf-rechnung/5056/8 "2011-11-16T10:51:51Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ottscho](https://avatars.discourse-cdn.com/v4/letter/o/7ba0ec/32.png) [@ottscho](https://forum.shopware.com/u/ottscho)
#### Post date: [16. November 2011 um 10:53 UTC](https://forum.shopware.com/t/variablen-in-pdf-rechnung/5056/9 "2011-11-16T10:53:11Z")

</div>

poste mal den Code des Dokuments.

---

<div class="post-metadata">

### Author: ![SebastianKloepper](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/sebastiankloepper/32/21435_2.png) [@SebastianKloepper](https://forum.shopware.com/u/SebastianKloepper)
#### Post date: [16. November 2011 um 11:30 UTC](https://forum.shopware.com/t/variablen-in-pdf-rechnung/5056/10 "2011-11-16T11:30:17Z")

</div>

Meinst du mich ? 😉 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](http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6.jpg) [0] =\> [http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6\_0.jpg](http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6_0.jpg) [1] =\> [http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6\_1.jpg](http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6_1.jpg) [2] =\> [http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6\_2.jpg](http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6_2.jpg) [3] =\> [http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6\_3.jpg](http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6_3.jpg) [4] =\> [http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6\_4.jpg](http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6_4.jpg) [5] =\> [http://www.xx.de/images/articles/bbb01f23c75710ae1bc8535323aeead6\_5.jpg](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](mailto: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]

---

<div class="post-metadata">

### Author: ![apoolco](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@apoolco](https://forum.shopware.com/u/apoolco)
#### Post date: [16. November 2011 um 11:50 UTC](https://forum.shopware.com/t/variablen-in-pdf-rechnung/5056/11 "2011-11-16T11:50:33Z")

</div>

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

---

<div class="post-metadata">

### Author: ![stilmi](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@stilmi](https://forum.shopware.com/u/stilmi)
#### Post date: [10. Februar 2017 um 09:15 UTC](https://forum.shopware.com/t/variablen-in-pdf-rechnung/5056/12 "2017-02-10T09:15:08Z")

</div>

> [@SebastianKlöpper schrieb:](https://forum.shopware.com/profile/66/SebastianKl%C3%B6pper "SebastianKl%C3%B6pper")
> 
> 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.

&nbsp;

Wie funktioniert das ab Shopware 5, dort funktionieren diese Variablen scheinbar nicht: Ich habe folgendes in die&nbsp;Header\_Box\_Right des Rechnungs-PDFs eingebaut:

Kunden-Tel.:&nbsp;{$User.billing.phone}  
Kunden-E-Mail:&nbsp;{$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:&nbsp;[Freitextfeld der Tabelle s\_order\_attributes in PDF Dokument ausgeben - Administration - Shopware Community Forum](https://forum.shopware.com/discussion/39868/freitextfeld-der-tabelle-s-order-attributes-in-pdf-dokument-ausgeben).

Wie lässt sich das einbauen?
