Hi all,
I think that many of you had a chance to work with SXA Storefront connected with xCommerce solution provided in Sitecore 9.0.2.
With the box we get also whole Storefront solution which helps especially during first contact with xCommerce. It provides for us a lot already prepared sites with mechanisms which allow xCommerce capabilities.
One of the this Storefront feature is scaffolding plan. This mechanism allows for editors to create a new site in Sitecore with sites, datasources etc. already prepared. It helps to skip re-creating content items each time for a new site, hence it reduces amount of work significantly.
By default Sitecore xCommerce SXA scaffolding prepare for us below structure:
We see how many things we get out of the box in this scaffolding.
But right now we should have ask a questions:
"It's so cool, but what if I have multisite solution and for instance each market has own site and I would like to:
- share my custom component during creation of a new market (new site)?
- add a new page to this structure during site creation
- link custom datasource to some component during site creation
Is it possible?"
Yes, it is !
You can create you own scaffolding plan or modify current one.
It is also worth to mention that there is no only one scaffolding plan in whole project. There is a few of them. You can find components plan, templates or foundation tenants plan as well.
Under the path: "/sitecore/system/Settings/Feature/Commerce Experience Accelerator/Storefront Components/Storefront Components Scaffolding Plan" you will find item component scaffolding plan:
But for instance if you will check path like: "/sitecore/system/Settings/Project/Commerce Experience Accelerator/Storefront Template Scaffolding Plan" you will find template scaffolding plan:
Very nice feature which is not easy to find is editor of this plan. To check it we will go to the components scaffolding plan. Now it's available after mouse right click as it is shown on below image:
When you click it window is opening and you have something looks like that:
Moreover, scaffolding plan are not only items which are in Sitecore to service thich functionality. There has to be some more structure to let it work in some way. So when we will dig one layer below we will find items called - Scaffolding Item Plan File which exists in Media library under the path:
"/sitecore/media library/Files/Scaffolding Plan Files/"
Now we can see there is more than one scaffolding plan file item, what means that there is more scaffolding plans.
But you will ask at this moment:
But you will ask at this moment:
"Robert, but what information keeps this file?"
What is very good question! Well, this file is a JSON file, which keep all information about the items and structure which has to be created. It is kind of snapshot of each item in JSON.
It's generated based on Branch templates which are located in the similar structure like scaffolding plans items. So if we would like to check templates plan it will be like:
Mentioned JSON file:
How it works?
Well to make it possible we have to select 2 things for scaffolding plan:
- Source item
- Reference item
Source Item - is an item from branch templates which define structure for the item which has to be created during scaffolding process.
Reference Item - is an item from content node, which currently exists and which will deliver values for the new item, which will be created based on source item (branch template).
During creation new site, scaffolding mechanism gets
I think that more it can be more clarified when we take a look on the image below, which shows window during editing component scaffolding plan:
So, what we have under the hood?
The main point in mentioned previously JSON file is special attribute/tag (whatever we will name it) - "dynamic".
This tag is sort of mock which cover place which will be replaced by the new ID during creation of new item during scaffolding process. Let's take a look on some row:
Now it should be more clear for everyone :)
How we can customize it ?
Like I wrote at the beginning there is a few options, you can modify current items, you can add own plans. You can do it only for templates or maybe for the components. You can even write your own Powershell script and generate this scaffolding plan file in JSON. Then just assign this file to some plan and it's done.
Because in this post we have made sort of overview and general description, example of customization we will do in next blog post.
Stay tuned ! :)
Like I wrote at the beginning there is a few options, you can modify current items, you can add own plans. You can do it only for templates or maybe for the components. You can even write your own Powershell script and generate this scaffolding plan file in JSON. Then just assign this file to some plan and it's done.
Because in this post we have made sort of overview and general description, example of customization we will do in next blog post.
Stay tuned ! :)
Hope it will help you ! :)
No comments:
Post a Comment