Variable: BasicActionElementDataAttributesNames
ts
const BasicActionElementDataAttributesNames: object;Data attributes of the HTML elements that open the editor when clicked, and of logo visualization images.
Type declaration
| Name | Type | Default value | Description |
|---|---|---|---|
action | "data-td-action" | 'data-td-action' | Required for elements configured with individual attributes (not needed with data-td-options). Specifies what the element does. Allows the following values: - "OpenCreate": opens the editor to create a new print job (open mode Create) - "OpenEdit": opens the print job from data-td-print-job-guid for editing (open mode Edit) - "OpenView": opens the print job from data-td-print-job-guid read-only (open mode View) - "RenderVisualization": on an <img>, replaces its src with a rendered visualization of the customer's logo on the product. Uses the supplier, data-td-product-code, print position and print technology attributes of the image (at least a supplier and a product code are required), and needs logo visualizations enabled for your account. |
advancedOptions | "data-td-options" | 'data-td-options' | Advanced options: a JSON serialized EditorArguments object that fully describes how to open the editor. When present, all other attributes of the element (including data-td-action) are ignored. If the JSON can't be parsed, the error is logged to the console and the editor doesn't open. |
customProperties | "data-td-custom-properties" | 'data-td-custom-properties' | Custom properties of the print job, as a JSON object with string values. For example: {"customProperty1": "value1", "customProperty2": "value2"}. Invalid JSON is ignored without an error. See IEditorArgumentsBuilder.addCustomProperties. |
modelCode | "data-td-model-code" | 'data-td-model-code' | Model code of a catalog product, e.g. 100860; the customer chooses the variants in the editor (data mode Partial). Print position and technology are optional then. Ignored when data-td-product-code or data-td-product-codes is set. |
orderCode | "data-td-order-code" | 'data-td-order-code' | Your order number; saved as customer.orderCode. See IEditorArgumentsBuilder.setOrderInfo. |
orderItemCode | "data-td-order-item-code" | 'data-td-order-item-code' | Your order line / cart item number. See IEditorArgumentsBuilder.setOrderInfo. |
orderTitle | "data-td-order-title" | 'data-td-order-title' | Title of the order the print job belongs to; saved as customer.orderTitle. See IEditorArgumentsBuilder.setOrderInfo. |
ownProduct | "data-td-own-product" | 'data-td-own-product' | Indicates that the product is an own product, not from the catalog (data mode Own). When set to "true" (case-insensitive), the editor prompts the user to enter the product data, such as product name, model code and variant details. Any other value is treated as false. Together with data-td-action this is a complete opener: the click opens the editor in Own mode, like setOwnEmptyProduct. Own product wins over the other product attributes: supplier, product and printing attributes on the same element are ignored, with a warning in the console. To send your own product data, use data-td-options or the builder. |
positionCode | "data-td-print-position-code" | 'data-td-print-position-code' | Code of the print position, e.g. front. Used together with data-td-print-technology-code. |
positionCodeOverride | "data-td-print-position-code-override" | 'data-td-print-position-code-override' | Print position code to show instead of the catalog one, for data-td-print-position-code. |
positionCodeOverrides | "data-td-print-position-code-overrides" | 'data-td-print-position-code-overrides' | Print position codes to show instead of the catalog ones, as a JSON array in the same order as data-td-print-position-codes. For example: ["F", "B"]. |
positionCodes | "data-td-print-position-codes" | 'data-td-print-position-codes' | Codes of several print positions, as a JSON array. For example: ["front", "back"]. Each position is combined with the technology at the same index in data-td-print-technology-codes into one printing. Takes precedence over data-td-print-position-code. |
positionNameOverride | "data-td-print-position-name-override" | 'data-td-print-position-name-override' | Print position name to show instead of the catalog one, for data-td-print-position-code. |
positionNameOverrides | "data-td-print-position-name-overrides" | 'data-td-print-position-name-overrides' | Print position names to show instead of the catalog ones, as a JSON array in the same order as data-td-print-position-codes. For example: ["Custom Position Name 1", "Custom Position Name 2"]. |
printJob | "data-td-print-job-guid" | 'data-td-print-job-guid' | GUID of an existing print job to open. Use it with data-td-action="OpenEdit" or "OpenView". |
productCode | "data-td-product-code" | 'data-td-product-code' | Supplier code of the product variant, e.g. 10086021 (data mode Exact). For several variants, use data-td-product-codes instead. For RenderVisualization, the variant to visualize. |
productCodeOverride | "data-td-product-code-override" | 'data-td-product-code-override' | Variant code to show instead of the catalog one, for the variant in data-td-product-code. |
productCodeOverrides | "data-td-product-code-overrides" | 'data-td-product-code-overrides' | Variant codes to show instead of the catalog ones, as a JSON array in the same order as data-td-product-codes. For example: ["custom-code-1", "custom-code-2"]. |
productCodes | "data-td-product-codes" | 'data-td-product-codes' | Supplier codes of several product variants, as a JSON array. For example: ["10086021", "10086055"]. Takes precedence over data-td-product-code. |
productNameOverride | "data-td-product-name-override" | 'data-td-product-name-override' | Variant name to show instead of the catalog one, for the variant in data-td-product-code. |
productNameOverrides | "data-td-product-name-overrides" | 'data-td-product-name-overrides' | Variant names to show instead of the catalog ones, as a JSON array in the same order as data-td-product-codes. For example: ["Custom Product Name 1", "Custom Product Name 2"]. |
resultAction | "data-td-result-action" | 'data-td-result-action' | Specifies what happens after the user confirms the final verification of the print job. If omitted, the result action configured in the Admin Portal (Settings → Print editor) applies. Allows the following values (case-sensitive; any other value makes the click fail with an error): - "None": the print job is saved and the editor stays open. - "Close": the print job is saved and the editor closes. - "Dialog": the print job is saved and a "print job saved" dialog with the default texts is shown; closing it closes the editor and navigates to data-td-result-redirect-url, if set. See IEditorArgumentsBuilder.setResultActionShowDialog and Result actions. |
resultRedirectUrl | "data-td-result-redirect-url" | 'data-td-result-redirect-url' | URL to navigate to after the print job is saved: with data-td-result-action="Dialog" when the user closes the "print job saved" dialog, with "Close" when the editor closes after the final confirmation. Ignored without data-td-result-action. |
supplierCode | "data-td-supplier-code" | 'data-td-supplier-code' | Code identifying the supplier of the product, e.g. PFC. Use either this or data-td-supplier-guid to identify the supplier. |
supplierGuid | "data-td-supplier-guid" | 'data-td-supplier-guid' | GUID identifying the supplier of the product. Use either this or data-td-supplier-code to identify the supplier. |
technologyCode | "data-td-print-technology-code" | 'data-td-print-technology-code' | Code of the print technology, e.g. PAD03. Used together with data-td-print-position-code. |
technologyCodeOverride | "data-td-print-technology-code-override" | 'data-td-print-technology-code-override' | Print technology code to show instead of the catalog one, for data-td-print-technology-code. |
technologyCodeOverrides | "data-td-print-technology-code-overrides" | 'data-td-print-technology-code-overrides' | Print technology codes to show instead of the catalog ones, as a JSON array in the same order as data-td-print-position-codes. For example: ["T1", "T2"]. |
technologyCodes | "data-td-print-technology-codes" | 'data-td-print-technology-codes' | Codes of several print technologies, as a JSON array in the same order as data-td-print-position-codes. For example: ["PAD03", "PAD03"]. Used only together with data-td-print-position-codes. |
technologyNameOverride | "data-td-print-technology-name-override" | 'data-td-print-technology-name-override' | Print technology name to show instead of the catalog one, for data-td-print-technology-code. |
technologyNameOverrides | "data-td-print-technology-name-overrides" | 'data-td-print-technology-name-overrides' | Print technology names to show instead of the catalog ones, as a JSON array in the same order as data-td-print-position-codes. For example: ["Custom Technology Name 1", "Custom Technology Name 2"]. |
visualizationLogo | "data-td-visualization-logo" | 'data-td-visualization-logo' | Overrides the customer's currently selected logo for this specific image. Only applies when data-td-action is set to "RenderVisualization". Value must be a logo GUID (UUID string). When absent, the customer's selected logo is used. |
visualizationSize | "data-td-visualization-size" | 'data-td-visualization-size' | Controls the output size of the rendered visualization image. Only applies when data-td-action is set to "RenderVisualization". Allows the following values: - "auto" (default): uses the natural size (intrinsic pixel dimensions) of the original image in src, not the size at which the <img> is displayed - "full", "max300", "max400", "max600", "max800", "max1000" Any other value is treated as "auto". |
Remarks
When it initializes, the script registers every element with data-td-action="OpenCreate", "OpenEdit" or "OpenView", or with data-td-options. Elements added later need refreshRegisteredElements, subscribeElementChanges or data-td-monitored-element-id. An element is registered only if it has one of these attribute combinations:
data-td-action+data-td-print-job-guid(open an existing print job),data-td-action+ supplier (data-td-supplier-codeor-guid) +data-td-model-code(data modePartial),data-td-action+ supplier + product (data-td-product-codeor-codes) + print position (data-td-print-position-codeor-codes) + print technology (data-td-print-technology-codeor-codes) (data modeExact),data-td-optionswith a complete EditorArguments JSON (all other attributes are then ignored).
The attribute values are read when the element is clicked, and the editor always opens in a dialog. JSON array attributes (…-codes, …-overrides) must be valid JSON, otherwise clicking the element throws an error.
Example
html
<button
data-td-action="OpenCreate"
data-td-supplier-code="PFC"
data-td-product-code="10086021"
data-td-print-position-code="front"
data-td-print-technology-code="PAD03"
data-td-custom-properties='{"cartId": "c-42"}'
data-td-result-action="Dialog"
data-td-result-redirect-url="https://shop.example.com/cart"
>Design your print</button>