Prints a barcode or QR code as a scannable image.

Kuvaus

With this tag, you can print product barcodes in a graphical (barcode reader-readable) format on the online store pages and order documents. Additionally, you can use the tag to create, for example, scannable QR codes on any online store page or other URL address.

Syntaksi

{Barcode(
    type: string,
    value: string
)}

Näkyvyys

Toimii näkyvyydessä: globaali

It is possible to use global visibility tags in any page template and within any tag.

Printing the product barcode

The examples below demonstrate printing the barcode saved for a product using the {ProductArticleNumber} tag and the {BarCode} tag.

Here's how to print the product's EAN code, for example, on the template of product labels:

{BarCode(
    before: '<img src="',
    type: 'ean',
    value: '{ProductArticleNumber}'
    after: '"/>'
)}

With the following example, you can print a specific product's EAN code in any theme template:

{BarCode(
    before: '<img src="',
    type: 'ean',
    value: {{
        {Helper( product: 5, file: {{ {ProductArticleNumber} }} )}
    }}
    after: '"/>'
)}

Printing a website URL as a QR code

Here's how you can print a scannable QR code using a tag that directs to your desired URL:

{BarCode(
    before: '<img src="',
    type: 'qr',
    value: 'https://www.example.com'
    after: '"/>'
)}

Here's how to print the corresponding QR code for an internal page of an online store using the {LinkURL} tag:

{BarCode(
    before: '<img src="',
    type: 'qr',
    value: '{LinkURL(id: 5, type: 'infopage')}'
    after: '"/>'
)}

Attribuutit

type:

Determines the type of barcode to be printed.

Sallitut arvot:
  • code128
  • ean (the barcode specified in the value attribute determines whether the tag prints an EAN13 or EAN8 code)
  • qr
value:

Barcode, which the tag prints in the format specified by the type attribute. You can print the barcode saved in the product's inventory management settings using the {ProductArticleNumber} tag.

Sallitut arvot: viivakoodi merkkijonona (esim. 5711045411359)
before: / after:

With these two attributes, you can define content that is output before or after the content produced by the tag.

Allowed values:text that may contain HTML and Interface markup.

E.g.

  • before: '<p>This markup appears before the tag's own content.</p>'.
  • after: '<p>This appears after the tag's own content.</p>'

If the tag does not produce any content, the content of the before and after attributes will also not be displayed.

escape:

Adds escape characters to the content printed by the tag, making it easier to use the content in JavaScript code or JSON objects.

Sallitut arvot:
  • true: the attribute adds escape characters before quotation marks
  • false: the attribute does nothing
  • json: the attribute adds escape characters to the output, allowing the content to be used in JSON markup.
or:

Defines alternative content that is displayed if the tag itself does not produce any content.

Allowed values:text that may contain HTML and Interface markup.

E.g. or:'Content not found.'