- additional product information, images and technical parameters
- shipment tracking in the customer account
- a complete main menu including submenus
- top-seller structures and cross-links for categories or products
- postcode lists with shipping times and Europe-wide public holidays for delivery time calculation
- third-party reviews
- content from a content management system
Where the data comes from
Activation and FTP access
Have the JSON interface activated for your shop. You will receive a dedicated FTP access with server, user name and password.If you only want to work with internal data, i.e. with responses from external systems, you need neither activation nor a dedicated FTP access.
The folder structure
The root directory contains the files that apply to all shops and subshops. If a subshop is to get its own files, create a directory named with the subshop ID and place the files there.The file name must be the same in all subshop directories. Which file is loaded depends on the subshop the visitor is currently in.
File requirements
The two tag families
The tags work on all templates. No adjustment of the
shop.config is required.
Loading data
Data is loaded withEJD-LoadData(). The tag takes three values: the type, the path and an identifier.
Checking whether the data has arrived
Used as a single tag, the negative tag outputs the error code. This lets you distinguish whether the file is missing or does not contain valid JSON.
Accessing values
A value is addressed via its access path. This is made up of the names of the levels, joined by dots. Array elements get their index in square brackets, counted from zero. The top-level element is represented by an empty path or_root_.
The following examples use this file:
In the template:
The file name itself can come from a tag. In the example, the file with the product number in its name is loaded for each product.
Setting the identifier once
If only one file is used on the template,EJD-SetUseID() saves you from repeating the identifier in every tag.
Reusing values in other tags
TheEJD-DA- tags carry their values in brackets and therefore cannot simply be nested inside other tags. However, the shop remembers every value and every name that such a tag touches. Via EJD-LastValueAccessed and EJD-LastNameAccessed you can get at whatever was touched last, and this can be reused like any other value.
The access path can also be assembled in a free placeholder if the index comes from a loop:
Setting decimal places
Checking elements
The type of a value can be queried. The value is remembered at the same time.EJD-DA-IsTrue(), EJD-DA-IsFalse(), EJD-DA-IsNull(), EJD-DA-IsNumber(), EJD-DA-IsReal(), EJD-DA-IsString(), EJD-DA-IsObject() and EJD-DA-IsArray().
Whether a name exists at all is answered by a dedicated tag. It remembers the name in the process.
The output is
Crosslinks, i.e. the last part of the path, not the whole path.Iterating over elements
If you do not know the names of the elements in advance,EJD-ElementIterator() iterates over them. As a loop, the tag repeats the code; as a single tag, it outputs the name of the current element.
If an element is missing, the position stays empty, without an error. Where this is a problem, check beforehand with
EJD-DA-NameExists().Generating your own JSON data
The shop can also build JSON data itself or modify loaded data and then output it. Three rules apply:- If the element already exists under the specified path, it is overwritten.
- If it does not exist yet, it is created.
- Exactly one element can be edited per call.
Simple values
Arrays
An empty array is created and then extended position by position. Whether you alternate between extending and filling, or first create all positions and then fill them, is up to you._root_.
Nested data
Each level is first created as an empty object and then filled.Checking whether the modification succeeded
Processing data from external systems
Responses from payment providers, shipping service providers or the shop system itself are not available as files. They arrive at the moment of the call and are therefore called internal.With files, you know what they contain because you uploaded them yourself. With internal data, this is often not the case.
EJD-RawDataOutput() therefore outputs everything that has arrived. This is the fastest way to find out what you are dealing with.Step 1: Passing the data to the interface
EJD-SetRawDataHexCodedInput() instead.
Step 2: Loading and assigning an identifier
Some internal data comes directly from the shop system and does not need step 1. The hreflang information, for example, can be loaded directly:
Related topics
- Use cases: JSON interface
- Guide: Embedding external content
- Guide: Exchanging data with external systems
- Guide: DHL shipment tracking
