i am trying to create a new accelerator. i ve created a new extension via extgen (yb2Baccelerator) after that i created a new cmssite in hmc. what is the link between the cmssite ( hmc > wcms > websites) and the frontend extension ? thanks for help
-
Welcome to Stack Overflow. Your question should have your effort to solve the task. Code is good, environment, screenshots, error codes if any. I would recommend you to check SO's official How to Ask article. And be more specific. – Aleksey Potapov Jan 08 '20 at 16:29
2 Answers
Well, the sort answer is: url pattern defined in the CMSSite.
Here is an example of CMSSite creation:
INSERT_UPDATE CMSSite ; uid[unique=true] ; theme(code) ; channel(code) ; stores(uid) ; contentCatalogs(id) ; defaultCatalog(id) ; defaultLanguage(isoCode) ; urlPatterns ; active ; previewURL ; startingPage(uid,$contentCV) ; urlEncodingAttributes ;
; $siteUid ; blue ; B2B ; $storeUid ; $contentCatalog ; $productCatalog ; $defaultLanguage ; (?i)^https?://[^/]+(/[^?]*)?\?(.*\&)?(site=$siteUid)(|\&.*)$,(?i)^https?://$siteUid\.[^/]+(|/.*|\?.*)$,(?i)^https?://api\.hybrisdev\.com(:[\d]+)?/rest/.*$,(?i)^https?://localhost(:[\d]+)?/rest/.*$ ; true ; $storefrontContextRoot/?site=$siteUid ; homepage ; storefront,language
Long answer from https://help.sap.com/viewer/4c33bf189ab9409e84e589295c36d96e/1905/en-US/8aefea0586691014b55edcb21295e112.html:
CMSSite A CMS site configuration options include:
- The BaseStore for the storefront.
- URL pattern regular expressions that enable the yacceleratorstorefront web application to decide which CMSSite and BaseStore to use to fulfill the request.
- The content catalog for the WCMS content. Usually one content catalog serves just one CMSSite, but it is possible to reuse the content catalog for multiple CMSSites.
- The product catalog, again the same catalog of products, categories, promotions reviews, and so on, could be used in multiple base stores or CMSSites. The optional classification catalog, it is helpful to have one classification catalog per product catalog if using more than one.
- The theme, which selects the CSS and message bundles for the storefront.
- The homepage for the storefront.
- The corresponding system Java locale when a user selects a particular language, which is important for formatting currencies and numbers.
- A flag to enable or disable the entire storefront.
Hope it helps.

- 11
- 1
- 3
Your newly created storefront extension should contain the CMSSiteFilter java class. This filter is responsible for setting on the Hybris Session a CMSSite, Catalogs, etc...
The CMSSite which will be set on the session will be decided based on the request URL(i.e the URL you put in the browser when trying to access your extension).
By default, you can access a website using a query param containing the site id as depicted below:
https://localhost:9002/?site=id_of_the_website&clear=true
In case your storefront has a different webroot than please see below example which can be used for accessing the B2C OOTB(out of the box) apparel store :
https://localhost:9002/yacceleratorstorefront/?site=apparel-uk&clear=true

- 1,553
- 3
- 17
- 28
-
the problem right now that it always returns a 404 even with https://localhost:9002/?site=id_of_the_website&clear=true – MBB Jan 14 '20 at 13:59
-
Well If the mapping to the site would not have worked you would have got an 500 Internal Server Error. I would recommend debugding HomePageController to see why it can not retrieve the homepage – dj_frunza Jan 14 '20 at 15:50