-
Notifications
You must be signed in to change notification settings - Fork 3
Dimensions and Facets
This document describes Dimensions and Facets, the mechanisms that we use to flexibly categorize merchandising entities, such as Products and SKUs. This document won't describe actually creating categories in any technical sense, but will touch on out Dimensions and Facets are used to create a category structure.
As we consider this design, we should keep in mind the overall goals of how categories work in FoxCommerce:
- Categories are decoupled from site navigation
- The Products or SKUs returned from a category in site navigation should be the result of a saved search
- The attributes upon which a saved search is built should include a flexible taxonomy structure that will enable both a tree-based menu system, such as Sephora, or a search-based interface, such as Adidas.
-
Merchandising Entity: Any object in Phoenix that is powered by
ObjectForm
,ObjectShadow
, etc. This specifically includesProduct
,Sku
,Album
,Variant
,Promotion
, andCoupon
at the time of writing. - Dimension: A Dimension a specific taxonomy that defines an attribute on a merchandising entity.
- Facet: A Facet is a value that's associated with Dimension. For example, if we have a Dimension "Gender", then it might have Facets: "Men" and "Women".
-
Dimension and Facet should be context-aware and versioned
-
Dimensions should allow either their Facets to be either single-selected, meaning that only one of their Facets may exist on the merchandising entity, or multi-selected.
-
The Facets of a Dimension may be either flat or hierarchical. For example:
// Flat Gender ------ - Men - Women - Children // Hierarchical Apparel ------- - Shirts - Short Sleeve - Long Sleeve - Pants - Shorts - Pants - Shoes - Dress - Casual
-
It should be possible to search for a merchandising entity based on its Facets.
-
Dimensions and Facets should be able to accept a flexible set of metadata for information that may be used when displaying it on storefront.
In order to achieve requirements (1) and (5), Dimension (and Facet) are built on
top of the ObjectForm
and ObjectShadow
infrastructure. Instead of going too
deeply into how that works, here's what the head object looks like:
sealed trait SelectionType
case object Single extends SelectionType
case object Multi extends SelectionType
sealed trait FacetType
case object Flat extends FacetType
case object Hierarchical extends FacetType
case class Dimension(id: Int,
contextId: Int,
commitId: Int,
formId: Int,
shadowId: Int,
selectionType: SelectionType,
facetType: FacetType)
This signature is mostly the same as what you'd see for a Product
or Sku
inside of Phoenix right now, except for the addition of selectionType
and
facetType
. These define the selection behavior and facet structure of the
Dimension.
Also, note that none of the metadata about the Dimension, such as name, exists on the head. That will be kept inside the form/shadow attributes so that it can be versioned correctly.
Like Dimension, Facet is build on top of ObjectForm
and ObjectShadow
.
case class Facet(id: Int,
contextId: Int,
commitId: Int,
formId: Int,
shadowId: Int)
Facet ends up being a very simple implementation of an ObjectHead
, with all
interesting metadata stored in the form and shadow.
For now, we're going to punt on the implementation of hierarchical Dimensions,
so this section will only talk about flat Dimensions. Dimensions and Facets will
be associated through an ObjectLink
, or more accurately, what's being proposed
to replace the ObjectLink
.
<TODO: Update and insert the new ObjectLink documentation>
Finally, the interesting thing!