commerce · deployment · installation

Sitecore XC 9.0.2 Demo – Habitat Home Commerce – Step by step Setup Guide

You’re a Sitecore developer and want to know how to implement the website(s) using Sitecore Experience Accelerator 1.7 Update 1 (aka SXA 1.7.1) on Sitecore Experience Platform 9 Update 2 (aka Sitecore XP 9.0.2) + Sitecore Experience Commerce 9 Update 2 (aka Sitecore XC 9.0.2) and following Helix principles.

If that is the case, you should set up Sitecore demo – Habitat Home Commerce – on your machine so that you’re able to play around with the Sitecore solution example and then learn something.

Personally, I’ve wanted to deal with the case: how to set up multi-instance Sitecore XC 9.0.2 so that I’m able to play with the vanilla XC 9.0.2 instance and this demo of XC 9.0.2 as well on my own machine.

Setup Preresiquites

Step-by-step Guide

  1. install a fresh Sitecore Commerce 9.0 Update 2
    • Note 1: Sitecore instance name should be habitathome.local and certificate for the Sitecore Commerce Engine should be issued to habitathome.local as well in this installation guide
    • Note 2: you should consider to give this installation guide a shot when you have an existing instance of XC 9.0.X (X = 0, 1, 2) on your machine so that you don’t have to uninstall it before setting up this demo
  2. deploy Habitat Home Platform to Sitecore instance habitathome.local
  3. download or clone the git repo from Habitat Home Commerce 9.0.2.2
  4. restore all Node.js modules
    • run command line as Administrator
    • change directory to Habitat Home Commerce directory
    • execute npm install
    • ghhc_4.png
  5. Note: I don’t want to use the default settings so I need to adjust the appropriate values in the following files:
    • \gulp-config.js
      • hhc_11
    • \publishsettings.targets
      • hhc_10
    • \src\Project\HabitatHome\website\App_Config\Include\Project\z.HabitatHome.Commerce.Website.DevSettings.config
      • hhc902_2
    • \deploy-commerce-engine.ps1
      • hh902_6.png
    • \src\Project\HabitatHome\engine\wwwroot\bootstrap\Global.json
      • hhc902_8
    • \src\Project\HabitatHome\engine\wwwroot\data\Environments\Plugin.SQL.PolicySet-1.0.0.json
      • hhc902_9.png
  6. Note: if you use the custom Service Ports rather than the default ones, you will have to correct them in various places
    • open Visual Studio
    • correct all the Service Ports one by one 😀
    • find all localhost: in the entire solution
    • hhc902_5
    • find all //{0}: in the entire solution
    • hhc902_7.png
    • find all SslPort in the entire solution
    • hhc902_10.png
  7. open \HabitatHome.Commerce.sln with Visual Studio 2017
  8. deploy the solution
    • open Task Runner Explorer on View -> Other Window -> Task Runner Explorer
    • ghh_7
    • choose Solution ‘HabitatHome.Commerce’ from list, then click refresh button
    • from task list, double click on initial task to run it
    • ghhc_5
    • Note: for Visual Studio 2017 on your own machine, you might have to run gulp tasks via Command Prompt (run as Administrator)
  9. hopefully everything runs well and then you would see something like this
    • ghhc_6
  10. deploy the engine
    • launch PowerShell as an administrator
    • change directory to Habitat Home Commerce directory
    • execute .\deploy-commerce-engine.ps1 -Boostrap -Initialize
    • ghhc_7.png
    • hopefully everything runs well and then you would see something like this
    • ghhc_8
  11. open a browser and then navigate to https://habitathome.local, you would see something like this after adding some products to cart successfully
    • hhc902_11.png

 

Note: some known issues

  1. Visual Studio’s Task Runner: SyntaxError: Unexpected token
  2. Invoke-RestMethod: The remote server returned an error: (500) Internal Server Error
    • hhc_6
    • open the log file you would see something like this
    • ERROR Connection id “”0HLE4OSSCC354″”, Request id “”0HLE4OSSCC354:00000001″”: An unhandled exception was thrown by the application.Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The required antiforgery cookie “.AspNetCore.Antiforgery.cf4m-F-R1lY” is not present.

    • my suggestion: ensure the engine suffix correct in deploy-commerce-engine.ps1 and then perform Step 10 again
  3. Cleaning Environments:  HTTP Error 502.5
    • hhc_12
    • open Windows Event Viewer, you should see something like this
    • ghhc_13
    • my suggestions: probably ASP.NET Core module was not installed correctly on your machine, you should try to install the latest version of .NET Core 2.0 (Runtime) and then perform Step 10 again
  4. Empty strings are not allowed. Parameter name: value
    • ghhc_11
    • my suggestion:
      • log into https://habitathome.local/sitecore
      • hit Refresh Commerce Cache in the COMMERCE tab of Content Editor
      • ghhc_9
      • access /sitecore/Commerce/Commerce Control Panel/Storefront Settings/Storefronts/HabitatHome/Catalog Configuration
      • update Catalog to Habitat Master then save
      • ghhc_12
  5. Guid should contain 32 digits with 4 dashes
    • ghhc_15
    • my suggestion:
      • log into https://habitathome.local/sitecore
      • make sure that Solr is running properly by rebuilding the search indexes in the Sitecore client (Control Panel =Indexing Manager) if not yet
        • select the checkbox sitecore_master_index and then click Rebuild button
      • hit Refresh Commerce Cache in the COMMERCE tab of Content Editor
      • ghhc_9

 

Got issues?

Please send your issues (with screenshots if possible) to viet.hoang.sitecore@gmail.com so that I have a chance to understand your problem and be able to suggest the solution.

Happy Sitecore Demo Installation!

3 thoughts on “Sitecore XC 9.0.2 Demo – Habitat Home Commerce – Step by step Setup Guide

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.