The algorithm of standardized lookups is as follows:
-
Lookup Configuration is parsed. It can either be read from a CP or passed as a function parameter.
-
Table name (or names) are determined.
-
Table type is determined.
-
Once for a batch (by default 200 products), a DB lookup is performed.
-
Custom Filter is parsed to a Filter object.
-
SKU and secondary key (with optional transformation) are parsed into a batch Filter.
-
If using PSP DependencyMapping, corresponding filters are applied.
-
FieldNames are translated into attributesID.
-
Lookup is performed.
-
There is a check if the data lookup threw any exception. Any exceptions are propagated further for every product in the batch so that config issues are easier to debug.
-
-
Data is grouped per SKU and secondary key (if the lookup did not fail).
-
Data is saved into api.global.
-
-
Data for a current item is read.
-
If using PSP DependencyMapping, the best matching dependency level is selected.
-
Data is transformed to be under keys specified in selectedFields.
-
Data checks are performed, according to the checksConfig configuration.
-
Data lookup is registered for debugging (registering keeps the data for other products in the batch).
-
Data for SKU is read.