Tag: Sitecore

Options to Install Sitecore (XP) and Commerce (XC) 10

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.

To install Sitecore 10 using SIA follow this post- Step-by-step how to install Sitecore 10 using SIA

Sitecore Installation Framework On-Premises (SIF)

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

To install Sitecore XP 10 using SIF follow this post – Step-by-step install Sitecore XP 10 using Sitecore Installation Framework (SIF)

Sitecore Containers

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.

To install Sitecore XP 10 using Sitecore Containers with Docker Compose- Step-by-step install Sitecore XP 10 to developer workstation using Sitecore Containers with Docker Compose

Sitecore XC 10

Sitecore Installation Framework (SIF)

Sitecore Install Framework (SIF) is a Microsoft PowerShell module that supports local and remote installations of Sitecore Experience Platform.

The SIF.Sitecore.Commerce package contains Sitecore Installation Framework scripts and Web Deployment Packages (WDP).

To install Step-by-step install Sitecore Commerce (XC) 10

Install Sitecore XP 10 using Sitecore Installation Assistant(SIA) in easy steps to development machine

Installing Sitecore 10 with Sitecore Installation Assistant (SIA) is quick and easy. Only manual prerequisite is to install SQL Server 2017

Please see through screens to install Sitecore 10-

Step 1- Install SQL Server 2017 and SQL Server Management Studio (SSMS)

Step 2- Download Sitecore 10 Graphical setup package for XP Single

Step 3- Extract the zip and start setup

Step 4-

Step 5- Install prerequisite. This should install SIF and Windows Server prerequisites including IIS and modules etc.

Step 6 – Once prerequisites are installed successfully yo may have to restart machine. Install Solr search service. Sitecore 10 needs SOLR 8.4

Step 7- After SOLR is installed enter the Sitecore settings along with SQL server details and SOLR details

Step 8 – Optionally select Sitecore modules (SXA)

That’s it and everything is managed by SIA to sucessfuly install Sitecore 10 on machine

Enable Catalog search in business tool for Sitecore 9.1 Commerce environments

Sitecore Commerce indexes Catalogs, Categories and SellableItems to help search items in Business tools. The settings for the Search can be found in PlugIn.Search.PolicySet-1.0.0.json

These indexes has a search scope, for searching catalog and related items by default the scope is “xc910CatalogItemsScope”

So in SOLR indexed items related to catalogs are kept in core – “xc910CatalogItemsScope”

By default Sitecore will index only Habitat Environment in Sitecore Commerce 9.1. If you want to index your custom environment or AdventureWorks environment, follow these steps-

  • Open Sitecore.Commerce.Engine.Connectors.Index.Common.config file. This should be in CM Y.Commerce.Engine folder
  • In this instance for Adventureworks add “AdventureWorksAuthoring” in Environemnts element for Master Index and “AdventureWorksShops” for Web Index
  • Open Postman and Run – Full Index Minion Catalog Items
  • Check if the items are indexed correctly in SOLR.
  • Search the same keyword in Business tool for AdeventureWorks environment

First Steps | Sitecore Commerce Development | Create a Custom Plugin

In my last post, I have described the steps to set up the Sitecore Commerce development environment. In this post, I will describe how to create a custom plugin in Sitecore Commerce. I was working on version 9.3 but these steps should work with all versions of 9 series.

Sitecore Commerce provides an extensible framework which can be extended using plugins. A plugin is an independently publishable extension to the Sitecore Commerce Engine. Generally, you will find the following contained in a plugin and are used to extend the platform.

  • Entities
  • Components
  • Entity Views
  • Pipeline
  • Policies etc.

You can extend the platform or add more features using the plugins. Letā€™s get started and look into the steps to create a new plugin in Sitecore Commerce 9.3. If you have already set up your commerce development environment, please skip to step 2

Step 1 – Setup developer environment

Create a developer environment for Sitecore Commerce to run the engine from Visual Studio, can be either VS 2017 or 2019. Follow this blog post for same Setup development environment for Sitecore Commerce 9.3 Engine

Step 2 – Install Visual Studio Extension for creating plugin

  1. Go to  solution root folder or SDK folder and run the Sitecore.Commerce.Plugin.vsix file. Close the Visual Studio solution if open.
  2. This should install extension on selected Visual Studio Version
create plugin1

Step 3 – Create a plugin

  1. Open your solution. Create a Feature solution folder, just to follow Helix best practice. Right click solution folder to create a new project
  2. Search Sitecore.Commerce.Plugin. Select project type and click next.
create plugin2
  1. Give the project name, location and select .Net Framework 4.7.1. Create a Project.
create plugin3
  1. Sample Folder and Files for Commands, Components, Controller etc shall be added.
create plugin4
  1. Update the Sitecore Commerce Core from 5.0.0 to 5.0.4
create plugin5
create plugin6

4. Build the project. There shouldn’t be any reason the build should fail.

Step 4 – Reference project and run engine

  1. Add Plugin project reference to your Commerce.Engine Project
  2. Run the Engine. You should be able to see the newly created plugin is now registered in Engine.

This should allow to start customizing commerce and truly use plug-gable and extendable feature of Sitecore Commerce.

create plugin9

We intentionally didnā€™t add any code to this plugin to keep this simple. In the next blog, we will cover the anatomy of the newly created plugin and show how to inject this plugin into Commerce Pipelines and execute some custom code.

Next understand the Elements of Sitecore Commerce Plugin project templates

Hope you enjoyed this post. Stay tuned.

Sitecore 9.3 installation error- Install-SitecoreConfiguration : The ‘Install-SitecoreConfiguration’ command was found in the module ‘SitecoreInstallFramework’, but the module could not be loaded. For more information, run ‘Import-Module SitecoreInstallFramework’.

Whilst installing Sitecore 9.3 received following error-

 

Install-SitecoreConfiguration -Path .\prerequisites.json
Install-SitecoreConfiguration : The 'Install-SitecoreConfiguration' command was found in the module
'SitecoreInstallFramework', but the module could not be loaded. For more information, run 'Import-Module
SitecoreInstallFramework'.
At line:1 char:1
+ Install-SitecoreConfiguration -Path .\prerequisites.json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Install-SitecoreConfiguration:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

SC93Installation

To resolve this issue, you need to set execution policy to your machine-

Set-ExecutionPolicy -ExecutionPolicy AllSigned

You may also provide a scope to the current powershell session-

Set-ExecutionPolicy -ExecutionPolicy AllSigned -Scope Process

This should help resolve issue and any further powershell script execution process depending on what scope you provide the script to run.

References – Set Execution Policy

 

 

 

Sitecore commerce – No catalog data available

Sitecore Storefront can have multiple catalogs, but only one catalog can be used to each Storefront.

At times whilst development you might have to switch between the Authoring site and Visual Studio Commerce Engine Solution for debugging. I have seen sometimes the Catalog for the Storefront is reset during the switch which results in error – No catalog data available.

This message is shown on the menu as seen in the screenshot-

ErrorNoCatalogDataAvailable

ErrorNoCatalogDataAvailable2

Solution-

Login to Sitecore Client and follow these steps-

  1. Navigate to following location in Content Editor-  /sitecore/content/Sitecore/Storefront/Home/CatalogsSelectCatalog
  2. If none of the Catalog is selected, please select the Catalog and Save. In this case Habitat_Master
  3. Should now display the menu as the Catalog details are now setupErrorNoCatalogDataAvailable1

You also might need to consider checking Catalog Configuration here – /sitecore/content/Sitecore/Storefront/Settings/Commerce/Catalog Configuration

Setup the Catalog and Start Navigation Category

CatalogConfiguration

 

Hope this helps.

 

 

Sitecore Commerce environments- configure and access environment policy

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

<defaultEnvironment>HabitatAuthoring</defaultEnvironment>

In this case will add a setting to include Sitecore Clinet Url in enviornment-

Open Comerce Authoring – wwwroot\data\Environments folder

Since the default environment is HabitatAuthoring, you should update PlugIn.Habitat.CommerceAuthoring-1.0.0.json file-

{
"$type": "Sample.Commerce.Plugin.Management.Policies.SitecoreCmsServerPolicy, Sample.Commerce.Plugin.Management",
"ServerHostName": "https://mystorefront.local/"
},

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-

using Sitecore.Commerce.Core;

namespace Sample.Commerce.Plugin.Management.Policies
{

public class SitecoreCmsServerPolicy: Policy
{
public string ServerHostName { get; set; }
}
}

You can use the environment configurations by getting the policy as folloes-

var cmsSitecoreServerPolicy = context.GetPolicy<SitecoreCmsServerPolicy>();

cmsSitecoreServerPolicy.ServerHostName;

You should now get the value “https://mystorefront.local/” when ServerHostName is accessed.

You may update these environment files- PlugIn.Habitat.CommerceShops-1.0.0.json for shops environment

Hope this helps.

 

Reference- Commerce Engine environments

 

 

 

 

 

 

How to install and switch between multiple versions of Sitecore Installation Framework.

Installation ā€“ Sandeep Pote

To run the multiple versions of Sitecore Installation Framework (SIF) first check the installed versions with following command-

Register the repository command followed by SIF List available command-

Register-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2

Get-Module SitecoreInstallFramework ā€“ListAvailable

This should list the all the installed version of SIF

sifv1

In this case it shows 2.1.0 and 1.2.1 installed.

To list the version version that is currently in use, execute following command-

Get-Command -Module SitecoreInstallFramework | Select-Object -Property name, version

sifv2

Currently it shows v1.2.1 is active, to switch to the latest version i.e. 2.1.0 or any other version, run the following command-

Remove-Module -Name SitecoreInstallFramework
Import-Module -Name SitecoreInstallFramework -RequiredVersion 2.1.0

Now this should switch to the version 2.1.0

Hope this helps.

Installing Sitecore Installation Framework (SIF)

To have Sitecore Installation Framework in local machine, follow these steps-

Opent the Powershell Command in Administrator mode, make sure have Version 5.1

Run the following command to register the repository

Register-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2

Install the PowerShell module by running following command-

Install-Module SitecoreInstallFramework

To install specific version provide version number-

Install-Module -Name SitecoreInstallFramework -Repository SitecoreGallery -RequiredVersion 2.2.0

 

Get-Module SitecoreInstallFramework ā€“ListAvailable

Sitecore commerce (XC) 9.2 installation errors

Whilst installing XC 9.2 I faced following issues, these are basic issues but as a newbie was a good learning and a in depth understanding of the configurations and tasks required to get the commerce installed.

Configuration contains no tasks

This was the trickiest issue. XC9.2 required SIF 2.1.0, you might have installed this version but if you have multiple versions of SIF you might have to switch to SIF 2.1.0 whilst installing the XC9.2

Following is the coupe of lines, end of the scripts ends during installation-

VERBOSE: Registering Task extension ‘TestWebFeatureSSL’ => ‘Test-WebFeatureSSL’
VERBOSE: Registering task parameter map
VERBOSE: WarningAction => Continue
VERBOSE: Verbose => Continue
VERBOSE: InformationAction => Continue
VERBOSE: WhatIf => False
VERBOSE: Debug => SilentlyContinue
VERBOSE: ErrorAction => Stop
WARNING: Configuration contains no tasks
[TIME] 00:00:00

Solution to issue-

Check the version of SIF active in the powershell or currently used with following command-

Get-Command -Module SitecoreInstallFramework | Select-Object -Property name, version

XC1

Resolution-

If it shows V1.2.1 switch to version 2.1.0 but ensure the this version is installed. To switch to the new version-

Remove-Module -Name SitecoreInstallFramework
Import-Module -Name SitecoreInstallFramework -RequiredVersion 2.1.0

This should allow you to proceed with the instllation.

How I found this might be the issue-

Firstly its a pre-requisite to XC9.2, SIF 2.1. is required.

When I ran the installation script it showed this screen. It shows SIF version as 1.2.1, this were I guessed version might be wrong.

Logs didn’t mention the same.

ConfigurationTask

https://sitecore.stackexchange.com/questions/20791/xc-9-2-installation-error-configuration-contains-no-tasks

.Net SqlClient Data Provider: Invalid object name ‘Blobs’

This happens to be another silly mistake I made in the script file where I mentioned wrong site name prefix.

Found that it tries to update the Blobs and other tables in XP instance i.e. YourSitecoreXP_Master DB

So if the Sitecore prefix in the deploy script is wrong it tries to create a new database and update the Blobs table which is not available and hence fails.

 

XC2

Resolution-

So please check $SiteNamePrefix in deploy script, should match to the XP prefix. e.g.- if your Sitecore XP site name is storefront920.local so the database will be created as storefront920_Master. So in this case $SiteNamePrefix will have to be storefront920

Invoke-RestMethod : The remote server returned an error: (500) Internal Server Error

If you see this error-

VERBOSE: Result: https://commerceshops.sc920.local/commerceops/Bootstrap()
BootStrapping Commerce Services: https://commerceshops.sc920.local/commerceops/Bootstrap()
VERBOSE: PUT https://commerceshops.sc920.local/commerceops/Bootstrap() with 0-byte payload
Install-SitecoreConfiguration : The remote server returned an error: (500) Internal Server Error.
At E:\sc_com_install\SIF\sc_com_install.ps1:100 char:1
+ Install-SitecoreConfiguration @params -Verbose *>&1 | Tee-Object “$PS …
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

Resolution-

Managed to resolve this issue by updating the Sql database name to have double slash “\\” between the machine name and sql instance.

This is applies to following paramsters in script-

CommerceServicesDbServer and SitecoreDbServer

e.g.:- machinename\\sql-instance

Could not load file or assembly (Microsoft.Web.XmlTransform.dll)

If you see below error even if the file is present in the desired location, Unblock the file to continue the installation.

XCERROR

Go to directory having files Microsoft.Web.XmlTransform.dll. Right click the dll and Unblock the dll

scerror2

If you still see this issue, provide the relative path to the dll in script file for parameter – MergeToolFullPath