Spryker
The Spryker Field Plugin allows users to select products and categories from Spryker within Storyblok. This can be used to create carousels of featured products, lists of products from a hand-picked category, as just two examples.
Functionality
Storyblok users can search the Spryker product catalog and pick products from a grid:
And they can pick categories from a list:
The selected items can be re-arranged:
Prerequisites
To use this field plugin, you will need
- A space on Storyblok's Enterprise plan.
- A Spryker instance.
How to set up
Storyblok's support team will install the field plugin to your space upon request. Once the Spryker Field Plugin is installed on your space, developers can add the Spryker Field Plugin to any block.
There is one required field-type option:
endpoint
— This mandatory option should contain the full URL to your Spryker Glue API. For example https://glue.de.b2c.demo-spryker.com
There are three optional field-type options:
token
— When specified, this value will be added to the Authorization header of each request to Spryker.limit
— Provide a number to this option to limit the number of items the users can select.selectOnly
— Provide the value product to disable the category tab, so that the users only can select products. Provide the value category to disable the product catalog tab, so that users only can select categories.
How to use
After selecting products and categories, a JSON object will be added to the content. This object has the following structure:
{ "plugin": "sb-spryker", "items": [ { "type": "product", "id": "073" }, { "type": "category", "id": "5", } ] }
When consuming this content, you will have access to the type
, sku
and the id
fields in the items
array. To display other fields – such as titles, images, and descriptions – make additional requests to the Spryker API with the sku
or id
in the request parameters.
Although you may detect that there are other fields included in the content, these are only meant to be used by the field plugin itself. For example:
{ "plugin": "sb-spryker", "items": [ { "type": "product" "id": "073", "name": "Samsung Galaxy Note 3", "sku": "073", "image": "https://d2s0ynfc62ej12.cloudfront.net/b2c/21927455-7956.jpg" } ] }
These are not synchronized with the source data in Spryker and may thus expire. Do not use them in your applications – but make a separate request based on the type
, sku
and the id
fields.