Hi Alumio,
We used to sometimes build stuff with code (long since phased out), and we then had the option to use prototypes. As I understand it, a prototype was basically a ‘normal list-transformer’ (or another type of configuration), but it was able to set ‘input fields’ and use the data from those input fields in that transformer.
The UI still supports those input-fields for custom prototypes as far as I can tell, but it would be awesome if we could create those prototypes in the UI.
There’s a lot of use-cases we would have for them:
- We’ve got some clients using ERPs using Eurostat country codes in some cases (i.e. for Greek it’s EL in Eurostat and GR in ISO) and that always requires the same transformation. It’d be great if we could just 'add in a prototype’ that says ‘Change Country Code to Eurostat’ or something
- Maybe default calculator to do stuff like adding VAT to all lines or removing them?
- Prototypes which transform one type of structure (i.e. Alumio’s ‘values’ structure) to another type of structure (i.e. ‘Magento’s storeview → custom_attributes structure’)
This would honestly be a huge efficiency boost for us, since we have many ‘default strategies’ that would be easy to implement like this.
An example of one of the last prototypes we used:
{
"$schema": "https://di.schema.mediact.com/register.prototype.json",
"type": "list-transformer",
"identifier": "magento2-onix-product-attribute-lookup",
"name": "magento2 onix lookup product option values",
"description": "get the product form from the onix3 data",
"object": {
"class": "Experius\\Onix3Connector\\Transformer\\Onix3MagentoProductAttributeLookupTransformer",
"arguments": {
"client": {
"parameters": {
"plugins": [
{
"prototype": "base-uri",
"parameters": {
"uri": {
"prototype": "Psr\\Http\\Message\\UriInterface",
"parameters": "%{base_uri}"
}
}
},
{
"prototype": "header-set",
"parameters": {
"headers": {
"Content-Type": "application/json"
}
}
},
{
"prototype": "logger",
"parameters": {
"formatter": "long"
}
}
],
"authentications": [
{
"prototype": "bearer",
"parameters": {
"token": "%{auth_token}"
}
}
]
}
},
"storage": {
"prototype": "magento-product-attribute-storage-onix"
},
"fields": "%{selected_fields}"
}
},
"schema": {
"properties": {
"base_uri": {
"type": "string",
"title": "Magento Base URI",
"default": "${MAGENTO2-BASEURL}"
},
"auth_token": {
"type": "string",
"title": "Magento Bearer Token",
"default": "${MAGENTO2-BEARERTOKEN}"
},
"selected_fields": {
"title": "Select fields to process",
"type": "array",
"items": {
"type": [
"string"
]
},
"default": [
"onix_book_productform",
"onix_book_availability",
"onix_book_publisher_name",
"onix_book_language_code",
"centraalboekhuis_is_ebook",
"onix_book_avi_code",
"onix_book_imprint_commercieel"
]
}
}
}
}