Welcome! This is my personal blog about Web technologies, software development, open source and other related topics
The ideas and opinions expressed here are solely mine and don't represent those of others, either individuals or companies.The code snippets or references to software products or analogous are to be used without any warranty of any kind. If you enjoy the content, feel free to share it and re-use it as long as you provide a link to the original post.
Sitecore Commerce installation package comes with Sitecore Business Tools SDK.
If you are planning to custommise Business Tools you might have to setup the development environment for Business Tools. You can find more information on how to setup the development environment here
For each version of Sitecore Commerce you need to install the specific version of Business Tools in you development environment.
See below the compatibility table for Business Tools with Sitecore commerce-
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.
AsyncPipelineBlock
If block needs to be executed Asynchronously use AsyncPipelineBlock. Also the method name changes to RunAsync()
SyncPipelineBlock
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-
IFindEntityPipeline
IFindEntitiesInListPipeline
IFindEntitiesPipeline
IPersistEntityPipeline
Any custom pipeline and list goes on…
Api Controller
Commerce api controller exposes the endpoint to communicate from FE or Commerce Connect to Commerce Engine. You can create custom endpoint and the api controller inherited from class CommerceController.
With XC 10.x the class file to inherit for same is CommerceODataController
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.
Prerequisites
Instance of Commerce Engine deployed in development environment
NPM configuration to have NPM Packages from Sitecore public feed
Sitecore BizFx SDK relies on NPM packages available on the Sitecore official public feed for NPM packages.
Open Poswershell as Administrator
Execute these 2 commands in powershell
npm config set @speak:registry=https://sitecore.myget.org/F/sc-npm-packages/npm/
npm config set @sitecore:registry=https://sitecore.myget.org/F/sc-npm-packages/npm/
This will add following line to–
C:\Users\[your user]\.npmrc
[Optional] – you may check if this lines are added
Update: Below is applicable for Sitecore Commerce 10.2. Change the SDK version accordingly.Ignore the step mention for Content Hub
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.-
Before installing Sitecore Commerce install Sitecore XP 10. See this blog to install Sitecore XP 10 using SIA. Say the XP site name is- sc10.sc.dev.local
Hosting Environment Requirements/ Download and Install following software-
OS – Windows Server 2019/2016 or Windows 10 Pro(64-bit)
Resolution- Check or reset the service account credentials that are created for the app pools as part of deployment. You can find the credentials in installation script with variable name $UserName (CSFndRuntimeUser) and $Password. Try accessing the https://commerceops.sc.com site if there are any other errors.
After installing Sitecore 10 using Sitecore Installation Assistant (see the blog here how to install Sitecore XP 10 usig SIA) you might find the Identity Server not working since it is not able to start the process with command line ‘dotnet .\Sitecore.IdentityServer.Host.dll’
You may see this error in Application logs.
You may also see Sitecore login been not redirected to identity server site instead redirects to XP login page.
To identify the problem first try manually starting the process in powershell. You can find command to start the process in error.
Navigate to the identity server site physical folder and execute this command
dotnet .\Sitecore.IdentityServer.Host.dll
This should tell the solution to the issue i.e. it needs AspNetCore version 2.1.16 to be installed.