Let’s assume that the minimum requirement of a product object is that it has a set of some properties that describe it: an order code, a title and a description, a tag list (for assigning categories to it), and an image. We could think of several other properties (availability, popularity, associated items, ...), but we’d like to keep it simple for now.
In case you’re asking yourself why we’re not considering creating a
ProductWidget but have chosen to use CMS objects straight away: This is because we want each product to be unique, meaning that all references to a product must exhibit the same data. Thus, we need a single CMS object for each of them. Of course, nothing speaks against creating a
ProductWidget for placing a particular product object on any page. But that’s not what we’re after here.
Let’s define the
Product object class, the data model we’ll be working with in the overview widget: just create a folder in “src/Objs”, name it
Product, and place the following files into it: