SectionProductsData

In the process of upgrading from Litium 4 to 6 (including the Accelerator) we ran into the serialized SectionProductsData page properties that are not compatible with the new product models, see example below. It’s easy enough to change the name of the keys to correspond with renamed properties of Litium.Studio.Accelerator.CMS.Panels.SectionProductsData but what about the array of guids stored under the Products (or ProductSystemIds after the change) which used to refer to product ids? There are no BaseProducts or Variants with e.g. “cfbef429-38a3-4f1b-81f9-a19f11158fb9” as either SystemID or ID.

{
    "$type": "Litium.Studio.Accelerator.CMS.Panels.SectionProductsData, Litium.Studio.Accelerator",
    "NumberOfProducts": 6,
    "SectionProductsType": 2,
    "ProductGroup": "fb540571-4021-466a-9ecc-42244576611c",
    "ProductSet": "b24aaf66-1174-4a6c-b438-49c2fd8f3a14",
    "LinkText": "",
    "Products": [
        "cfbef429-38a3-4f1b-81f9-a19f11158fb9",
        "1d07f2e9-0d83-439a-8eb6-4a42e94e1625",
        "6367ddbc-1906-4af0-bb53-797f4a41fefe",
        "ff052c81-4d86-442d-9b4e-5da0de5ce219",
        "039be3d5-e200-4fb7-8b56-072dbbee103c"
    ],
    "LinkToProductGroup": "00000000-0000-0000-0000-000000000000",
    "LinkToPage": "00000000-0000-0000-0000-000000000000",
    "IsLinkToPage": false,
    "ProductSortingType": 0
}

The ids used to refer to products (in the ProductCatalog_Product table) but from looking at the code it seems like they are now expected to be product system ids:

data.ProductSystemIds.Select(x=> Product.CreateFromSystemId(x, WebControlState.CMS.WebSiteID)

What gives, do we need to manually dig up the correct ids and replace them in the serialized json or is there another way?

Litium version: 6.1.1

These objects are part of the Accelerator and is not handled by the upgrade script which only updates the Litium platform.

Depending on how many sections you have you could either manually re-create those sections and connect the products or write a script to replace them in DB.

If you go with script Litium use https://www.red-gate.com/simple-talk/sql/t-sql-programming/consuming-json-strings-in-sql-server/ to parse and write json in SQL server.

1 Like

Scripting it is then. Thanks for the json scripts!