Every time one of your customers uses your configurator or you try out a draft of it, a configuration is created. This configuration is used to automatically save the user's progress, it can be copied or edited at a later time, shared on social networks or put in a shopping cart.
You can interact with the currently active configuration via the configuration variable.
|id||the unique ID of this configuration|
|authToken||the authorization token for this configuration|
|isFinished||will be false for new configurations and true for configurations that have already been finished|
|editUrl||a URL with which this configuration can be edited|
|copyUrl||a URL that will create a copy of this configuration|
|getParameter(name)||returns the calue of a URL parameter|
The Authorization Token (AuthToken)
Every configuration is protected with an authorization token. Only those that can provide this secret text are allowed to edit the configuration.
The AuthToken is part of the EditUrl of a configuration.
If you want to enable your users to continue a configuration at a later time or after they have put it into a shopping cart, we recommend you use the EditUrl of the configuration.
It should be pretty rare that you have to directly work with the AuthToken yourself.
Once a configuration has been put into a shopping cart or, more generally speaking, has been completed (or "finished"), you may want it to behave slightly differently when edited again. For example, you may want to change the text of a button from "order now!" to "save changes" when a customer opens a configuration from his shopping cart.
You can use the configuration.IsFinished property to this end, as it will return true when the current configuration has already been completed at some point in the past.
When you embed your configurator in your website, you can add URL parameters to the embed URL. These parameters can then be used to alter how the configurator looks or works. For example, you could pass the SKU of a product, the current language of the website or shop-system specific information to your configurator.
In your configurator, you can obtain the value of an URL parameter with the getParameter function. This function will either return a text value or empty if the parameter has not been used:
// pass language by parameter, use "en" when parameter is not used configuration.getParameter("language") or "en" // pass ID of a shopping cart by parameter // be sure to provide a fallback value if the parameter is not used (e.g. "") // ToNumber() might also return Empty if the parameter is not a number (configuration.getParameter("cartId") or "").toNumber() or 1