Model D - Customize the Product detail page

Learn how to set up a sample product data model to display the model-storage combinations of an electronic product.

  • After completing this page, you should be able to:

    • Configure the product data model for a product listing with all its model-storage combination sets.
  • This final product data model is a slight variation on Model C. The only difference is that we need the Product detail page to show all model-storage-color combinations for each iPhone model, but the Product listing page and search experience remain the same as in Model C.

    Our final product data model needs to meet the following requirements:

    • Product listing page: display the Product by model-storage combination sets.

    Model D product listing page.

    • Search result: display the Product by model-storage combination sets.

    Model D search results page.

    • Product detail page: display all model-storage-color combinations.

    Model D product detail page.

    Set up Product data model in Composable Commerce

    Here, we can use a similar attribute type as for Model C. The only new requirement is that we need to create the Product details page view. To meet this requirement, we can follow any one of the following methods:

    • Use an external Search engine.
    • Use a similar solution as Model C, and then link the products on the Product detail page.

    Let’s explore each method in detail.

    Use an external Search engine

    In the External Search vs. Product Search section, we discuss the ability to split a single Product into multiple entities when we index it in an external search engine. For example, Elasticsearch). We will use the same method here.

    Similar to Model A, we will maintain iPhone 16 as a single product with a single URL and a Product detail page to display all variants. However, we will implement the integration code to index this product into the external search engine by dividing it into 13 individual records, representing all model-storage combinations. Each record will share the same Product detail page URL. This ensures that the Product landing page and search results will have 13 product cards that can be individually managed and merchandised.

    The integration code should generate 13 separate records in the external search index, as shown here:

    #ModelProduct detail page URL
    1iPhone 16 Max 256 GB[Link to iPhone 16 Product detail page]
    2iPhone 16 Max 512 GB[Link to iPhone 16 Product detail page]
    3iPhone 16 Max 1 TB[Link to iPhone 16 Product detail page]
    4iPhone 16 Pro 128 GB[Link to iPhone 16 Product detail page]
    5iPhone 16 Pro 256 GB[Link to iPhone 16 Product detail page]
    6iPhone 16 Pro 512 GB[Link to iPhone 16 Product detail page]
    7iPhone 16 Pro 1 TB[Link to iPhone 16 Product detail page]
    8iPhone 16 Plus 256 GB[Link to iPhone 16 Product detail page]
    9iPhone 16 Plus 512 GB[Link to iPhone 16 Product detail page]
    10iPhone 16 Plus 128 GB[Link to iPhone 16 Product detail page]
    11iPhone 16 Base 128 GB[Link to iPhone 16 Product detail page]
    12iPhone 16 Base 256 GB[Link to iPhone 16 Product detail page]
    13iPhone 16 Base 512 GB[Link to iPhone 16 Product detail page]

    Integration code considerations

    • Uniquely identifiable records: each of the 13 records should have a unique identifier within the external search engine.
    • Data mapping: ensure correct mapping of product attributes (model, storage, color, etc.) to the corresponding fields in the external search index.
    • Consistency of Product detail page URL: verify that all 13 records point to the same Product detail page URL.
    • CMS integration: if your CMS is used to select where Product cards are displayed on a page, then you might need to make changes to ensure that the product variations are shown appropriately.

    Query asynchronously without reference expansion

    An alternative to using reference expansion for populating the Product detail page (or any other similar page) is to fetch product data in two stages:

    1. Retrieve the primary Product based on the URL.
    2. Then, asynchronously fetch the related products (in this case, the other 13 iPhone 16 models) by using their reference Product IDs.

    This approach can help improve perceived performance by rendering the core product information while the related product data loads in the background. This is beneficial if you want to prioritize the display of the primary Product immediately over showing all Product variants upfront. This method also provides you a more granular control over loading and error handling for each individual Product.

    Note: Although this unified Product detail page approach displays all variants, each variant actually corresponds to a distinct product. As a result, the frontend should ideally update the URL to reflect the selected variant when a user interacts with various options. For instance, when a user switches from iPhone 16 Max 128 GB to iPhone 16 Pro 128 GB. This approach helps maintain a consistent navigation user experience and enables a direct link to specific Product variants. However, the necessity of URL updates depends on the specific implementation, desired user experience, and tracking requirements.

    Test your knowledge