Sitecore supports multitenancy, which means you can have multiple sites running on a single Sitecore instance.
Tenant folder is just a container to hold multiple tenants you may have as a part of site structure. Inherited from _Base Tenant Folder. You may create a tenant folder to hold the multiple tenants of a Company.
A folder with provide tenant folder name is create here – /sitecore/templates/Project/<Tenant Folder Name>
Voluntarily contributing your time, energy and skills to the community and help customers succeed and be a part of their growth is all that matters. I believe going above and beyond to achieve expertise in whatever you are doing and giving back to community however small it may be is the key to grow together and when these efforts are recognized it inspires the community to continue their good work.
Happy to share that I have been recognized as 2021 Sitecore MVP.
Sitecore recognizes professionals who deliver outstanding customer experiences through shared expertise on Sitecore’s products, the 2021 MVP program draws from a community of 12,000 certified developers and over 20,000 active participants. This year’s 284 MVPs contributed invaluable knowledge to the community in 2020 and demonstrated true mastery of the Sitecore platform to support partners, customers and prospects.
Sitecore Commerce supports integration to the third-part system and customization and extension to the OOTB entities. This can be achieved by custom plugins.
If you are migrating your code from XC 9.x version to XC 10 you will have to update the code to newest API’s provided with XC. Following is the list of breaking changes if migrating from older versions or good to know if you are starting with the new XC 10 solution.
Wrappers to PipelineBlock
Commerce Engine uses pipeline framework to support extensibility. Pipelines act as a containers for business logic. Commerce pipeline consists of a block which has a detailed business logic.
With Sitecore 10 PipelineBlock are now wrapped with AsyncPipeline and SyncPipeline. So if you have your code using PipelineBlock it should be using Run method to execute the block you may have injected to pipeline.
If block needs to be executed Asynchronously use AsyncPipelineBlock. Also the method name changes to RunAsync()
If block needs to be executed Synchronously use SyncPipelineBlock. The method name used to execute block is Run()
ConfigureServiceApiBlock also now uses SyncPipelineBlock
2. IPipeline RunAsync() method
IPipeline interface method is changed from Run to RunAsync() which now makes sense as the method is asynchronous operation.
So where are the changes you might need to make, some of the pipelines that is used frequently and need change are listed below-
Any custom pipeline and list goes on…
These are few of the breaking changes. There are more and I shall keep updating.
This is a Part-2 of customizing Sitecore Commerce Business Tools. To see how to setup the environment for customization before you could start creating a custom component see Part-1
Often you have seen entity details are shown in Flat view i.e. horizontally, fields and there values are displayed. If you have too many fields to display flat view doesn’t seem to be user friendly. In this case the best way to display such details will a vertical view.
This post assumes Instance of Commerce Engine deployed in development environment and a custom entity is created. This is just a example on how to extend Business Tools using Angular which shows the flexibility of Business Tools in terms of cusotmization.
I have a entity named Organization and captures details for same which has quite a few properties as seen in below screen-
There are around 10 fields in the details section of the entity. These fields are squeezed and also doesn’t look user friendly. This would go more ugly if there are more fields added in the entity.
Sitecore Entity View default UIHint is Flat where a single row is displayed in a form of table.
This would look better if it is displayed in Vertical View or Form View i.e. each field in a different row.
Lets see how this can be done using BizFx SDK and the development environment we have created in this post – <<ENTER SETUP DEV BUSINESS TOOL ENVIRONMENT LINK HERE>>
Sitecore business tools already have Flat and Table View. Flat been default. Lets create a new view called as Vertical View.
Open the folder where the SDK zip file was extracted and navigate to src/app/components/views folder
View folder should look like this-
Copy paste and rename following files-
Copy and Rename sc-bizfx-flatview.component.css to sc-bizfx-verticalview.component.css
Copy and Rename sc-bizfx-flatview.component.html to sc-bizfx-verticalview.component.html
Copy and Rename sc-bizfx-flatview.component.ts to sc-bizfx-verticalview.component.ts
Open sc-bizfx-verticalview.component.html. Change the table to display the property name and value-
That’s all changes required to have a custom component in Business Tools.
Next open PowerShell and build the changes made and run the Business Tools site
The site should now listen to 4200 port.
Now lets create/update a entity view with a Vertical view UIHint. I already have entity with the Flat view. I will change the UIHint to “Vertical” to display the properties and there values vertically.
Build and deploy engine changes to Authoring site. (Not covered in this blog)
Using Flat view either squeezes the table or a horizontal scroll which is not user friendly. With the Verticalview Organization details are now shown vertical with the Property Names and Values in different rows.
This view is more readable for user specially with the long text in Address.
Easy to implement and test on development environment you can build more complex controls with the same approach
Next post will see how to deploy these changes to production.
Open Powershell in admin mode and navigate to the folder nupkg file is copied and execute following command to install package
dotnet new -i .\Sitecore.Commerce.Plugin.Template.6.0.4.nupkg
Run the dotnet new command and should be able to see Sitecore Commerce Sample Plugin template
4. Create a new Sitecore Commerce Plugin Project
As we have a plugin project template we should be able create a new plugin project.
Execute following command in Powershell. Navigate to the solution src folder-
dotnet new pluginsample -o Sitecore.Commerce.Plugin.SampleTest
New plugin project is created with the project name specified in command.
Include the project in Customer.Sample.Solution and compile.
Notice even though the command has project name “Sitecore.Commerce.Plugin.SampleTest” the actual project is created as “Sitecore.Commerce.Plugin.Sample”. You will have to rename this unfortunately as per your requirement.
Sharding is horizontal partitioning of data in database. It is the process of breaking up large tables into smaller chunks.
Storing rows of the same table in multiple database nodes
In this blog post will see how to split the Commerce Entities table having same structure but store custom entity data in a separate table that helps to split the load that a CommerceEntities table might take if the horizontal partition is not done.
Why partioning of tables is required?
Sitecore Commerce entity data are store in following tables-
Any custom entity been created without sharding will store data by default in tables mentioned above.
What if that data increases, there might be a performance hit once the data start expanding over months and years.
Also it wont be good idea to put the multiple custom entity data into a single table. As this might give a performance hit whilst indexing table. So, if you know data might increase over the time it is better to have it saved in a separate table as it can be a boon to high-volume data.
Partitioning data using sharding policy
I assume you know how extend Sitecore Commerce entities. Consider we have a “Organization” entity. Business Tools helps in capturing details of Organization i.e. CRUD operations. When the entity is been saved it has to be saved in different table.
This driven by the sharding policies in Commerce.
Follow these steps to enable sharding of custom entity-
The Commerce Engine implements database sharding for Commerce entity and list tables, and provides 2 types of sharding policies. One is for the operation against Commerce entities i.e. EntityShardingPolicy, and other on the Commerce lists i.e. ListShardingPolicy.
Configuration for sharding policy is kept in PlugIn.SQL.Sharding.PolicySet-1.0.0.json file and can be found in data\Environments folder of the Authoring and Shops instance.
As per Sitecore documentation sharding policies has expressions and multiple expression values can be configured based on this the table of the entity is identified to read and perform write operations. This is a bit contrary statement as the table name defined in policies are passed to the stored procedure based on this the data in table is written and read.
Below sharding policy mentions 2 tables-
OrganizationsLists for managing and reading lists of Organizations
OrganizationsEntities for managing and reading Organization entities
To save data in different tables create Entities, Entity and Lists table prefixed with entity name in SitecoreCommerce_SharedEnvironments database
Right click CommerceEntities table select Script Table as option, Create to and then New Query Editor Window. Create script for CommerceEntities table will be generated.
Change the name of table to e.g.:- OrganizationsEntities. Also change the table name to set Default value to EntityVersion and Published fields
Pasrse and check if you are creating a table in correct Database
Execute the script. New table will be created.
Follow same for CommerceEntity table to create OrganizationsEntity and CommerceLists to create OrganizationsLists
So there are 3 tables created so far-
Once you have your plugin to perform CRUD operations on Organizations entity you should be able to see the data been inserted in OrganizationEntities, OrganizationLists and OrganizationsEntity table instead of CommerceEntities and there related tables.
Business Tools is extensible using pluggable framework and can extend a UI using Entity Views. Although Business Tools offers a rich set of controls you might want to create your own custom control for the best business experience.
For this you need to first setup the development environment for business tools. Once the environment is setup you should be ready to develop custom control/customize the business tools.
Instance of Commerce Engine deployed in development environment
Sitecore Experience Commerce 10 has come up with great new features like Dynamic Bundles, Free gift with Purchase promotion and a sample Sitecore DAM to Commerce connector.
Before you start looking into this, it is important to setup the development environment to debug and test the changes you are making to engine.
Main changes I could see compared to previous versions are integration with Content Hub and Configuring the Commerce Engine using environment variables which not only helps for on-premise installation of Commerce Instance but also helps setup the Docker technology where XC solution is running in containers.
In this post I will walk you through on how to setup the development environment. This post assumes you have Sitecore Commerce Engine along with Visual Studio 2019 installed on developer workstation. If Commerce not installed no worries see this post on how to install Sitecore XC 10 step-by-step.
Copy the downloaded SDK Sitecore.Commerce.Engine.SDK.6.0.130.zip on your development folder. e.g: c:\development. Note– there is an update on 19th August where the external dependencies are removed. Download the package again if you have a version before this date.
Extract the commerce package and then extract Sitecore.Commerce.Engine.SDK.6.0.130.zip in your development folder
Step 2 – Setup Visual Studio Solution
Open the Solution, by default this is Customer.Sample.Solution.sln
Ensure Package Source is configured for Commerce- https://sitecore.myget.org/F/sc-commerce-packages/api/v3/index.json
Whilst opening solution login from slpartners.myget.org will be prompted
Create an account on https://slpartner.myget.org/ and login here. You may unload Plugin.Sample.ContentHub project if you dont want to integrate ContentHub and the login should not require. Also note myget account has a trial for 14 days.
Build the Solution. It should restore the package and build successfully.
(optional)Rename the Solution name. In this case I have renamed to Retail.Commerce
(Optional) Create Foundation and Feature projects. Build the solution again.
Step 3- Important – Commerce Engine configuration
Sitecore.Commerce.Engine project should have a config.json file in wwwroot folder. Open this file you will see the placeholders that needs to be filled in.
Instead updating config file, you should update the launchSettings.json and the placeholders in config.json will be updated on launch on commerce engine.
Similarly Global.json you can find this in wwwroot/bootstrap folder of your Sitecore.Commerce.Engine project. Again this file has the Placeholders that will be populated from launchSettings.json,
You need to update mainly following variables in launchSettings.json file for both config and global json. There are other variables apart from listed below, you may need to update those based on your site instance name etc.-
If you are looking for upgrade to Sitecore 10, below are the various options you are able to install Sitecore 10.
Sitecore XP 10
Sitecore Installation Assistant (SIA)
Sitecore Installation Assistant helps guides you through the Sitecore XP Developer Workstation installation. Use this option to review system requirements, install prerequisites and complete the entire installation process. With Sitecore 10 you have a option to also install SXA with SIA.
Sitecore Install Framework (SIF) is a Microsoft PowerShell module that supports local and remote installations of Sitecore Experience Platform.
SIF deploys Web Deploy Packages (WDP) by passing parameters to SIF configuration through a Microsoft PowerShell module and is fully extensible. The Sitecore Experience Platform is designed to be secure-by-default. For developer environments all the required self-signed certificates are created automatically if you do not provide any. In a production environment, you can provide your own certificates In a non-production environment, you can choose to have the module generate the certificates for you.
You must set up SIF before you can install Sitecore Experience Platform
Sitecore Containers support rapid deployment and more efficient solution and team onboarding with modern Docker and Kubernetes technology.
Sitecore Experience Platform 10.0.0 uses Docker Compose as the container orchestrator on developer workstations. Docker Compose is a simple containerdeployment tool that is bundled with Docker for Windows. Sitecore container images can be deployed with other tools but we recommend that you use Docker Compose to deploy the containers that form the Sitecore Experience Platform.