Mapping
Omnitron provides an easy-to-use mapping interface enabling you to associate the products integrated from ERP or other external resources and approved on Integrations > Pending Products page with Omnitron.
Mapping process is needed only if you prefer to use the pending product stage before the productization process. You might skip this stage if you prefer to handle the mapping process on the integration layer and directly send your products to the Product Pool.
Mapping Model Structure
Mapping is a matching process between values coming from ERP and external sources.
The mapping model consists of the following strategies:
AttributeValueMappingStrategy
: This strategy leads to map attribute values
The strategy used to match attribute values. Pulls custom is_localizable
and language parameters from kwargs. According to these parameters, it is decided whether the attribute will be pulled according to the language. Then, the default_value
is drawn from the output_kwargs
in the mapping model and the value is retrieved according to the mapping_key
in the mapping model. If value does not exist and the default_attribute is present, it pulls the attribute directly from the product object and maps it to value. After that, it returns (value, True) if pulled from the default_attribute. If pulled directly from mapping (value, False).
AttributeSetMappingStrategy
: This strategy leads to map [Attribute Set],
There are no language operations as in AttributeValueMappingStrategy, but the rest of the value pulling process is the same. When returning, the value is returned directly.
Path: omnitron.mappings.models.Mapping
Mapping_Type (EnumField): Indicates the mapping type. Its values are;
attribute
='attribute'attribute_set
='attribute set'attribute_value
='attribute value'
input_kwargs (JSONField): Represents the attributes' rules
output_kwargs (JSONField): Represents default values
priority (integer): Indicates the mapping priority
mapping_key: The name of the attribute to be associated with
MappingViewSet
MappingViewSet {omnitron.mappings.resources.views.MappingViewSet}
is located at the address of /api/v1/mappings/
.
Allows GET, POST, PUT, PATCH and DELETE methods inherited from ModelViewSet. perform_create(), perform_update() and perform_destroy() functions are overridden; perform create/update operations on the relevant MappingService.
And one property named strategy is defined. This property returns the two strategies mentioned above in class format upon fetching from mapping_type.
Parameter
Data Type
Default
In
Required
Description
api_token
string
header
YES
product_sku
string
body
YES
Product SKU
stock_list
id
body
YES
Stock list which includes the product
stock
integer
0
body
NO
Amount of stock
unit_type
enum(string)
qty
body
NO
Stocked quantity type qty: Quantity kg: Kilogram
GET
Mapping
GET
MappingGet request to get list of mapping objects.
Path: /api/v1/mappings/
POST
Create Mapping
POST
Create MappingAdds a new record to the mapping table.Validated with MappingSerializer. Returns HTTP400 if data is not available. Returns HTTP406 if there is an error or incompatibility at the service layer during the recording process.
Path: /api/v1/mappings/
Body
Response
Errors
PATCH
Partial Update
PATCH
Partial UpdatePath: /api/v1/mappings/{pk}/
Partially updates the object of the relevant primary key from the attribute table. Validated with AttributeSerializer. Returns HTTP400 if data is not available. If it cannot find the object, it returns HTTP404. With partial update behavior, it only updates the sent parameters.
Body
Response
PUT
Partial Update
PUT
Partial UpdatePath: /api/v1/mappings/{pk}/
Updates the object of the corresponding primary key from the mapping table. Validated with MappingSerializer. Returns HTTP400 if data is not available. If it cannot find the object, it returns HTTP404. Updates the entire object with the update behavior.
Body
Response
Errors
Last updated
Was this helpful?