Modules
The following modules are relevant for the integration of Scan & Order:- $wsViews - current URL, destination pages, view URLs
Frontend integration
Dependencies
The scanner is based on the open-source library html5-qrcode. The filehtml5-qrcode.min.js is stored in the scripts/ directory and is only included via lazy load when the scanner is opened.
QR button in the search field
The button is placed directly in front of the search field within thews-search-box component and opens the scanner. Depending on the end device, it appears in the following locations:
- in the desktop search bar of the header

- in the mobile offcanvas navigation menu

The integration into the header is done via the file
components/layout/header.htm:
The button must be placed identically both in the desktop header and in the mobile offcanvas menu. Using the attribute
aria-label=%QRCodeBtnTitle%, the shop text snippets are used for accessibility.Modal window
The full-screen modal is inserted once in the base layout. The area#wsQRScanner is responsible for displaying the camera preview from HTML5-QR-Code.
The integration is done via the file layouts/default.htm:
JavaScript constant
The path to the library is set as a JavaScript variable in the{{ autoescape "js" }} block of the layout file layouts/default.htm.
Scanner logic
The following code block is to be inserted into the filescripts/wsGlobal.js. The flow is as follows:
- When the scanner is opened for the first time,
html5-qrcode.min.jsis loaded. - If the library was already loaded, the scanner is started directly via
wsInitQRScan(). html5-qrcodestarts the camera and shows the preview in the#wsQRScannerarea.- After a successful scan, URL codes redirect directly to the scanned URL — barcodes place the product with the scanned ID directly into the basket.
- When the window is closed, the camera is stopped.
Further links
- html5-qrcode on GitHub - Documentation and configuration options of the scanner library
