Installing Site core Commerce 8.2.1 Reference Store.
1. Understanding Sitecore Commerce Reference Store Options
Reference store options
- Sitecore Commerce powered by Commerce Engine. Download Sitecore Commerce 8.2.1 Storefront Solutions from here https://github.com/Sitecore/Reference-Storefront/releases/tag/10.0.853
- Sitecore Commerce powered by Commerce Server.
- Sitecore Commerce powered by Microsoft Dynamics.
- Sitecore Commerce powered by Commerce Engine – Habitat Based (Retail Demo).
You may interested in Habitat based Sitecore Commerce Implementation here https://github.com/Sitecore/Sitecore.Demo.Retail
2. Change Log: Your Guide.
- Sitecore Commerce is a work in progress. Based on .Net Core which is again a work in progress.
- Ensure you look at Change Log for your version of Sitecore Commerce for any dependencies change.
Change Log Sitecore Commerce 8.2.1 Update 2 http://commercesdn.sitecore.net/SitecoreCommerce/ReleaseNotes/en-us/index.html
3.1 Recommended Hardware Requirements
4 Core 8 threads processor, 16GB of RAM, 500 GB SSD Hard Disk
3.2. Software Requirements
- SQL Server: SQL Server 2014, Installed in mixed mode as default instance (note ‘sa’ password)
- IIS: Enable IIS for the version of OS
- OS: Window 8/8.1/10 Professional or higher, Windows Server 2012/R2 64 bit or higher
- MongoDB: Mongo DB3.0 or higher as Windows Service (Can Install using SIM)
- Developer Tools: Visual Studio 2015 Update 3, SIM, Sitecore Rocks, Sitecore TDS, RoboMongo
- Sitecore: Sitecore 8.2 Update 4 Zip, Sitecore Commerce 8.2.1 Update 2
- License: A valid Sitecore license with Commerce
- .Net Framework 4.6.1 Developer Pack with Available updates
- ASP.net MVC 4 Runtime
- ASP.net MVC 5, Installed as nuget packaged and shipped with project build
- ASP.Net Core 1.0.3 for Sitecore Commerce 8.2.1 Update 2
Visual Studio Tooling
NET Core 1.0.3 SDK Preview 2 build 3156
3.4 Components, Tools, Browsers
- Powershell 4.0 or later
- HttpPlatformHandler v1.2
- Microsoft Web Deploy 3.6
- Browsers: IE 9+, Mozilla Firefox latest, Chrome latest
3.5 Windows Features
4. Top Level Steps
4.1 Create a local Admin User CSFndRuntimeUser and add to SQL Server logins(Roles, SysAdmin)
4.1.1 Search for lusrmgr.msc
4.1.2 Create user CSFndRuntime User and set the password to never expire, user cannot change the password. Click Create!
4.1.3 Note down your password and username for later use.
4.1.4 Now click on groups on right hand side pane.
4.1.5 Double Click Administrator Group.
4.1.6 On the dialog that appears click, Add and choose search for the user CSFndRuntimeUser, now this account is part of Administrator Account.
4.1.7 Add this user to SQL Server as DBA.
- Launch SQL Management Studio as admin to the Database Server of your choice. I Chose SQL Express installed as default instance.
- In the Object Explorer, Drill down to Logins, right click and choose New Logins to add the account CSFndRuntimeUser.
- In the Login Name box, click Search and Enter CSFndRuntime(Ensure, in the location you have selected your pc), click check names, it should find the user and now hit ok.
- Double Click the newly added account under Logins in and from the dialog select Server Roles and choose, sysadmin, serveradmin, public.
4.2 Install ASP.Net Core and related Software.
4.2.1 If you have Visual Studio Installed, you should have ASP.net MVC 4 installed as described in step above else download and install from: https://docs.microsoft.com/en-us/aspnet/mvc/mvc4.
4.2.2 .net 4.6.1 developer pack.
4.2.3 Install ASP.Net Core: Dotnet-dev-win-x22.214.171.124-preview2-003156.exe (Can we upgrade this).
4.2.4 Install Visual Studio Tooling for ASP.Net Core DotNetCore.1.0.1-VS2015Tools.Preview2.0.3.exe.
4.2.5 Install Web Deploy 3.6.
4.2.6 Install HttpPlatform Handler v1.2
4.3 Install Sitecore (Site Name: storefront, hostname: storefront.com).
4.3.1 Use SIM and install Sitecore 8.2 Update 4.
4.3.2 Site Name: storefront.
4.3.3 Hostname: storefront.com.
126.96.36.199 Test storefront.com and storefront.com/Sitecore.
- On Windows 10, Edge will not allow you to view any locally hosted IIS site unless you configure it to. I use google chrome.
188.8.131.52 Change the AppPool Identity of storefront.com to “CSFndRuntimeUser”.
184.108.40.206 Go to IIS AppPool,selectyourapppool, (storefront, in our case, if you have been following)
- Right click, choose advance settings.
- Select Identity and click the elipses.
- Choose Custom Account and click “Set”.
- Set your username and password as shown below.(You may not have sufficient permission to perform this step, if your machine is part of a domain).
- Validate you are able to browse the site by visiting storefront.com and storefront.com/store.
4.4 CreateSelfSigned Certificate and Import in trusted root.
4.4.1 Set-ExecutionPolicy Unrestricted.
4.4.2 Certificate using Powershell: Run Powershell as Administrator and run the command.
4.4.3 New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname *.storefront.local.
4.4.4 Launch IIS, Select the top Node, i.e. the Server Node, in case have many server choose the IIS server of your choice.
4.4.5 Double Click “Server Certificates as shown below.
4.4.6 Double Click the Certificate, we just created.
4.4.7 On Details Page, Click “Copy to File”. Choose, Yes, Export the private key. Select all defaults and keep moving.
4.4.8 On the security page, choose Password and enter any password. (I Use 12345).
4.4.9 For the file Name, Browse to Desktop and enter File Name as “Storefront”.
4.4.10 Finish the Export.
4.4.11 To make the certificate trusted, we need to import the certificates in trusted root repositories.
4.4.12 Double Click on Certificate “Storefront” on your desktop, Choose Local Machine as Store Location.
4.4.13 On the next page, enter the password, you used during export. (12345).
4.4.14 If prompted, on Certificate Store Dialog, Choose “Place all certificates in the following store”, click browse and choose “Trusted Root Certification Authority”
4.4.15 The certificate is installed in your local machine under trusted root.
4.5 Binding of Shop Url (shop.storefront.com)
4.5.1 Launch IIS, Select Storefront Site and click Bindings from Actions.
4.5.2 Add shop.storefront.local on port 80.
4.5.3 Add one https binding and choose the certificate.
4.6 Install Commerce Server
4.6.1 Unzip Sitecore.Commerce.8.2.1_U2_1.2.62.zip
4.6.2 Run the CommerceServer-11.4.xxx.exe installer, located at the root of the Sitecore Commerce release package.
4.6.3 Select Install, and accept the license agreement.
Commerce Server installs, and then the Configuration wizard launches.
4.6.4 Follow the instructions in the Configuration Wizard to configure Commerce Server.
4.6.5 On the Administration Database page, verify the value in the SQL Server field (the default value is the machine name).
- If you are using an SQL named instance, enter the name of your SQL instance. If you are using SQL Express, enter .\SQLExpress or localhost\SQLExpress.
- Click Test to verify the connection to the database.
4.6.6 On the Staging Service page, enter your domain password, then click Next. You are not creating an IIS Virtual Root at this time.
4.7.7 On the Summary page, click Next.
4.6.8 On the final page of the wizard, click Finish. Do not select the Launch Upgrade wizard check box
4.7 House Commerce Server Web Services
4.7.1 Create a folder named C:\inetpub\CSServices\.
4.7.2 In IIS, add a new website named CSServices, with the physical path pointing to the folder that you created in step 1.
4.7.3 Make sure this IIS site listens on port 1004 (to be used at a later stage).
4.7.4 Create a new application pool named "CSServices", and set its identity to the administrator account you are using for the installation (e.g.,.\CSFndRuntimeUser).
4.7.5 Add host file entry 127.0.0.1 CSServices
4.8 Disable the loopback check
4.8.1 Click Start, click Run, type regedit, and then click OK.
4.8.2 In Registry Editor, locate and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
4.8.3 Right-click Lsa, point to New, and then click DWORD Value.
4.8.4 Type DisableLoopbackCheck, and then press ENTER.
4.8.5 Right-click DisableLoopbackCheck, and then click Modify.
4.8.6 In the Value databox, type 1, and then click OK.
4.8.7 Quit Registry Editor, and then restart your computer. (Not Mandatory, unless you feel the registry changes were not applied)
4.9 Install Sitecore Modules
4.9.1 Log on to the Sitecore Desktop (cadminreated during the Sitecore Experience Platform installation).
4.9.2 Browse to Development Tools > Installation Wizard, and follow the steps in the wizard to install the following .zip files, which are located in the Modules folder of the Sitecore Commerce release package:
4.9.3 Sitecore Commerce Connect 10.x.xxx.zip
4.9.5 Adventure Works Images.zip
Note: You must confirm your changes to override the existing items during the installation of the modules and packages described above.
Note: Uploading packages did not work for me so I copy pasted all packages to data/packages folder of Storefront instance.
During the package install, It seems to stuck forever!
I installed using SIM and the packages took almost 40 mins to finish.
4.10 Install Sitecore Packages
4.10.1 Launch the Sitecore Update Installation Wizard (at http://<your site>/sitecore/admin/UpdateInstallationWizard.aspx).
4.10.2 On the main Sitecore Update Installation Wizard page, click Select a package.
4.10.3 On the Select a packagepage, use the Choose folder option to install each of the following update packages (located in the Packages folder of the Sitecore Commerce release root folder):
- Sitecore Commerce Server Connect.10.x.xx.update
- Sitecore Commerce Business Tools Shared.1.x.xx.update
- Sitecore Commerce Merchandising Manager.10.x.xxx.update
- Sitecore Commerce Customer and Order Manager.1.x.xx.update
- Sitecore Commerce Pricing and Promotions Manager.1.x.xx.update
You may get this error on this package installation, ignore an continue to next step.
- You must install the two Reference Storefront packages last, and in the order shown in the list.
- During the Reference Storefront installation, if you see an error message about the initialization of a Commerce Server site, disregard the message, and continue set up.
You must confirm your changes to override the existing configuration when you install the Sitecore update packages.
4.11 Initialize the Commerce Server site
4.11.1 Open a PowerShell window. (If Powershell was already open close and restart as Administrator)
4.11.2 Set the PowerShell script execution policy to unrestricted:
- Set-ExecutionPolicy Unrestricted and select Y.
4.11.3 Navigate to your Sitecore website directory. For example:
- C:\> cd C:\inetpub\wwwroot\Storefront\Website.
4.11.4 Run the Initialize-CSSite command:
- C:\inetpub\wwwroot\Storefront\Website> Initialize-CSSite
4.11.5 Create the Commerce Server Web Services. Make sure the app pool identity for each Web Service is set to “.\CSFndRuntimeUser”.
- Run the following command to create the Commerce Server Catalog Web Service:
- New-CSWebService -Name "CFSolutionStorefrontsite" -Resource Catalog -IISSite "CSServices" -AppPool "CSServices" -Identity 'CSFndRuntimeUser' -Password 'YourPassword'
- Run the following command to create the Commerce Server Profiles Web Service:
- New-CSWebService -Name "CFSolutionStorefrontsite" -Resource Profiles -IISSite "CSServices" -AppPool "CSServices" -Identity 'CSFndRuntimeUser' -Password 'YourPassword'
4.11.6 Configure role-based permissions for each Web Service identity (via the Windows Authorization Store):
- Configure administrator permissions for the Catalog Web Service identity:
- Grant-CSCatalogWebServicePermissions –File "C:\inetpub\csservices\CFSolutionStorefrontsite_CatalogWebService\CatalogAuthorizationStore.xml" -Identity "CSFndRuntimeUser" -Role "Administrator"
- Configure administrator permissions for the Profile Web Service identity:
- Grant-CSProfilesWebServicePermissions –File "C:\inetpub\csservices\CFSolutionStorefrontsite_ProfilesWebService\ProfilesAuthorizationStore.xml" -Identity "CSFndRuntimeUser" -Role "ProfileAdministrator"
You may want to test the webservices installed at the following urls:
4.12 Out of Stock SKU
- Set the inventory subsystem to display out of stock SKUs by running the following command:
- Set-CSSiteResourceProperty -Name "CFSolutionStorefrontSite" –Resource "Inventory" -PropertyName "f_display_oos_skus" -PropertyValue $true
- Ensure you go to CSServices and change the AppPool User to CSFndRuntimeUser
4.13 Update the Commerce Server Profile Schema
- You must generate encryption keys for the CFSolutionStorefrontSite and add them to the Windows registry. To generate encryption keys for the Commerce Server Profile system and update the Profile schema:
- Open a new Commerce Server command prompt window.
- Create encryption keys for the CFSolutionStorefrontSite.
- Run the ProfileKeyManager.exe to generate encryption keys:
- exe /kn /o "c:\profileEncryptionKeys.xml" /f
Note: By default, the ProfileKeyManager.exe file is installed under C:\Program Files (x86)\Commerce Server 11\Tools.
- Add the encryption keys to the Windows registry:
ProfileKeyManager.exe /ke /kf "c:\profileEncryptionKeys.xml" /reg HKEY_LOCAL_MACHINE\SOFTWARE\CommerceServer\Encryption\Keys\CFSolutionStorefrontSite /f
- Public Key:
- Private Key:
Note: You can confirm that the correct registry path is configured in the Website\App_Config\CommerceServer.Core.config file, under the Sitecore folder.
- Update the Commerce Server Profile schema by deploying the Commerce Storefront Profile Database DAC package, using the following command:
a. "C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin\SqlPackage.exe" /Action:Publish /SourceFile:"C:\SitecoreCommerce821\Sitecore.Commerce.8.2.1_U2_1.2.62\Database\Profiles\Commerce.Storefront.ProfileDatabase.dacpac" /TargetDatabaseName:CFSolutionStorefrontSite_profiles /TargetServerName:DESKTOP-7PPG4J
Please ensure you update the source file as per location of your dacpac and the SQL Server Instance name.
You might receive and error: Could not deploy package. Unable to connect to target server.This may be due to the DAC Version as location and type of executable is different. If you are using SQL Server 2012, use 110. For SQL Server 2014 use, 120 and For SQL Server 2016 use 130.
Note: You must delete any existing data inside the Commerce Server Profile databases before deploying the DAC package. Otherwise, the command fails.
Note: Adjust the path to the sqlpackage.exe tool (and the target server) if different from the path shown above.
If you received an error message while installing the Sitecore.Reference.Storefront.Powered.by.SitecoreCommerce.10.0.xxx.update package, reinstall the package.
4.14 Configure Sitecore Shop Site name (In Reference.Storefront.config)
- Choose and configure a subdomain for commerce shop. I chose shop.storefront.com (We will need to update this later in Reference.Storefront.config)
- Update Host file with entry 127.0.0.1 shop.storefront.com.
- Use SIM, From Bundled Tools Menu, choose Host Editor and Click Add and insert the new entry as shown below, click ok to save.
4.15 Deploy the Commerce Engine
To compile the Commerce Engine:
4.15.1 Install the Sitecore Commerce SDK by unzipping the Sitecore.Commerce.SDK.1.x.xxxx.zip file, located at the root of the Sitecore Commerce release package.
4.15.2 Open a command prompt and run the restore command from the SDK root folder:
Note: By default, the dotnet.exe is installed under c:\Program Files\dotnet if the path has not been added automatically.
4.15.3 Run the publish command to create a build of the Sitecore Commerce Engine in a local folder. For example:
dotnet publish .\Sitecore.Commerce.Engine -o c:\Deploy\Sitecore.Commerce
Note: Make sure that the installed version of the .NET Framework is the DevPack/SDK edition, not the Runtime edition. The dotnet publish command will fail if only the Runtime edition is installed.
4.15.4 Create the Commerce Server databases
a. To create the SitecoreCommerce_Global and SitecoreCommerce_SharedEnvironments databases:
1. Open SQL Server Management Studio.
2. Run the CommerceServicesDbScript.sql script (located in the Sitecore SDK directory).
4.15.5 Install the Commerce Engine service
- To install the Commerce Server Engine service:
- Open IIS Manager.
- Create a new Application Pool called CommerceAuthoringand set the following:
- Select No Managed Codefor the .NET CLR Version of the App Pool.
- Select Integratedfor Managed pipeline mode.
- Set the Identity to use the same CSFndRuntimeUser that you used for Commerce Server as the identity.
- Create a new IIS Site called CommerceAuthoring:
- Keep the default binding settings with the exception of the port, which is set to 5000.
- Set the Application Poolto the application pool you created in step 2.
- Create a new folder in C:\inetpub called CommerceAuthoring and set the Physical Pathto this new folder.
- Copy the contents of the c:\Deploy\Sitecore.Commerce folder (created when you compiled the Commerce Server Engine) to the new physical directory you created in step 3.
- Verify that you can retrieve metadata from the Commerce Engine service via the following URL: http://localhost:5000/api/$metadata.
4.16 Configure web payment functionality
- Create a Braintree sandbox account to incorporate web payment functionality into your storefront site.
To create a Braintree sandbox account:
- Go to https://www.braintreepayments.com/sandbox.
- Enter the required information in the Sign up for the sandboxpane, and click Try the sandbox.
- Follow the instructions to activate and log in to your Braintree sandbox account.
Get the MerchantID, Public Key and Private Key information from the Braintree sandbox website.
Use the information from step 4 to fill in the corresponding section inside the PlugIn.Habitat.CommerceAuthoring-1.0.0.json file under the wwwroot\data\Environments folder (in the IIS site folder you created when you installed the Commerce Engine service). For us: C:\inetpub\CommerceAuthoring\wwwroot\data
Search for "$type": "Plugin.Sample.Payments.Braintree.BraintreeClientPolicy, Plugin.Sample.Payments.Braintree"
inside the PlugIn.Habitat.CommerceAuthoring-1.0.0.json file
Make sure the key values are contained by quotation marks. For example:
4.17 Bootstrap and initialize the Commerce Server environment
a. The Bootstrap process loads the environments from the data/environments directory in the physical location of the IIS service to the Commerce Engine service.
b. The Habitat catalogs and inventory (located under wwwroot\data\Catalogs) are imported during the bootstrap process. You can verify that all catalogs and inventory are imported through the Catalog Manager. If they are not present, you must import them manually.
c. Make sure that the application pool identity for the Commerce Authoring site ((.\CSFndRuntimeUser)) has the proper permissions for the Catalog web service in the Windows Authorization Manager.
d. We need to change:
The Commerce Authoring service requires access to the Sitecore instance during the initialization process. Information about the Sitecore instance is located in the CommerceAuthoring\wwwroot\data\Environments\PlugIn.Habitat.CommerceAuthoring-1.0.0.json file, and contains the following default values:
"$type": "Sitecore.Commerce.Plugin.Management.SitecoreConnectionPolicy, Sitecore.Commerce.Plugin.Management"
Note: Before you perform the following steps, review the Default Commerce Engine service settings section. If you have not configured the environment .json files correctly, the process may may fail.
- Open a browser and run http://localhost:5000/commerceops/Bootstrap(). The URL is case-sensitive.
When the Bootstrap process finishes, you can view new rows inside the "CommerceEntities" and "CommerceLists" tables of the SitecoreCommerce_Global database.
If the Bootstrap process does not finish as expected, check the CommerceAuthoring\wwwroot\logs for possible errors.
I went ahead and changed host property in all environment json files.
- Run the Initialize Environment process to initialize the following environments for the Commerce Authoring Service. Note that the following URLs are case-sensitive; if you copy the URLs from this topic, make sure there are no invisible formatting characters for the quotation marks.
- Open http://localhost:5000/commerceops/InitializeEnvironment(environment='AdventureWorksShops')in a browser to initialize the Adventure Works environment.
- Open http://localhost:5000/commerceops/InitializeEnvironment(environment='HabitatAuthoring')in a browser to initialize the Habitat Authoring environment.
- Open http://localhost:5000/commerceops/InitializeEnvironment(environment='HabitatMinions')in a browser to initialize the Habitat Minions environment.
When the Initialize process finishes, you can view new rows inside the "CommerceEntities" and "CommerceLists" tables of theSitecoreCommerce_SharedEnvironments database.
If the Initialize process does not finish as expected, check the CommerceAuthoring\wwwroot\logs for possible errors.
Note: If you need to run the Initialize process again, you must clear all rows of the "CommerceEntities" and "CommerceLists" tables and restart the CommerceAuthoring site to clear the cache.
3. Restart the CommerceAuthoring IIS service to complete activation.
4.18 Final Configurations
Update the Sitecore web.config files.You must update the web.config files with Commerce Server-specific settings.
To update the web.config files:
- Go to the location of the Sitecore site on your hard drive.
- Go to the Website folder and open the web.config file.
- Navigate to the \Website\MergeFiles folder.
- Merge the contents of the Merge.CommerceServer.config file into the web.config file.
- Merge the contents of Merge.Commerce.Storefront.config file into the web.config file.
- Save your changes to the web.config file.
- Navigate to the Website\Views folder.
- Open the Web.config file.
- Navigate to the \Website\MergeFiles\Views\ folder.
- Merge the contents of the Merge.web.config file into the Web.config file.
- Save your changes to the Web.config file.
Configure basic settings in the sample Storefront site. You can set basic parameters for your sample site in the Sitecore Content Editor.
- Log in to the Sitecore desktop athttp://shop.storefront.com/sitecore/login and open the Content Editor.
- Navigate to /sitecore/Sitecore Commerce/Catalog Management/Catalogsand ensure that the Habitat_Master option is checked in the Selected Catalogssection (under Commerce).
- Optionally, navigate to the Countries/Regions window in the Commerce Control Panel (/sitecore/Sitecore Commerce/Commerce Control Panel/Shared Settings/Countries-Regions) and add new entries for Countries/Regions, States/Provinces codes you want to support on the site. Sitecore Commerce uses these codes to populate address information on the sample site.
- Fixing the issue with invalid Image and Category Datasource
- In item /sitecore/Commerce/Catalog Management/Catalogs, ensure selected catalog has Habitat as selected catalog
- In item /sitecore/content/Storefront/Home, Remove the broken link and choose Habitat
- In item /sitecore/content/Storefront/Home, For fields Product Images, Category Images, and Default Images(Yes for all 3 fields) set the data source to sitecore/media library/Images/Habitat.
- In item /sitecore/content/Storefront/Home/Product catalog, For field Category DataSource select /sitecore/Commerce/Catalog Management/Catalogs/Habitat Catalog/Departmentsin the field CategoryDatasource .
Publish the sample Storefront site
In the Sitecore Content Editor, on the Publish tab, click the Publish drop-down arrow and then click Publish Site.
- In the Sitecore Content Editor, select the Publish tab.
- Click the Publish drop-down arrow and select Publish Site from the drop-down menu.
- Follow the instructions in the Publish Wizard to publish your site.
Note: You may need to increase DefaultSQLTimeout in Sitecore.config as the process takes longer to Publish it.
Reindex the Sitecore and Commerce Server indexes
After publishing your website, you must rebuild the main Sitecore and Commerce Server search indexes.
To rebuild the indexes:
- On the Sitecore Launchpad, click Control Panel.
- In the Indexingsection of the Control Panel, click Indexing manager.
- In the Indexing Managerdialog box, select the following indexes:
- Click Rebuild.
The order page takes status code: NY
- Payment Credit card information to be taken from https://developers.braintreepayments.com/guides/credit-cards/testing-go-live/php