1

In Sitecore SXA when I right-click on a tenant, it should have an option to add an eCommerce site. So, when a user clicks on the eCommerce site it should run the same PowerShell script that is run when we hit Insert -> Site.

The difference is in the site structure, for an eCommerce site we should have a category, sub-category, product pages added inside the home items by default. Is it possible to achieve it? If yes, what would be the steps.

Thanks in advance !!

1

I would suggest different approach because yours might be vulnerable to SXA updates (custom dialog might miss some functionalities).

Instead I recommend extending existing scaffolding.

When you open New-Site dialog you can see modules/features section. It lists all the modules that will be installed during site scaffolding operation (examples: Page Content, Media, Navigation ...).

Your goal is to create your own module (like Media, Navigation) and define actions there which will create desired item structure.

Steps

  1. Create Site Setup definition (root for your actions) - this item will appear as an option in the dialog. Set meaningful name in Name field. Also specify if modules should be installed by default (checkbox checked) or if it's a system module and every site should have it without possibility to disable it.

    Documentation

  2. Add scaffolding action. In your case you have to use Add Site Item action type. As a Template you can define branch which should be used to create pages. You can use as many action you need.

    Documentation

0

It is possible if you adjust insert rules, scaffolding... but that would require quite some effort and so I would like to suggest a different approach.

SXA has the functionality of site cloning. This means you create one "base" site with all the pages and settings as you want in the ecommerce site. Each time you want to create such a new site though, you don't go through the site creation process but you clone the base site. This goes much faster as well... as a bonus you could also create a "shared" site - this can include a lot of information, settings, data and such that are shared between all the created sites in the tenant.

More information can be found here: https://doc.sitecore.com/en/developers/sxa/101/sitecore-experience-accelerator/recommendations--sharing-content.html

I also had a presentation on creating websites with SXA this way on SugCon 2021: https://ggullentops.blogspot.com/2021/06/sugcon-2021-sxa.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.