Key Features
- Generate QR codes for individual products.
- Maintain a link between products and their QR code records.
- Support scan tracking and analytics where configured.
- Configure how QR codes are displayed on product pages.
- Customize destination URLs where supported.
- Generate QR code images suitable for printing.
Package Structure
How It Works
- An administrator selects a product for QR code generation.
- The add-on generates a QR code using the configured product destination.
- The QR code record is associated with the product.
- The image can be downloaded or used in configured product displays.
- Scan metrics can be reviewed if scan tracking is enabled in the delivered implementation.
Components
- Models represent QR code records and product associations.
- Controllers expose QR code operations.
- Repositories and services manage QR code data and image generation.
- Migrations create the required database structures.
Configuration
Configure the following settings after the add-on has been discovered and enabled. Only apply settings supported by the supplied package version.- Set QR code dimensions and styling options if supported by the package.
- Configure the default product destination URL.
- Enable scan tracking and analytics if included in the delivered package.
- Choose the product page locations where QR codes should appear.
Installation (Pre-built Premium Add-on)
This add-on is delivered as a pre-built JavaScript package by SpurtCommerce. Install the supplied compiled files; you do not need to run a TypeScript build.Before you begin
- Confirm that the add-on package is intended for the SpurtCommerce version and edition installed in your project.
- Back up the application files and database before installing a new add-on or applying its migrations.
- Extract the supplied add-on archive. The package normally contains
index.js(which exports thespurtcommerceAddonmanifest), compiled folders such ascontrollers/,models/,repositories/,services/,migrations/, and may include an optional hook file andpackage.json. - Work from the SpurtCommerce project root - the directory containing the applicationβs
main.jsandpackage.json.
Step 1: Place the add-on in add-ons/
Create an add-ons/ directory in the project root if it does not already exist. Copy the supplied add-on folder into it. Use the folder name provided with the add-on package and retain the supplied internal file structure.
There are two supported layouts.
Layout A - compiled files directly inside the add-on folder
dist/ directory inside the add-on folder
package.json that points to the compiled entry file. For example:
add-ons/<addon-name>/index.js with this content:
dist/ directory as a package entry by itself. When retaining dist/, provide the root-level package.json or index.js entry point shown above.
Step 2: Add add-on-specific environment settings
Check the add-onβs configuration section and the README or handover notes included with the supplied package. If the add-on requires environment variables - for example, a Redis connection, socket port, payment gateway credentials, or an external service key - add the exact variables to the SpurtCommerce projectβs.env file.
Do not add placeholder values to production. Keep credentials private and do not commit real secrets to source control. If the add-on does not specify additional environment variables, no add-on-specific .env change is required.
Step 3: Install only additional dependencies required by the add-on
The SpurtCommerce application already provides its core dependencies, such as TypeORM,routing-controllers, and typedi. Install an additional third-party package only when it is explicitly listed as a requirement in the supplied add-on documentation or package manifest.
Run any required command from the project root:
Step 4: Start or restart SpurtCommerce
Start the application using the normal command for your project. For example:.env values. No manual edits to main.js or SpurtCommerce core loader files are required when the project has the supported add-on registry.
Step 5: Allow the core loaders to register the add-on
During startup, SpurtCommerce performs the add-on integration through its loader lifecycle:- Discovery (
addonRegistry): Scans theadd-ons/directory, loads the add-on entry file, and validates/caches itsspurtcommerceAddonmanifest. - Database and migrations (
typeormLoader): Registers the add-onβs TypeORM entities and migrations, runs the migrations, seeds the add-onβs plugin record where defined, and callsmanifest.initialize(dataSource)when provided. - Plugin registration (
pluginLoader): Registers the add-onβspluginNamein the applicationβs plugin module. - API routes (
expressLoader): Mounts the add-onβs store, vendor, and admin controllers under the/api/*route space. - Hooks (
HookUtil): Registers the event hooks included with the add-on so relevant core events can invoke them.
Step 6: Verify add-on discovery and activation
After startup, check the application console for a discovery message similar to:plugin_status is 1. If the add-on is disabled, enable it through the Admin application where supported, or follow your platformβs plugin administration procedure.
Finally, test the add-onβs documented API routes and its corresponding Admin, Vendor, or Store workflow. Test in a development or staging environment before enabling the add-on for production users.
Installation troubleshooting
Version and delivery note: Premium add-ons are supplied as compiled packages for a compatible SpurtCommerce release. Use the package delivered for your project version. Do not substitute source-build instructions, rename internal files, or mix compiled packages from different releases unless SpurtCommerce confirms compatibility.
Operational Notes
Test the QR destination using a mobile device and ensure it resolves to the correct public product page. Confirm image dimensions and print readability before producing labels or packaging.Summary
The Product QR Code add-on extends SpurtCommerce with the capabilities described above. It is delivered as a compiled premium package and is loaded by the SpurtCommerce add-on registry when installed according to the steps above.API Endpoints
The endpoint definitions below are derived from the supplied controller files. All routes are mounted under the SpurtCommerce/api prefix. Each entry describes the operation and lists the path, query, body, or file inputs identified by the controller annotations.
Controller routes documented: 14.
Admin API
ProductQRcodeController
POST /api/qrCode/created-qrcode
Definition: Generates product QR code records from the submitted product IDs, product slugs, and Base64-encoded QR code images.
Inputs
Request model:
ProductQRcodeRequest is used by the controller for payload validation.
Authorization: The route uses the application authorization guard.
POST /api/qrCode/delete-qr
Definition: Deletes the QR code record associated with the supplied product ID.
Inputs
Authorization: The route uses the application authorization guard.
GET /api/qrCode/download-qrimage/:productId
Definition: Downloads product QR.
Inputs
Authorization: The route uses the application authorization guard.
GET /api/qrCode/qr-list
Definition: Returns the generated product QR code list, with the controller-supported search and pagination inputs.
Inputs
Authorization: The route uses the application authorization guard.
GET /api/qrCode/product-details/:id
Definition: Returns product details for the supplied product ID.
Inputs
Authorization: The controller applies the
access context.
DELETE /api/qrCode/delete-product/:id
Definition: Deletes the selected product using its product ID.
Inputs
Authorization: The route uses the application authorization guard.
GET /api/qrCode/product-list
Definition: Returns the product list available to the current Admin or Vendor context.
Inputs
Authorization: The route uses the application authorization guard.
Vendor API
ProductQRcodeController
POST /api/vendor-qrcode/created-qrcode
Definition: Generates product QR code records from the submitted product IDs, product slugs, and Base64-encoded QR code images.
Inputs
Request model:
ProductQRcodeRequest is used by the controller for payload validation.
Authorization: The controller applies the vendor access context and the following permission scope: generate-qr.
POST /api/vendor-qrcode/delete-qr
Definition: Deletes the QR code record associated with the supplied product ID.
Inputs
Authorization: The controller applies the
vendor access context.
GET /api/vendor-qrcode/download-qrimage/:productId
Definition: Downloads product QR.
Inputs
Authorization: The controller applies the
vendor access context and the following permission scope: list-product-qr.
GET /api/vendor-qrcode/qr-list
Definition: Returns the generated product QR code list, with the controller-supported search and pagination inputs.
Inputs
Authorization: The controller applies the
vendor access context and the following permission scope: list-product-qr.
GET /api/vendor-qrcode/product-details/:id
Definition: Returns product details for the supplied product ID.
Inputs
Authorization: The controller applies the
vendor access context and the following permission scope: list-product-qr.
DELETE /api/vendor-qrcode/delete-product/:id
Definition: Deletes the selected product using its product ID.
Inputs
Authorization: The controller applies the
vendor access context and the following permission scope: list-product-qr.
GET /api/vendor-qrcode/product-list
Definition: Returns the product list available to the current Admin or Vendor context.
Inputs
Authorization: The controller applies the
vendor access context and the following permission scope: list-product-qr.