Customizing Models

Models in the Storefront Reference Architecture (SFRA) provide a JSON object layer for the application. The models convert objects returned by the Salesforce B2C Commerce script APIs into pure JSON objects designed for the storefront. The models also apply business logic for the storefront. A model passed in for rendering a template is assigned to the viewData variable. You can add extra properties to the viewData variable — properties that are not provided by the app_storefront_base cartridge.

Controllers create and update models. To customize a model, you create the model and then add data to it that can be used for rendering.

Anything in the modules folder or the toplevel folder is globally available and extendable.

You can customize models to:

  • Extend the model to include more data to be used when rendering the template
  • Add extra models with objects used to render templates
  • Change models to be used to render templates in a different framework