Vorlagen / Templates
Dieser Artikel beschreibt das Anlegen und die Verwendung von Templates.
Inhalt:
Konfiguration
Templates können im Webinterface unter der Registerkarte “Vorlagen” konfiguriert werden. Bei der Verwendung des Plugins mpXcloudprint in Shopware 6 kann der Name des zu verwendenden Templates hinterlegt werden.
Formatierung
Um Bons zu Formatieren, wird für STAR Drucker die Star-Document-Markup-Language verwendet.
Genaue Informationen sind auf folgender Internetseite zu finden:
https://star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/articles/markup/markupintro.html
Variablen
Dynamische Inhalte können mithilfe von Variablen in das Template eingefügt werden.
Für Templates wird die Engine “Mustache” verwendet.
Weitere Informationen sind in der Dokumentation von Mustache zu finden:
https://mustache.github.io/mustache.5.html
Um eine Variable einzufügen, verwendet man folgenden Code-Ausschnitt: {{variablenName}}
Standardvariablen durch mpXcloudprint
order.orderNumber
order.orderDateTime
order.customerComment
customer.title
customer.firstName
customer.lastName
customer.company
customer.email
customer.phone
payment.methodName
payment.amountTotal
payment.isPaid
payment.refund (nur mit Plugin Artikelpfand)
address.title
address.firstName
address.lastName
address.company
address.department
address.phone
address.street
address.zipCode
address.city
addressBilling.title
addressBilling.firstName
addressBilling.lastName
addressBilling.company
addressBilling.department
addressBilling.phone
addressBilling.street
addressBilling.zipCode
addressBilling.city
products []
name
productNumber
price
quantity
variants []
group
option
customFields []
(name)
(value)
discounts []
name
quantity
type
value
Variablenerweiterung durch mpXgastronomy:
customFields.MrpixGastronomy.preOrder
customFields.MrpixGastronomy.isDelivery
customFields.MrpixGastronomy.estimatedTime
Beispielvorlagen
Standardmäßig werden bei der Registrierung in mpXcloudprint zwei Templates angelegt.
Das erste Template hat den Name “Standard”. Es kann bei der Verwendung mit dem Plugin Shopware 6 verwendet werden. Beispielsweise, wenn im Lager ein Bestellbon ausgegeben werden soll.
Das zweite Template “Gastronomy” ist in Kombination mit dem Plugin mpXgastronomy geeignet. Hier sind zusätzliche Informationen angegeben. Deshalb eignet sich der Einsatz in der Gastronomie. Weitere Informationen finden Sie auf unserer Internetseite zum Gastropaket.
Vorlage: Standard
[align: centre][font: a]\
[magnify: width 2; height 1]mr. pixel KG[magnify]
[align: middle]\
{{customer.firstName}} {{customer.lastName}}
{{customer.email}}
{{order.orderDateTime}}
[magnify: width 2; height 2]Bestellung #{{order.orderNumber}}[magnify]
[align: left]\
{{#products}}
[column: left {{quantity}} {{{name}}}; right {{price}} €]
{{#variants}}
[column: left \ \- {{option}}]
{{/variants}}
{{/products}}
[align]\
Vielen Dank für die Verwendung
von mpXcloudprint
[mag: w 1; h 2]Powered by [underline: on]www.mr-pixel.de[underline: off]
[cut: feed; partial]
Vorlage: Gastronomy
[align: centre][font: a]\
[magnify: width 2; height 2]Bestellung #{{order.orderNumber}}[magnify]
[align: middle]\
{{customer.firstName}} {{customer.lastName}}
{{address.street}}
{{address.zipCode}} {{address.city}}
{{customer.email}}
{{#customer.phone}}{{customer.phone}}{{/customer.phone}}
[font: name b]{{order.orderDateTime}}[font]
[align: left]\
{{#products}}
[column: left {{quantity}}x {{{name}}}; right {{price}} €]
{{#variants}}
[column: left \ \- {{option}}]
{{/variants}}
{{/products}}
[align: middle]\
{{#customFields.MrpixGastronomy.preOrder}}
Vorbestellung: {{customFields.MrpixGastronomy.preOrder}}
{{/customFields.MrpixGastronomy.preOrder}}
{{#customFields.MrpixGastronomy.isDelivery}}
[bold: on]Lieferservice[bold: off]
{{/customFields.MrpixGastronomy.isDelivery}}
{{^customFields.MrpixGastronomy.isDelivery}}
[bold: on]Selbstabholung[bold: off]
{{/customFields.MrpixGastronomy.isDelivery}}
{{payment.methodName}}
[font: name b]Erwartet: {{customFields.MrpixGastronomy.estimatedTime}}[font]
[mag: w 2; h 2]{{payment.methodName}} [underline: on]{{payment.amountTotal}} €[underline: off] {{#payment.isPaid}}Bezahlt{{/payment.isPaid}}{{^payment.isPaid}}Fällig{{/payment.isPaid}}
[cut: feed; partial]