Hallo liebe Community,
ich habe in der neuen Shopware Version 5.2 in der Freitextfeld Verwaltung ein Feld (attribute1) in der Tabelle s_order_attributes angelegt.
Den Wert dieses Felders würde ich nun gerne in einem PDF Dokument ausgeben. Kann mir jemand einen Tipp geben, welche Variable ich im Dokumenten Template eintragen muss?
LG,
Dirk
Ich habe aktuell das selbe Problem. Würde mich ebenfalls über eine Lösung freuen.
Ich habe das mal über den Support für Pickware herausgesucht. Das sollte in den Belegen so gehen:
{$position.meta.attributes.core->get(‘attributname’)}
1 „Gefällt mir“
Ich habe die Variable zum testen eigefügt. Leider erscheint beim genererieren des PDF Dokuments ein 503 Service Unavailable Fehler
Ich habe eine 5.2.5 installiert und bekomme ebenfalls einen 503 ins Dokument.
Gibt es noch andere Möglichkeiten?
Ok, das oben war doch aus der details-attributes.
Hier für die order-attribute: {$Order._order.attributes.attribute1}
1 „Gefällt mir“
Das hat funktioniert für die s_order_attributes. DANKE!
Gibt es für die s_order_documents_attributes ebenfalls eine fertige Smarty Variable die ich nutzen kann?
Hier habe ich ebenfalls ein attr1 angelegt.
Sowas in der Art: {$Order._documents.attributes.attr1} funktioniert nicht.
Ja super. Das scheint jetzt zu funktionieren Es wird nun angezeigt.
Mir ist das Prinzip nur noch nicht ganz klar. Ich habe für den Kunden ebenfalls ein zusätzliches Freitextfeld angelegt (unter s_user_attributes).
Demnach müsste hier doch die Variable {$User._user.attributes.attribute1} lauten? Da wird mir nichts angezeigt. Wie kann man solche Variablen am einfachsten ermitteln?
Du kannst per |print_r immer die Variablen des Arrays ausgeben lassen. Mit {$Order|print_r} bekommst du dann alle Variablen mit Inhalt aus dem $Order Array. Das sieht dann bspw. so aus:
ATTRIBUT: Array
(
[_id] => 18
[_order] => Array
(
[id] => 18
[ordernumber] => 20003
[userID] => 1
[invoice_amount] => 44
[invoice_amount_net] => 36.97
[invoice_shipping] => 0
[invoice_shipping_net] => 0
[ordertime] => 2016-08-18 15:12:32
[status] => 0
[cleared] => 17
[paymentID] => 7
[transactionID] => EC-42916766HR442283C
[comment] =>
[customercomment] =>
[internalcomment] =>
[net] => 0
[taxfree] => 0
[partnerID] =>
[temporaryID] => b2f7f63a7bc7f14b16ae2210afc19a1f
[referer] =>
[cleareddate] =>
[trackingcode] =>
[language] => 1
[dispatchID] => 0
[currency] => EUR
[currencyFactor] => 1
[subshopID] => 1
[remote_addr] => 127.0.0.1
[deviceType] => desktop
[factor] => 1
[currencyID] => 1
[templatechar] => €
[currencyName] => Euro
[attributes] => Array
(
[id] => 4
[orderID] => 18
[attribute1] => 3
[attribute2] =>
[attribute3] =>
[attribute4] =>
[attribute5] =>
[attribute6] =>
[swag_payal_billing_agreement_id] =>
[swag_payal_express] =>
[connect_shop_id] =>
[connect_order_id] =>
)
)
[_positions] => Array
(
[0] => Array
(
[id] => 42
[orderID] => 18
[ordernumber] => 20003
[articleID] => 71
[articleordernumber] => SW10071
[price] => 44.9
[quantity] => 1
[name] => »Der Indianer« Feinstes IKARIMI®-Lachsfilet
[status] => 0
[shipped] => 0
[shippedgroup] => 0
[releasedate] => 0000-00-00
[modus] => 0
[esdarticle] => 0
[taxID] => 1
[tax_rate] => 19
[config] =>
[ean] =>
[unit] => Kilogramm
[pack_unit] =>
[articleTaxID] => 1
[attr1] =>
[attr2] =>
[attr3] =>
[attr4] =>
[attr5] =>
[attr6] =>
[attr7] =>
[attr8] =>
[attr9] =>
[attr10] =>
[attr11] =>
[attr12] =>
[attr13] =>
[attr14] =>
[attr15] =>
[attr16] =>
[attr17] =>
[attr18] =>
[attr19] =>
[attr20] =>
[attributes] => Array
(
[id] => 7
[detailID] => 42
[attribute1] =>
[attribute2] =>
[attribute3] =>
[attribute4] =>
[attribute5] =>
[attribute6] =>
[swag_custom_products_mode] => 0
[swag_custom_products_configuration_hash] =>
)
[tax] => 19
[netto] => 37.731092436975
[amount_netto] => 37.73
[amount] => 44.9
)
[1] => Array
(
[id] => 43
[orderID] => 18
[ordernumber] => 20003
[articleID] => 0
[articleordernumber] => sw-discount
[price] => -0.9
[quantity] => 1
[name] => -2 % Warenkorbrabatt
[status] => 0
[shipped] => 0
[shippedgroup] => 0
[releasedate] => 0000-00-00
[modus] => 3
[esdarticle] => 0
[taxID] => 0
[tax_rate] => 19
[config] =>
[ean] =>
[unit] =>
[pack_unit] =>
[articleTaxID] =>
[attr1] =>
[attr2] =>
[attr3] =>
[attr4] =>
[attr5] =>
[attr6] =>
[attr7] =>
[attr8] =>
[attr9] =>
[attr10] =>
[attr11] =>
[attr12] =>
[attr13] =>
[attr14] =>
[attr15] =>
[attr16] =>
[attr17] =>
[attr18] =>
[attr19] =>
[attr20] =>
[attributes] => Array
(
[id] => 8
[detailID] => 43
[attribute1] =>
[attribute2] =>
[attribute3] =>
[attribute4] =>
[attribute5] =>
[attribute6] =>
[swag_custom_products_mode] => 0
[swag_custom_products_configuration_hash] =>
)
[tax] => 19
[netto] => -0.7563025210084
[amount_netto] => -0.76
[amount] => -0.9
)
)
[_userID] => 1
[_user] => Array
(
[id] => 1
[password] => $2y$10$9LB1SwTwDRqYkeTIv9uakucRSCSdDbBIQSpzdU6IhbxEJl7jc0GPK
[encoder] => bcrypt
[email] => mn@shopware.com
[active] => 1
[accountmode] => 0
[confirmationkey] =>
[paymentID] => 7
[firstlogin] => 2016-08-16
[lastlogin] => 2016-08-18 15:12:31
[sessionID] => fkv45fmk4dgme847ikcvdfbm66
[newsletter] => 0
[validation] =>
[affiliate] => 0
[customergroup] => EK
[paymentpreset] => 0
[language] => 1
[subshopID] => 1
[referer] =>
[pricegroupID] =>
[internalcomment] =>
[failedlogins] => 0
[lockeduntil] =>
[default_billing_address_id] => 1
[default_shipping_address_id] => 1
[title] =>
[salutation] => mr
[firstname] => Shopware
[lastname] => AG
[birthday] =>
[customernumber] => 20003
[customergroupID] => 1
)
[_billing] => Array
(
[id] => 3
[userID] => 1
[orderID] => 18
[company] =>
[department] =>
[salutation] => mr
[customernumber] => 20003
[firstname] => Shopware
[lastname] => AG
[street] => bfghsailhdhfgui
[zipcode] => uihsfgauifg
[city] => hgiouasfghzuiaoghpd
[phone] =>
[countryID] => 2
[stateID] =>
[ustid] =>
[additional_address_line1] =>
[additional_address_line2] =>
[title] =>
[country] => ArrayObject Object
(
[storage:ArrayObject:private] => Array
(
[id] => 2
[countryname] => Deutschland
[countryiso] => DE
[areaID] => 1
[countryen] => GERMANY
[position] => 1
[notice] =>
[shippingfree] => 0
[taxfree] => 0
[taxfree_ustid] => 0
[taxfree_ustid_checked] => 0
[active] => 1
[iso3] => DEU
[display_state_in_registration] => 0
[force_state_in_registration] => 0
)
)
[state] => Array
(
)
[attributes] => Array
(
[id] => 3
[billingID] => 3
[text1] =>
[text2] =>
[text3] =>
[text4] =>
[text5] =>
[text6] =>
)
)
[_shipping] => Array
(
[id] => 3
[userID] => 1
[orderID] => 18
[company] =>
[department] =>
[salutation] => mr
[firstname] => Shopware
[lastname] => AG
[street] => bfghsailhdhfgui
[zipcode] => uihsfgauifg
[city] => hgiouasfghzuiaoghpd
[countryID] => 2
[stateID] =>
[additional_address_line1] =>
[additional_address_line2] =>
[title] =>
[attributes] => Array
(
[id] => 3
[shippingID] => 3
[text1] =>
[text2] =>
[text3] =>
[text4] =>
[text5] =>
[text6] =>
)
[country] => ArrayObject Object
(
[storage:ArrayObject:private] => Array
(
[id] => 2
[countryname] => Deutschland
[countryiso] => DE
[areaID] => 1
[countryen] => GERMANY
[position] => 1
[notice] =>
[shippingfree] => 0
[taxfree] => 0
[taxfree_ustid] => 0
[taxfree_ustid_checked] => 0
[active] => 1
[iso3] => DEU
[display_state_in_registration] => 0
[force_state_in_registration] => 0
)
)
[state] => Array
(
)
)
[_payment] => Array
(
[id] => 7
[name] => paypal
[description] => PayPal
[template] =>
[class] =>
[table] =>
[hide] => 0
[additionaldescription] =>
Bezahlung per PayPal - einfach, schnell und sicher.
[debit_percent] => 0
[surcharge] => 0
[surchargestring] =>
[position] => 0
[active] => 1
[esdactive] => 0
[embediframe] =>
[hideprospect] => 0
[action] => payment_paypal
[pluginID] => 61
[source] =>
[mobile_inactive] => 0
)
[_paymentInstances] => Array
(
[0] => Array
(
[id] => 3
[payment_mean_id] => 7
[order_id] => 18
[user_id] => 1
[firstname] => Shopware
[lastname] => AG
[address] => bfghsailhdhfgui
[zipcode] => uihsfgauifg
[city] => hgiouasfghzuiaoghpd
[account_number] =>
[account_holder] =>
[bank_name] =>
[bank_code] =>
[bic] =>
[iban] =>
[amount] => 44.0000
[created_at] => 2016-08-18
)
)
[_dispatch] => Array
(
)
[_net] =>
[_summaryNet] =>
[_amountNetto] => 36.97
[_amount] => 44
[_tax] => Array
(
[19.00] => 7.03
)
[_currency] => Array
(
[currency] => EUR
[name] => Euro
[factor] => 1
[char] => €
)
[_shippingCosts] => 0
[_shippingCostsAsPosition] => 1
[_discount] => -0.9
[_taxRepository] =>
)
Und da musst du dich dann entlang hangeln - bis du den Wert bekommst den du brauchst.
Das neu angelegte Attr im Order-Array bekomme ich damit raus.
Allerdings nicht das neue Attr aus der Tabelle: s_order_documents_attributes für die PDF-Belegerstellung
Sowohl per {$Order|print_r} als auch per {$Document|print_r} werden diese nicht ausgegeben.
Heißt hier müsste man mittels Plugin die neuen Attr zur Verfügung stellen für die PDF-Belegerstellung oder?
Ich denke auch, dass du dafür ein Plugin brauchst
dkynast
8. September 2016 um 11:07
13
Hat inzwischen jemand eine Lösung gefunden, wie man in der PDF-Belegerstellung an die Freitextfelder aus s_order_documents_attributes kommt? Ich kann die ja sogar ganz schick in der Belegerstellung setzen. Aber im Template komme ich einfach nicht an die Daten :-/
Wie kann man denn diesem Array Variablen hinzufügen? Bräuchte z.B. den Wert für „purchaseunit“.
Danke für eine weiterbringende Antwort
@Moritz Naczenski schrieb:
Du kannst per |print_r immer die Variablen des Arrays ausgeben lassen. Mit {$Order|print_r} bekommst du dann alle Variablen mit Inhalt aus dem $Order Array. Das sieht dann bspw. so aus:
ATTRIBUT: Array
(
[_id] => 18
[_order] => Array
(
[id] => 18
[ordernumber] => 20003
[userID] => 1
[invoice_amount] => 44
[invoice_amount_net] => 36.97
[invoice_shipping] => 0
[invoice_shipping_net] => 0
[ordertime] => 2016-08-18 15:12:32
[status] => 0
[cleared] => 17
[paymentID] => 7
[transactionID] => EC-42916766HR442283C
[comment] =>
[customercomment] =>
[internalcomment] =>
[net] => 0
[taxfree] => 0
[partnerID] =>
[temporaryID] => b2f7f63a7bc7f14b16ae2210afc19a1f
[referer] =>
[cleareddate] =>
[trackingcode] =>
[language] => 1
[dispatchID] => 0
[currency] => EUR
[currencyFactor] => 1
[subshopID] => 1
[remote_addr] => 127.0.0.1
[deviceType] => desktop
[factor] => 1
[currencyID] => 1
[templatechar] => €
[currencyName] => Euro
[attributes] => Array
(
[id] => 4
[orderID] => 18
[attribute1] => 3
[attribute2] =>
[attribute3] =>
[attribute4] =>
[attribute5] =>
[attribute6] =>
[swag_payal_billing_agreement_id] =>
[swag_payal_express] =>
[connect_shop_id] =>
[connect_order_id] =>
)
)
[_positions] => Array
(
[0] => Array
(
[id] => 42
[orderID] => 18
[ordernumber] => 20003
[articleID] => 71
[articleordernumber] => SW10071
[price] => 44.9
[quantity] => 1
[name] => »Der Indianer« Feinstes IKARIMI®-Lachsfilet
[status] => 0
[shipped] => 0
[shippedgroup] => 0
[releasedate] => 0000-00-00
[modus] => 0
[esdarticle] => 0
[taxID] => 1
[tax_rate] => 19
[config] =>
[ean] =>
[unit] => Kilogramm
[pack_unit] =>
[articleTaxID] => 1
[attr1] =>
[attr2] =>
[attr3] =>
[attr4] =>
[attr5] =>
[attr6] =>
[attr7] =>
[attr8] =>
[attr9] =>
[attr10] =>
[attr11] =>
[attr12] =>
[attr13] =>
[attr14] =>
[attr15] =>
[attr16] =>
[attr17] =>
[attr18] =>
[attr19] =>
[attr20] =>
[attributes] => Array
(
[id] => 7
[detailID] => 42
[attribute1] =>
[attribute2] =>
[attribute3] =>
[attribute4] =>
[attribute5] =>
[attribute6] =>
[swag_custom_products_mode] => 0
[swag_custom_products_configuration_hash] =>
)
[tax] => 19
[netto] => 37.731092436975
[amount_netto] => 37.73
[amount] => 44.9
)
[1] => Array
(
[id] => 43
[orderID] => 18
[ordernumber] => 20003
[articleID] => 0
[articleordernumber] => sw-discount
[price] => -0.9
[quantity] => 1
[name] => -2 % Warenkorbrabatt
[status] => 0
[shipped] => 0
[shippedgroup] => 0
[releasedate] => 0000-00-00
[modus] => 3
[esdarticle] => 0
[taxID] => 0
[tax_rate] => 19
[config] =>
[ean] =>
[unit] =>
[pack_unit] =>
[articleTaxID] =>
[attr1] =>
[attr2] =>
[attr3] =>
[attr4] =>
[attr5] =>
[attr6] =>
[attr7] =>
[attr8] =>
[attr9] =>
[attr10] =>
[attr11] =>
[attr12] =>
[attr13] =>
[attr14] =>
[attr15] =>
[attr16] =>
[attr17] =>
[attr18] =>
[attr19] =>
[attr20] =>
[attributes] => Array
(
[id] => 8
[detailID] => 43
[attribute1] =>
[attribute2] =>
[attribute3] =>
[attribute4] =>
[attribute5] =>
[attribute6] =>
[swag_custom_products_mode] => 0
[swag_custom_products_configuration_hash] =>
)
[tax] => 19
[netto] => -0.7563025210084
[amount_netto] => -0.76
[amount] => -0.9
)
)
[_userID] => 1
[_user] => Array
(
[id] => 1
[password] => $2y$10$9LB1SwTwDRqYkeTIv9uakucRSCSdDbBIQSpzdU6IhbxEJl7jc0GPK
[encoder] => bcrypt
[email] => mn@shopware.com
[active] => 1
[accountmode] => 0
[confirmationkey] =>
[paymentID] => 7
[firstlogin] => 2016-08-16
[lastlogin] => 2016-08-18 15:12:31
[sessionID] => fkv45fmk4dgme847ikcvdfbm66
[newsletter] => 0
[validation] =>
[affiliate] => 0
[customergroup] => EK
[paymentpreset] => 0
[language] => 1
[subshopID] => 1
[referer] =>
[pricegroupID] =>
[internalcomment] =>
[failedlogins] => 0
[lockeduntil] =>
[default_billing_address_id] => 1
[default_shipping_address_id] => 1
[title] =>
[salutation] => mr
[firstname] => Shopware
[lastname] => AG
[birthday] =>
[customernumber] => 20003
[customergroupID] => 1
)
[_billing] => Array
(
[id] => 3
[userID] => 1
[orderID] => 18
[company] =>
[department] =>
[salutation] => mr
[customernumber] => 20003
[firstname] => Shopware
[lastname] => AG
[street] => bfghsailhdhfgui
[zipcode] => uihsfgauifg
[city] => hgiouasfghzuiaoghpd
[phone] =>
[countryID] => 2
[stateID] =>
[ustid] =>
[additional_address_line1] =>
[additional_address_line2] =>
[title] =>
[country] => ArrayObject Object
(
[storage:ArrayObject:private] => Array
(
[id] => 2
[countryname] => Deutschland
[countryiso] => DE
[areaID] => 1
[countryen] => GERMANY
[position] => 1
[notice] =>
[shippingfree] => 0
[taxfree] => 0
[taxfree_ustid] => 0
[taxfree_ustid_checked] => 0
[active] => 1
[iso3] => DEU
[display_state_in_registration] => 0
[force_state_in_registration] => 0
)
)
[state] => Array
(
)
[attributes] => Array
(
[id] => 3
[billingID] => 3
[text1] =>
[text2] =>
[text3] =>
[text4] =>
[text5] =>
[text6] =>
)
)
[_shipping] => Array
(
[id] => 3
[userID] => 1
[orderID] => 18
[company] =>
[department] =>
[salutation] => mr
[firstname] => Shopware
[lastname] => AG
[street] => bfghsailhdhfgui
[zipcode] => uihsfgauifg
[city] => hgiouasfghzuiaoghpd
[countryID] => 2
[stateID] =>
[additional_address_line1] =>
[additional_address_line2] =>
[title] =>
[attributes] => Array
(
[id] => 3
[shippingID] => 3
[text1] =>
[text2] =>
[text3] =>
[text4] =>
[text5] =>
[text6] =>
)
[country] => ArrayObject Object
(
[storage:ArrayObject:private] => Array
(
[id] => 2
[countryname] => Deutschland
[countryiso] => DE
[areaID] => 1
[countryen] => GERMANY
[position] => 1
[notice] =>
[shippingfree] => 0
[taxfree] => 0
[taxfree_ustid] => 0
[taxfree_ustid_checked] => 0
[active] => 1
[iso3] => DEU
[display_state_in_registration] => 0
[force_state_in_registration] => 0
)
)
[state] => Array
(
)
)
[_payment] => Array
(
[id] => 7
[name] => paypal
[description] => PayPal
[template] =>
[class] =>
[table] =>
[hide] => 0
[additionaldescription] =>
Bezahlung per PayPal - einfach, schnell und sicher.
[debit_percent] => 0
[surcharge] => 0
[surchargestring] =>
[position] => 0
[active] => 1
[esdactive] => 0
[embediframe] =>
[hideprospect] => 0
[action] => payment_paypal
[pluginID] => 61
[source] =>
[mobile_inactive] => 0
)
[_paymentInstances] => Array
(
[0] => Array
(
[id] => 3
[payment_mean_id] => 7
[order_id] => 18
[user_id] => 1
[firstname] => Shopware
[lastname] => AG
[address] => bfghsailhdhfgui
[zipcode] => uihsfgauifg
[city] => hgiouasfghzuiaoghpd
[account_number] =>
[account_holder] =>
[bank_name] =>
[bank_code] =>
[bic] =>
[iban] =>
[amount] => 44.0000
[created_at] => 2016-08-18
)
)
[_dispatch] => Array
(
)
[_net] =>
[_summaryNet] =>
[_amountNetto] => 36.97
[_amount] => 44
[_tax] => Array
(
[19.00] => 7.03
)
[_currency] => Array
(
[currency] => EUR
[name] => Euro
[factor] => 1
[char] => €
)
[_shippingCosts] => 0
[_shippingCostsAsPosition] => 1
[_discount] => -0.9
[_taxRepository] =>
)
Und da musst du dich dann entlang hangeln - bis du den Wert bekommst den du brauchst.
Also ich hätte gerne wieder unser Freitextfeld in unseren Rechnungen. Aber ich bekomm es einfach nimmer rein.
[@Moritz Naczenski](http://forum.shopware.com/profile/14574/Moritz Naczenski „Moritz Naczenski“) irgendeine Idee oder Hilfe dafür?
SW 5.3.1 im Einsatz.
Früher stand da immer
{$position.attr1}
und hat unser Freitextfeld 1 ausgegeben, falls es befüllt war. Jetzt kommt da nix mehr.
Wir haben dort unseren Text für DIFFERENZBESTEUERUNG hinterlegt, ist doof wenn man das jetzt manuell über den Dokument-Kommentar eingeben muß.
Hallo zusammen,
wir haben das gleiche Problem. Aktuell werden auf den Rechnungs- bzw. Angebots-PDFs keine Freitextfelder ausgegeben. Hat hier schon jemand eine Lösung?
Hallo,
welche Freitextfelder sind denn überhaupt nötig? Ansich sind alle notwendigen Freitextfelder bei den Belegen vorhanden, man muss Sie eben nur entsprechend aufrufen und ausgeben lassen.
Beste Grüße
Sebastian
1 „Gefällt mir“
Bzgl. der Einbindung von Freitextfeldern haben wir uns an der Doku orientiert. Wir haben in der offer.tpl im Bereich {block name=„document_index_table_name“} {$position.attr20} und {$position.attr56} versucht einzubinden, leider ohne Erfolg. In den Freitextfelder ist ein Untertitel und eine Kurzbeschreibung für Angebote enthalten. Benötigen wir leider, da unsere Artikel technisch sehr komplex sind.
Eine Idee was wir falsch gemacht haben?
Hier der Code aus unserem eigenen Template:
{extends file="parent:documents/offer.tpl"}
{block name="document_index_table_name"}
{if $position.name == 'Versandkosten'}
{s name="DocumentIndexPositionNameShippingCosts"}
{$position.name}
{/s}
{else}
{s name="DocumentIndexPositionNameDefault"}
{$position.name|nl2br|wordwrap:65:"\n"}
{/s}
{$position.attr20}
{$position.attr56}
{/if}
{/block}
Hallo,
hast du es schon einmal über {$position.meta.attributes.core->get(‘attr20’)} probiert? Was sagt der var_dump der jeweiligen Arrays?
Beste Grüße
Sebastian
1 „Gefällt mir“
Hallo,
vielen Dank für die Antwort.
{$position.meta.attributes.core->get(‘attr20’)} gibt etwas aus. Jedoch ist die Ausgabe nicht dekodiert.
Gefunden dazu habe ich nur, dass die PDF in der Document.php eigentlich schon dekodieren sollte.
In Smarty direkt dekodieren wird wohl aber nicht klappen oder? Hast du vielleicht nochmal einen Tipp für uns?