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.
dotnet new -i Sitecore.DevEx.Templates --nuget-source https://sitecore.myget.org/F/sc-packages/api/v3/index.json
dotnet new sitecore.nextjs.gettingstarted -n samplejss
Should first Restores dotnet local tools for the solution and Initializes the JSS project
What is your Sitecore hostname (used if deployed to Sitecore)? (samplejss.dev.local) << leave blank or provide the host name>>
How would you like to fetch Layout and Dictionary data?
GraphQL
REST
How would you like to prerender your application?
SSG
SSR
Which additional language do you want to support (en is already included and required)? << leave blank or type the language you want. should select da-DK by default and additional language>>
JSS application is now ready and updated for continerized environment.
Navigate to project folder and initialize the environment.
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.-
Environments in Sitecore XC are used to control the configuration policies that defines behavior. Define a Commerce environment in the environment configuration JSON file. JSON file contains information specific to Commerce Engine policies that needs to be implemented for specific environment for example Habitat Authoring.
In this article will show how to configure the policy in a specific environment JSON file and access the policy that affects the behavior based on the settings.
First check the default environment. Open Sitecore.Commerce.Engine.Connect.config and see
Restart IIS. Hope you already know how to run the Commerce Ops script using postman.
Open Postman, run the GetToken and in SitecoreCommerce_DevOps
run Bootstrap Sitecore Commerce.
This should sync the environment related changes.
Assuming you have a plugin. Create a policy in Sample.Commerce.Plugin.Management.Policies namespace with the class SitecoreCmsServerPolicy inherited from Policy as below-