How commercetools Ensures Accurate Data Representation

Written by Jeethu Augustine

Technical Content Writer

Data Modeling is the process of creating a data model - of the whole or part of the information system - to be stored in a database. It is used to communicate connections between data points and structure, and it also explains the various types of data stored and used in the system, the connections between the different data types and how it can be grouped and organized.

Data Model is an abstract model that is built around business needs. It organizes data description and semantics and stresses on what data is needed and how to organize it, incorporating the business requirements. Collecting the rules and requirements from the business stakeholders and end-users is the initial process of data modeling, based on which a database design is formulated.

What are the types of data models?

Based on their degree of abstraction, three different types of data models are conceptual, logical, and physical.

Conceptual data models - Also known as domain models, conceptual data models give a detailed view of what the system will contain, how it will be organized, and the business rules involved. Created during the process of gathering initial project requirements, it includes entity classes, their characteristics and constraints, the relationships between them and relevant security and data integrity requirements.

Logical data models - The purpose of the Logical data model is to develop a technical map of rules and data structures. They are not as abstract as the conceptual data models and provide information about concepts and relationships in detail. Therefore, logical data models can be used in implementation environments that are highly procedural.

Physical data models - Of the three data models, Physical data models are the least abstract. They describe a database-specific implementation of the data model, provide a schema for how the data will be physically stored within a database and offer a finalized design, which can be implemented as a relational database. Physical data models include database management systems, specific properties such as performance tuning.

What does data model help achieve?

  • Makes sure that the data objects are accurately represented, avoiding any faulty reports and incorrect results

  • Provides a clear picture of the base data that will be helpful for database developers to create a physical database

  • Helps to upgrade and maintain IT infrastructure in a fast and cost-effective manner

  • Detects missing and redundant data

Advantages of data model

  • Ensures that data objects offered by the functional team are represented accurately

  • Helps to define the relationship between tables, primary and foreign keys, and stored procedures

  • Facilitates business communication within and across organizations

  • Recognizes correct sources of data to populate the model

  • Documents data mappings in ETL process

What are the elements of data modeling in commercetools?

Product Type

Specific characteristics of a Product which is like a template from where Products are created. Product Types consist of Product Attributes that would define characteristics of a set of Products.

  • Any new Product created in commercetools must have a Product Type
  • Once selected, a Product Type cannot be changed
  • All Products using the Product Type should be deleted first, only after which can it be deleted
  • Product Types are generally restrictive: if you need flexibility, consider using a Category

Product Attributes

A specific characteristic that is particular for a Product, which is mostly a piece of information about the Product.

Categories and classifications for grouping and organizing should be first taken into consideration while modeling Product Attributes.

  • Bag - Men
  • Bag - Women
  • Dress - Infants
  • Shoes – Kids

As it is tricky to remove Product Attributes, over-engineering your Product Types with too many Product Attributes should be best avoided.

Product

A sellable Product with a set of Product Attributes that is defined by a Product Type. A Product by itself is not sellable, but it is the parent structure of Product Variants. Each Product should require at least one Product Variant, which is called the Master Variant.

In commercetools, a Product can be material or immaterial. A few examples of Products are:

  • Guitar

  • A crib

  • An insurance

  • A car rental scheme

  • A book

Product information is stored as Product Attributes – properties of a Product - and Product Variants - sellable variations of a Product. It is important to decide what is to be modeled as Product Attributes and as Product Variants. The sellable goods are mostly similar except for a few Product Attributes. These Product Attributes can be grouped in a single parent Product.

Product Variant

A sellable Product that is mapped to specific SKUs; inventory is modeled per variant.

In some instances, where Products have different capacities, they represent a unit of similar sellable Products that are identical except for a couple of Product Attributes. They are not usable as sorting or ordering selectors and so, not modeled as categories but as filters for search results.

For example, a home decor store has a product, "Bed Cover" which has the following variants:

  • Red Bed Cover Queen size

  • White Bed Cover Single

  • Green Bed Cover King size

The decision to import your Product data into commercetools must be taken after considering the fact that Product Variant can lead to issues with data size. That is, for example, to model a Product Variant for each size of shirt and each color available will result in a large data set. In order to get a rough idea about the number of Product Variants, multiply the variable attributes with each other.

Category

A set of products. Categories are created to group Product characteristics, marketing concerns, or search concerns. Modeling Product Category is the first step to product modeling. Apart from organizing the navigation structure in storefront, Product Categories are used for storing information about the Product, creating seasonal sales and promotions, and grouping products.

Many aspects of a site’s navigation are driven by the Category tree. So, what is a category tree?

A Category tree represents the Categories and subcategories. It is always recommended to keep the Category tree simple as would greatly influence your customer experience.

Creating Simple and Advanced Product Type

It should always be the simple Product Type that has to be created first, which should then be nested into the advanced Product Type. It is necessary that the typeID of the Product Type has to be nested first; if not, we will not be able to correctly set up the reference relationship between the advanced and nested Product Type. Once the Product Type that needs to be nested is created, the advanced Product Type can be created by referencing the previously created Product Type in a nested attribute.

Customization in commercetools

If the fields present in a commercetools resource fail to meet your business needs, there is an option to extend the customer resource representation.

For example, an ecommerce store selling clothes can provide its users personalized service by storing the dress size. And they can do this by storing the dress size as a part of the customer data. For this, the standard customer object with a CustomType containing a Custom Field should be extended.

And, if we need to use the Custom Field on an existing customer, API would provide updated actions on the existing customer resources.

Conclusion

There could arise multiple complications while modeling simple data, and for this, what is necessary is deep expertise in the solution. Royal Cyber is a premium solution partner of commercetools and has certified Architects and Developers who have hands on experience. Contact us to know how you can leverage the solution to build a profitable ecommerce platform.

Leave a Reply