Showing posts with label Sitecore Experience Commerece. Show all posts
Showing posts with label Sitecore Experience Commerece. Show all posts

Thursday, May 7, 2020

Fix for Sitecore XP and commerce- The password for the account has expired.



Recently, We got this issue on one of the VM where we had Sitecore XP, and Sitecore XC installed.

After a quick investigation, were able to resolve it, here are the details for the quick fix.

The issue was because we had recently updated the password for a local user XX which we used to connect with the local machine with the VM services.

After resetting the password and grating the permission, We were able to resolve this issue.

Easy fix :)

Fix for Sitecore XP and commerce- Sitecore Experience Commerce - Shop CommerceEngineDefaultStorefront does not exist


I recently found this error while browsing the Sitecore commerce catalog item. After a quick investigation, I was able to fix it; below are the quick steps.


Make sure under this commerce settings - you have the same store name which had configured in the site group settings.

/sitecore/Commerce/Commerce Control Panel/Storefront Settings/Storefronts

Under this, the item name (Storefront name) should match with one of the site grouping name here.



Easy fix  :) 

Fix for Sitecore XP and commerce- Could not find and method - AddDataProvider (type: Sitecore.Data.DefaultDatabase)


Recently, I got this issue with the latest commerce local deployment. After a quick investigation, I was able to fix it, here is the step and fix details.

I checked the logs in both Sitecore XP and XC authoring and found below error (XC authoring)

00001 14:07:48 INFO Application startup exception
System.IO.FileLoadException: Could not load file or assembly 'System.IO.Compression, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.IO.Compression, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
   at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
   at System.Reflection.RuntimeAssembly.GetExportedTypes()
   at Sitecore.Framework.Configuration.Strategies.TypeStrategy`1.<>c.<Resolve>b__0_1(Assembly x)
   at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Sitecore.Framework.Configuration.Strategies.Filters.TypeEnvironmentFilter.Filter(IEnumerable`1 input)
   at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
   at Sitecore.Framework.Configuration.Strategies.StrategyBuilder`1.Using[TNext](IStrategy`2 next)
   at Sitecore.Framework.Runtime.SitecoreBootstrapConfigurationBuilder..ctor(String environmentName)
   at Microsoft.Extensions.DependencyInjection.RuntimeSitecoreServicesConfigurationExtensions.Bootstrap(ISitecoreServicesConfiguration sitecore, IServiceProvider hostServices, String environmentName, Action`1 config)
   at Sitecore.Commerce.Engine.Startup.ConfigureServices(IServiceCollection services)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()


The issue was due to the wrong version of System.IO.Compression ,

I had updated the right version and that resolved the issue.

that's an easy fix :)


Saturday, February 22, 2020

SXA - High-level tree structure and steps for the theme extension.

SXA has a highly flexible structure, and it follows the Sitecore Helix principles that contain the best development process and structure for the building, testing, extending, and maintaining the implementations.

Before going further, I would like to mention the basic structure of SXA and what is required and recommendation to extend the theme.

Here is the high-level view for the SXA tree structure including content, media library and templates.




Steps to extend the SXA theme.

We can extend the theme by creating a theme extension and using the Attach Theme Extension or the Extend Site Theme action.

Extnstion theme allows us to extend the base theme without any modification to the base theme. And this can be attached to an existing site to override the part of the theme/design.

Steps - go to this path /Sitecore/media-library/Extension Themes and create a new theme.




New extended them structure will be like this -





Upload a file for fonts, images, scripts or styles.


We must use the extend site theme action to extend the existing/ or new site theme, and it will be added automatically.

There are two ways to attach the extended them to the site.

One is to create a separate module and install it. You can find more details here - Extend by a separate module, the second option is to navigate to System\Settings\Feature\Experience Accelerator and add an item extend site theme, 


To deploy them separately, we must use Attach Theme Extension action.

Create a new Attach Theme Extension and select below two values, the first field name is 'Theme that is extended' and the second one is  'Extension Themes'.

Save and refresh the experience editor. Extension theme will be applied.


Monday, November 4, 2019

Sitecore Experience Commerce 9.2 how to protect the Solr admin page





Sitecore commerce latest release 9.2 does support the authentication plugin for the Solr, It's very interesting and I'm very excited to see this option there and would thanks to Sitecore for including this option :)

Here is the full context.

If you first-time setup the Solr - Standalone or Solr cloud there wouldn't be any by default security option available, you have to explicitly turn on this feature. and to do that there are a few options -

Available Authentication Plugins within Solr

Solr has the following implementations of authentication plugins:
Available Authorization Plugins within Solr
Solr has one implementation of an authorization plugin:
Now, How we can use this option in Sitecore Commerce 9.2, I have been using and extending Solr.Net for more than 4 years now and happy to see that you can extend this within Sitecore. Basically, we can control how Sitecore communicates with Solr by specifying the implementation of the IHttpWebRequestFactory interface of SolrNet that Sitecore uses.
We can specify the implementation by patching the Sitecore.ContentSearch.DefaultSolrConfiguration.config file. 

The factory class for Solr HTTP requests is in the  node.
for example, If we want to support basic authentication for accessing Solr, We must specify the solrHttpWebRequestFactory value in the following way:


solrHttpWebRequestFactory type="HttpWebAdapters.BasicAuthHttpWebRequestFactory, SolrNet">
  USERNAME
  PASSWORD




That's easy right :)

Sitecore XC 9.2-Installation tips and simple steps for resolution.



Sitecore XC 9.2 - Quick installation steps for On-premise

I'm trying to explain an easy way to resolve all possible errors while installing Sitecore XC 9.2, I can promise it's very easy :)

Below is the list of errors (Please ignore the long list, It's easy to resolve them in one go)

• Error 1 SQL72014: .Net SqlClient MERGE statement attempted to UPDATE or DELETE the same row more than once. This happens when a target row 
• Error 2 creating SolrCore 'SC92_xdb': non legacy mode coreNodeName missing {update.autoCreateFields=false}
• Error 3 SQL72018: Database Scoped Credential could not be imported but one or more of these objects exist in your source.
• Error 4 Failed to start service 'Sitecore XConnect Search Indexer - SC92xconnect.dev.local-IndexWorker (SC92xconnect.dev.local-IndexWorker)'.
• Error 5 https://localhost:8993/solr - Unable to connect to the remote server
• Error 6 Install-SitecoreConfiguration : Cannot find path
• Error 7 Related to timeout during the installation.
• Error 8 The service cannot accept control messages at this time. (Exception from HRESULT: 0x80070425)
• Error 9 Cannot bind argument to parameter 'MergeTool' because it is an empty string.
• Error 10 Exception of type 'System.OutOfMemoryException' was thrown at Invoke-CommandTask.ps1:31 char:13
• Error 11 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
• Error 12 The property 'Value' cannot be found on this object. Verify that the property.

Let's start the installation and will cover all solution here:-


First, it's mandatory to set up the Sitecore, Here are the quick steps for that.
Please refer to this document for Sitecore 9.2 

For complete flow, Please check my article here 



Saturday, November 2, 2019

SItecore (SC) and Sitecore experience commerce (SXC) - Databases, Sites and Solr Indexes.

Here are the high-level details for the Sitecore and Sitecore commerce databases, Sites in IIS and Solr indexes.

In my view, It's very important to understand all required/needed backed storage system to understand the data flow.

I have tried to draw a line for Sitecore and Sitecore commerce, In future, if you want to customize/change in DB or Solr Index you should have a complete understanding of that.

As a next step, I will try to explain schema details for all solr indexes and how you can review or change if needed like adding a new custom filter, introducing a new field etc.

Component Diagram


The Sitecore Experience Platform has three search frameworks:


  1. Content Search, which is used by various components primarily to search and index Sitecore items. Sitecore provides you with several options for configuring search results and indexing for content search.
  2. xConnect Search, which is used to search and index experience data.
  3. Commerce Search, which is used to search and index customers and orders.


Reference -  Sitecore documents

Saturday, September 28, 2019

Sitecore Commerce 8.2.1 - Website Flow and how to debug the code.

Sitecore commerce 8.2.1 has two parts one is Sitecore and second is Microsoft commerce engine.

Here is a flow in IIS to deploy the Commerce engine and Sitecore website


How to setup the complete structure. First we need to generate a Proxy for the Commerce engine and need to add a reference of that proxy in main website

It will be like this -



The next step is to configure and register all dependencies,  It can be done in a simple way, Here is an example code -

 public class ConfigureSitecore : IConfigureSitecore
 {
     ///
     /// Configures the services.
     ///
     /// The services.
     public void ConfigureServices(IServiceCollection services)
     {
         var assembly = Assembly.GetExecutingAssembly();
         services.RegisterAllPipelineBlocks(assembly);

         RegisterIocBindings(services);
    }

     private static void RegisterIocBindings(IServiceCollection services)
     {
         services.AddTransient();
     }


 }

Here are a few sections of the API's



Now, that's all for the configuration, Whenever your website will hit to the cart and checkout or any module where you needs to trigger the commerce engine, Application will start the CommerecEngine and we can attach that to the debugger and can debug the commerce engine plugin code.

Saturday, July 6, 2019

Sitecore Commerce 9.2 - Steps to deploy the solution with the first plugin.


Sitecore has provided a good documentation to set up the first plugin and deploy that plugin into your local environment for the test and can release those changes to test/staging and production environment.

Here are a few simple steps -

You need to open out of the box solution  Customer.Sample.Solution, You can find this project in Sitecore.Commerce.Engine.SDK.4.0.102.



Open the solution in VS2017 and build the project.



As per the Sitecore documentation, there are three options -

  1. Directly in Visual Studio using the Publish option
  2. Through a command line, using the dotnet publish command
  3. Inside a Build environment, as part of a Continuous Integration environment
Click on the publishing option -


If you are deploying this first time, I would recommend taking a backup of IIS site, because we need to update a few configurations.

Change the path to the file system -



There are total four environments in SXC - We need to deploy this release package accordingly.




After the deployment, I found below error -

Catalog Item of the Storefront catalog Configuration cannot be found.


I attached the debugger and found this issue at two places.



I have captured the error -
Inner Exception 1:
HttpUnhandledException: An unhandled exception occurred.

Inner Exception 2:
InvalidOperationException: Catalog Item of the Storefront catalog Configuration cannot be found.

   at ASP._Page_Views_SxaLayout_BootstrapBody_cshtml.Execute() in c:\inetpub\wwwroot\SC921sc.dev.local\Views\SxaLayout\BootstrapBody.cshtml:line 20
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()

   at ASP._Page_Views_SxaLayout_SxaLayout_cshtml.Execute() in c:\inetpub\wwwroot\SC921sc.dev.local\Views\SxaLayout\SxaLayout.cshtml:line 31
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()

Steps to debug and resolve this issue - 

All the related logs can be found here - C:\inetpub\wwwroot\SC921sc.dev.local\App_Data\logs\

Nested Exception

Exception: System.InvalidOperationException
Message: Catalog Item of the Storefront catalog Configuration cannot be found.
Source: Sitecore.Commerce.XA.Foundation.Common
   at Sitecore.Commerce.XA.Foundation.Common.Models.CommerceStorefront.get_CatalogItem()
   at Sitecore.Commerce.XA.Feature.Catalog.Repositories.ProductFacetsRepository.GetProductFacetsRenderingModel(String searchKeyword, Nullable`1 pageNumber, String facetValues, String sortField, Nullable`1 pageSize, Nullable`1 sortDirection, StringPropertyCollection propertyBag)
   at Sitecore.Commerce.XA.Feature.Catalog.Controllers.CatalogController.ProductFacets(String searchKeyword, Nullable`1 pageNumber, Nullable`1 pageSize, String facetValues, String sortField, Nullable`1 sortDirection)
   at lambda_method(Closure , ControllerBase , Object[] )

As per this blog we need to turn on the Sitecore.Commerce.Engine.Connectors.Index.Azure.config under this folder C:\inetpub\wwwroot\SC921sc.dev.local\App_Config\Include\Y.Commerce.Engine

The issue didn't resolve after enabling this config file.

I check the path - /sitecore/content/Sitecore/Storefront/Home/Catalogs and didn't see the catalog configuration.




In my case, I found that when I deploy a new solution it somehow has removed the Habitat catalog.

Let's create a new catalog here -

Here is the insert template 



I can't see the insert option in the catalog item.



So, I have decided to install it again for the storefront catalog.

Here we are after the new setup -


When I browse the SXA site, I got the Illegal modal issue but it got resolved after the refresh.


I simply copied the DLL into four environments and now got the below error -

Server Error in '/' Application.

Index sitecore_web_index was not found


There is an official fix for this issue - Download the fix



It didn't work. I have reset the catalogue and updated it manually.

Monday, June 10, 2019

Sitecore XC 9.2- Fix for Install-SitecoreConfiguration : The service cannot accept control messages at this time. (Exception from HRESULT: 0x80070425)



Error details -
[------------ StoreFront-PreconfigureInstance_StartAppPool : ManageAppPool -------------------------------------------]
[StoreFront-PreconfigureInstance_StartAppPool]:[Start] SC921sc.dev.local
VERBOSE: Performing the operation "Start-WebAppPool" on target "SC921sc.dev.local".
VERBOSE: Checking state of App Pool 'SC921sc.dev.local'
VERBOSE: Starting App Pool 'SC921sc.dev.local'
Install-SitecoreConfiguration : The service cannot accept control messages at this time. (Exception from HRESULT:
0x80070425)
At C:\deploy\SIF.Sitecore.Commerce.3.0.28\Deploy-Sitecore-Commerce.ps1:95 char:1
+ Install-SitecoreConfiguration @params -Verbose *>&1 | Tee-Object "$PS ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

[TIME] 00:03:14
Invoke-ManageAppPoolTask : The service cannot accept control messages at this time. (Exception from HRESULT:
0x80070425)
At C:\Program
Files\WindowsPowerShell\Modules\SitecoreInstallFramework\2.1.0\Public\Install-SitecoreConfiguration.ps1:641 char:25
+                         & $entry.Task.Command @paramSet | Out-Default
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-ManageAppPoolTask


`FIx - I think there was issue in service, they it cannot accept control messages at this time. I have restarted the system and it worked for me.

Saturday, June 8, 2019

Sitecore XC 9.2 - Mulitenant Adding a new tenant is very easy.

It's very simple to configure multiple tenants in Sitecore XC - Here is the link for more details - Details


I have followed a few steps here and watched the video, It's very easy and straightforward.


Good work Sitecore!

Saturday, June 1, 2019

Sitecore XC 9.2- Fix for Install- MERGE statement attempted to UPDATE or DELETE



Today, I was trying to install XC again to refresh an existing instance and found below error -

msdeploy.exe : Error: .Net SqlClient Data Provider: Msg 8672, Level 16, State 1, Line 2 The MERGE statement attempted to UPDATE or DELETE the same row more than once. This happens when a target row matches more than one source row. A
MERGE statement cannot UPDATE/DELETE the same row of the target table multiple times. Refine the ON clause to ensure a target row matches at most one source row, or use the GROUP BY clause to group the source rows.
At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\2.1.0\Public\Tasks\Invoke-CommandTask.ps1:31 char:13
+             & $Path $Arguments | Out-Default
+             ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Error: .Net Sql...he source rows.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Error: Script execution error.  The executed script:
BEGIN TRANSACTION;
CREATE TABLE #Blobs (
    BlobId  UNIQUEIDENTIFIER NOT NULL,
    [Index] INT              NOT NULL,
    Data    IMAGE            NOT NULL,
    Created DATETIME         NOT NULL
);
CREATE TABLE #Items (
    ID         UNIQUEIDENTIFIER NOT NULL PRIMARY KEY,
    Name       NVARCHAR (256)   COLLATE database_default NOT NULL,
    TemplateID UNIQUEIDENTIFIER NOT NULL,
    MasterID   UNIQUEIDENTIFIER NOT NULL,
    ParentID   UNIQUEIDENTIFIER NOT NULL,
    Created    DATETIME         NOT NULL,
    Updated    DATETIME         NOT NULL

Fix - you must remove the reference to the "ModuleHabitatImages" from the Includes section of the Master_SingleServer.json file

Sunday, May 26, 2019

Sitecore XC 9.2- Fix for Install-SitecoreConfiguration : Cannot retrieve the dynamic parameters for the cmdlet. Retrieving the COM class



Recently, While doing the reinstallation of Sitecore commerce, I got below error.

[------------------------ CommerceEngine-Ops_CreateAppPool : AppPool -------------------------------------------------]
Resolving ConfigFunction extension 'concat'
Resolved 'Invoke-ConcatConfigFunction'
Resolving ConfigFunction extension 'concat'
Resolved 'Invoke-ConcatConfigFunction'
Invoke-ConcatConfigFunction
Concatenating: \ sitecore
Result: \sitecore
Invoke-ConcatConfigFunction
Concatenating: sitecore \sitecore
Result: sitecore\sitecore
Creates or updates the app pool.
Install-SitecoreConfiguration : Cannot retrieve the dynamic parameters for the cmdlet. Retrieving the COM class
factory for component with CLSID {688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following error: 80040154
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
At C:\deploy\SIF.Sitecore.Commerce.3.0.28\Deploy-Sitecore-Commerce.ps1:95 char:1
+ Install-SitecoreConfiguration @params -Verbose *>&1 | Tee-Object "$PS ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

[TIME] 01:44:59

Solution - I have reviewed and identify it's because of using the 32 bit Powershell instead of 64 bit

Here is the error log file.




Saturday, May 4, 2019

Sitecore XC 9.2 - Add a new plugin steps.

There are two VSIX templates available for creating Sitecore Commerce Plugin

1.  Sitecore Commerce Engine Template developed By Andrew Sutherland

This will require to create a simple scaffolding plugin project
Allows creation of individual item-specific code file for commands, controllers, pipelines, pipeline blocks, etc.
We can download it from the marketplace -Here

2. Commerce.Plugin.vsix – Sitecore Commerce SDK

It will need a few cleanups and a lot of predefine simple code setup.


It's compatible with vs 2017.  if you have vs2019 - You may find below error in the log -

11/20/2019 1:46:39 AM - Found installed product - Global Location
11/20/2019 1:46:39 AM - Found installed product - Visual Studio Community 2019
11/20/2019 1:46:39 AM - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
   at VSIXInstaller.ExtensionService.GetInstallableDataImpl(IInstallableExtension extension, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   at VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   at VSIXInstaller.ExtensionPackService.IsExtensionPack(IStateData stateData, Boolean isRepairSupported)
   at VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize(Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Start the installation -



Setup a new project -


Sample project structure -