Did you ever wondered why Hybris created two entities, store and site? What is the relation between them? What is the difference between them?
Most of the times, organisations have physical stores, with inventories, catalogs etc. and then they decide to have an online version for everything. Though we have exceptions now a days, where we have direct online stores, like FlipKart. Though they still have to have physical inventories to fulfill orders.
So in a sense, we can say that there are essentially two entities, one could be real (Physical) and another is virtual (Online).
So we can say that store is an entity which is associated with catalogs, stocks, currencies, language etc. The locale is associated here, as it can be looked more tightly coupled with physical analog, who are concrete in nature.
On the other hand, we have site, which corresponds to online entity. The online entities should essentially have URLs, and language associated with them.
So how do they relate??
Think once. Amazon has many physical stores worldwide. Also it has many sites, based on countries, language etc. So the relation between two is very dynamic. It has to be Many to Many.
That is how it is done in hybris in base commerce items.
<relation code=”StoresForCMSSite” generate=”true” localized=”false” autocreate=”true”>
<deployment table=”Stores4Site” typecode=”1092″ />
<sourceElement qualifier=”cmsSites” type=”BaseSite” cardinality=”many” />
<targetElement qualifier=”stores” type=”BaseStore” cardinality=”many” collectiontype=”list” ordered=”true” />
How the online site will look depends on the content, and not what is the price of a product. So content catalog is associated with cms site, not store.
<relation code=”CatalogsForCMSSite” generate=”true” localized=”false” autocreate=”true”>
<deployment table=”Catalogs4Site” typecode=”1063″ />
<sourceElement qualifier=”cmsSites” type=”CMSSite” cardinality=”many” />
<targetElement qualifier=”contentCatalogs” type=”ContentCatalog” cardinality=”many” collectiontype=”list”
Hybris could have their own reason to do so. This is what i could envisage from my experience.