Thursday, April 2, 2020


                  Execute Sitecore Commerce API calls in Postman

      1. Download and Install Postman tool
                         https://www.postman.com/downloads/
      2. Open Postman Tool
      3. Click Import button


      4. Navigate to the folder

               C:\deploy\Sitecore.Commerce.Engine.SDK.2.2.72\postman

                Note: This is the folder is used to setup commerce environment for                    your local. so the path can be different in your local.


                 Select Folder

       5. You can see the collections imported into your postman tool

       6. Select Environment


      7. Get Token


      8. You can perform several API call. Below are some example.

                 Bootstrap Sitecore Commerce
                Clean Environment
                Initialize Environment
                Check Long Running Command Status
                Environments
                Catalogs
                 Import Catalogs (with publishing)
                 Clear cache store



Saturday, December 28, 2019

Install and Setup Sitecore Rocks


                                        Install and Setup Sitecore Rocks

Install Sitecore Rocks:

1.      Open Visual Studio as Admin, Navigate to Tools à Extensions and Updates.

2.      Extensions and Updates Window go to Online, Search for Sitecore Rocks, Click Download.



3.      Click Install


4.      Restart Visual Studio



Setup Sitecore Rocks:

1.      Open Visual Studio, go to Sitecore à Click Sitecore Explorer


2.      Right Click Connections

3.      Enter Host Name, Location of your Website, User Name, Password of your sitecore instance

4.      Click Yes in Information Dialog Box
5.      Update Server Components, Click Update All.
6.      Expand your Connections in Sitecore Explorer, Expand your Website.


Monday, November 18, 2019

How to install Sitecore Package Faster

installing large Sitecore package can create a problem sometimes. so follow these below steps to make it faster(recommended in Development and Test VM's).

1. \App_Config\Sitecore\ContentSearch\
2. Open Sitecore.ContentSearch.config
3. Disable by commenting the ContentSearch event handler in "packageinstall:items:ended"


<event name="packageinstall:items:ended">
        <handler type="Sitecore.ContentSearch.Events.PackagingEventHandler, Sitecore.ContentSearch" method="OnPackageInstallItemsEndHandler" />
      </event>

<event name="packageinstall:items:ended:remote">
        <handler type="Sitecore.ContentSearch.Events.PackagingEventHandler, Sitecore.ContentSearch" method="OnPackageInstallItemsEndHandler" />
      </event>

4. Install the Package.
5. Index content.
6. Rollback the config back to its original.

Wednesday, July 24, 2019

Uninstalling Sitecore eCommerce

1. Restart your system.
2.Copy and save the below script as "uninstall-commerce-sitecore.ps1"

#define parameters
Param(
[string]$Prefix = 'XXXX',
[string]$CommerceOpsSiteName = 'CommerceOps_Sc9',
[string]$CommerceShopsSiteName = 'CommerceShops_Sc9',
[string]$CommerceAuthoringSiteName = 'CommerceAuthoring_Sc9',
[string]$CommerceMinionsSiteName = 'CommerceMinions_Sc9',
[string]$SitecoreBizFxSiteName = 'SitecoreBizFx',
[string]$SitecoreIdentityServerSiteName = 'SitecoreIdentityServer',
[string]$SolrService = 'Solr',
[string]$PathToSolr = 'C:\Solr\Solr-6.6.2',
[string]$SqlServer = 'XXXXXXX',
[string]$SqlAccount = 'sa',
[string]$SqlPassword = 'XXXXXXX'
)
#Write-TaskHeader function modified from SIF
Function Write-TaskHeader {
    param(
        [Parameter(Mandatory=$true)]
        [string]$TaskName,
        [Parameter(Mandatory=$true)]
        [string]$TaskType
    )

    function StringFormat {
        param(
            [int]$length,
            [string]$value,
            [string]$prefix = '',
            [string]$postfix = '',
            [switch]$padright
        )

        # wraps string in spaces so we reduce length by two
        $length = $length - 2 #- $postfix.Length - $prefix.Length
        if($value.Length -gt $length){
            # Reduce to length - 4 for elipsis
            $value = $value.Substring(0, $length - 4) + '...'
        }

        $value = " $value "
        if($padright){
            $value = $value.PadRight($length, '*')
        } else {
            $value = $value.PadLeft($length, '*')
        }

        return $prefix + $value + $postfix
    }

    $actualWidth = (Get-Host).UI.RawUI.BufferSize.Width
    $width = $actualWidth - ($actualWidth % 2)
    $half = $width / 2

    $leftString = StringFormat -length $half -value $TaskName -prefix '[' -postfix ':'
    $rightString = StringFormat -length $half -value $TaskType -postfix ']' -padright

    $message = ($leftString + $rightString)
    Write-Host ''
    Write-Host $message -ForegroundColor 'Red'
}

Function Remove-Service{
[CmdletBinding()]
param(
[string]$serviceName
)
if(Get-Service "My Service" -ErrorAction SilentlyContinue){
sc.exe delete $serviceName
}
}

Function Remove-Website{
[CmdletBinding()]
param(
[string]$siteName
)

$appCmd = "C:\windows\system32\inetsrv\appcmd.exe"
& $appCmd delete site $siteName
}

Function Remove-AppPool{
[CmdletBinding()]
param(
[string]$appPoolName
)

$appCmd = "C:\windows\system32\inetsrv\appcmd.exe"
& $appCmd delete apppool $appPoolName
}

#Stop Solr Service
Write-TaskHeader -TaskName "Solr Services" -TaskType "Stop"
Write-Host "Stopping solr service"
Stop-Service $SolrService -Force -ErrorAction stop
Write-Host "Solr service stopped successfully"

#Delete solr cores
Write-TaskHeader -TaskName "Solr Services" -TaskType "Delete Cores"
Write-Host "Deleting Solr Cores"
$pathToCores = "$pathToSolr\server\solr\$Prefix*"
Remove-Item $pathToCores -recurse -force -ErrorAction stop
Write-Host "Solr Cores deleted successfully"

#Remove Sites and App Pools from IIS
Write-TaskHeader -TaskName "Internet Information Services" -TaskType "Remove Websites"


Write-Host "Deleting Website $CommerceOpsSiteName"
Remove-Website -siteName $CommerceOpsSiteName -ErrorAction stop
Write-Host "Websites deleted"

Write-Host "Deleting Website $CommerceShopsSiteName"
Remove-Website -siteName $CommerceShopsSiteName -ErrorAction stop
Write-Host "Websites deleted"

Write-Host "Deleting Website $CommerceAuthoringSiteName"
Remove-Website -siteName $CommerceAuthoringSiteName -ErrorAction stop
Write-Host "Websites deleted"

Write-Host "Deleting Website $CommerceMinionsSiteName "
Remove-Website -siteName $CommerceMinionsSiteName  -ErrorAction stop
Write-Host "Websites deleted"

Write-Host "Deleting Website $SitecoreBizFxSiteName"
Remove-Website -siteName $SitecoreBizFxSiteName -ErrorAction stop
Write-Host "Websites deleted"

Write-Host "Deleting Website $SitecoreIdentityServerSiteName"
Remove-Website -siteName $SitecoreIdentityServerSiteName -ErrorAction stop
Write-Host "Websites deleted"



Remove-AppPool -appPoolName $CommerceOpsSiteName -ErrorAction stop
Write-Host "Application pools deleted"
Remove-AppPool -appPoolName $CommerceShopsSiteName -ErrorAction stop
Write-Host "Application pools deleted"
Remove-AppPool -appPoolName $CommerceAuthoringSiteName -ErrorAction stop
Write-Host "Application pools deleted"
Remove-AppPool -appPoolName $CommerceMinionsSiteName -ErrorAction stop
Write-Host "Application pools deleted"
Remove-AppPool -appPoolName $SitecoreBizFxSiteName -ErrorAction stop
Write-Host "Application pools deleted"
Remove-AppPool -appPoolName $SitecoreIdentityServerSiteName -ErrorAction stop


Remove-Item C:\inetpub\wwwroot\$CommerceOpsSiteName -recurse -force -ErrorAction stop
Write-Host "Websites removed from wwwroot"
Remove-Item C:\inetpub\wwwroot\$CommerceShopsSiteName -recurse -force -ErrorAction stop
Write-Host "Websites removed from wwwroot"
Remove-Item C:\inetpub\wwwroot\$CommerceAuthoringSiteName -recurse -force -ErrorAction stop
Write-Host "Websites removed from wwwroot"
Remove-Item C:\inetpub\wwwroot\$CommerceMinionsSiteName -recurse -force -ErrorAction stop
Write-Host "Websites removed from wwwroot"
Remove-Item C:\inetpub\wwwroot\$SitecoreBizFxSiteName -recurse -force -ErrorAction stop
Write-Host "Websites removed from wwwroot"
Remove-Item C:\inetpub\wwwroot\$SitecoreIdentityServerSiteName -recurse -force -ErrorAction stop
Write-Host "Websites removed from wwwroot"


Write-TaskHeader -TaskName "SQL Server" -TaskType "Drop Databases"
#Drop databases from SQL
Write-Host "Dropping databases from SQL server"
push-location
import-module sqlps

Write-Host $("Dropping database SitecoreCommerce9_Global")
$commerceDbPrefix = $("DROP DATABASE IF EXISTS [SitecoreCommerce9_Global]")
Write-Host $("Query: $($commerceDbPrefix)")
invoke-sqlcmd -ServerInstance $SqlServer -U $SqlAccount -P $SqlPassword -Query $commerceDbPrefix -ErrorAction stop

Write-Host $("Dropping database [SitecoreCommerce9_SharedEnvironments]")
$sharedDbPrefix = $("DROP DATABASE IF EXISTS [SitecoreCommerce9_SharedEnvironments]")
Write-Host $("Query: $($sharedDbPrefix)")
invoke-sqlcmd -ServerInstance $SqlServer -U $SqlAccount -P $SqlPassword -Query $sharedDbPrefix -ErrorAction stop


Write-Host "Databases dropped successfully"
pop-location

3. Change the Parameter values

[string]$Prefix = 'XXXX',
[string]$CommerceOpsSiteName = 'CommerceOps_Sc9',
[string]$CommerceShopsSiteName = 'CommerceShops_Sc9',
[string]$CommerceAuthoringSiteName = 'CommerceAuthoring_Sc9',
[string]$CommerceMinionsSiteName = 'CommerceMinions_Sc9',
[string]$SitecoreBizFxSiteName = 'SitecoreBizFx',
[string]$SitecoreIdentityServerSiteName = 'SitecoreIdentityServer',
[string]$SolrService = 'Solr',
[string]$PathToSolr = 'C:\Solr\Solr-6.6.2',
[string]$SqlServer = 'XXXXXXX',
[string]$SqlAccount = 'sa',
[string]$SqlPassword = 'XXXXXXX'

4. Save and Close the power shell script.
5. Run power shell as administrator.
6. navigate to the path of uninstall script.
7. run the uninstallation script.

Saturday, February 23, 2019

Installing Solr

Installing Solr:

• .Net Framework 4.6
• Web Deploy  - https://www.microsoft.com/en-us/download/details.aspx?id=43717
• SOLR 6.6.2 - http://archive.apache.org/dist/lucene/solr/6.6.1/solr-6.6.2.zip
• Java 8
• Non-Sucking Service Manager NSSM - https://nssm.cc/download

1. install the ones below if not yet
• Web Deploy
• Java 8.0
• Set the Java_Home Variable
2. create a new folder C:\Sitecore\Install
3. install SOLR 6.6.2
• copy the solr-6.6.2.zip to C:\Sitecore
• Extract the Zip
• Run Command Prompt as administrator

• Check solr working or not by using http://localhost:8983/


4. Now SOLR 6.6.2 run as a window service
• download NSSM and install it
• Extract to C:\Sitecore
• Run Command Prompt as administrator


• Check whether Solr_6.6.2 window service is running


5. set up HTTPS for SOLR 6.6.2
• download this PowerShell file solrssl.ps1 and put it into C:\Sitecore\Install\
• update the key tool path to your local path in solrssl.ps1 file



• Run Windows PowerShell as administrator


• in case if you got the error, open Windows PowerShell (run as administrator)
• Set-ExecutionPolicy -Scope CurrentUser Unrestricted

• Remove Comment from these 4 lines in solr.in.cmd file(C:\sitecore\solr-6.6.2\bin).

• Restart Solr_6.6.2 service
• open a browser, navigate to https://localhost:8983/


Monday, November 26, 2018

Setup Visual Studio Project For Sitecore


Visual Studio solution for Sitecore 9

 

1.      Create a new a new web project,

 

 

 

 

Enter the Name

Location

Solution name

 

 

2.      Select ‘Empty’ ASP.NET Template

Click on ‘MVC’ Check box

Click on OK

 

 

3.      Delete the Global.asax file

Delete the Web.Config file

 

4.      Go to your Sitecore IIS Project. Follow this link https://sitecore4u.blogspot.com/2018/09/sitecore-9-update-2-installation.html, if you are not having Sitecore project in IIS.

 

 

 

Copy Global.asax, Web.Config files and paste in your Visual Studio Project.

 

 

 

5.      Add Nuget package solution for sitecore

 

 

 

 

NuGet V3 feed URL (Visual Studio 2015+)

https://sitecore.myget.org/F/sc-packages/api/v3/index.js

 

6.      Tools -> NuGet Package Manager -> Manage NuGet Packages for Solutions

 

Sitecore.Kernel

Sitecore.Mvc

Sitecore.Mvc.Analytics

 

Click Install

 

7.      Now your project is ready.

 

To set up the publishing deployment, in the Create Publish Settings dropdown in the Visual Studio toolbar, select <New Custom Profile>

In the Publish Web dialog, in the Publish method field, click File System, and in the Target location field, browse to the Website folder of your Sitecore instance, and then click Publish.

 

 


Installing Sitecore eCommerce

                             Installing Sitecore eCommerce

PREREQUISITES:

1.      Download and Install .NET Core 2.1.4 from the below link.

2.      Download and Install .NET Core Windows Server Hosting 2.0.0 from the below link.

3.      Download(Just Download Don’t Install) Sitecore PowerShell Extensions 4.7.2 from the below link




4.      Download(Just Download Don’t Install) Sitecore Experience Accelerator 1.7.1 from the below link

5.      Download(Just Download Don’t Install) the Sitecore XC Update 2 release package from the below link

6.      Create Folders
c:\Sitecore\Deploy
c:\Sitecore\Deploy\assets

7.      Copy
Sitecore PowerShell Extensions 4.7.2
Sitecore Experience Accelerator 1.7.1
To
c:\Sitecore\Deploy\assets

8.       
8.1   Copy
Sitecore XC Update 2 ZIP file
To
c:\Sitecore\Deploy

8.2   Extract
Sitecore XC Update 2 ZIP file
To
c:\Sitecore\Deploy

8.3   Delete
“Sitecore XC Update 2” ZIP file

9.       
9.1    
Extract Below ZIP files
From c:\Sitecore\Deploy

SIF.Sitecore.Commerce.1.2.14.zip
Sitecore.Commerce.Engine.SDK.2.2.72.zip
Sitecore.BizFX.1.2.19.zip

To Same folder (c:\Sitecore\Deploy)

9.2    
      Delete Below ZIP files
From c:\Sitecore\Deploy

SIF.Sitecore.Commerce.1.2.14.zip
Sitecore.Commerce.Engine.SDK.2.2.72.zip
     Sitecore.BizFX.1.2.19.zip

10.  Download MS Build Microsoft Visual Studio Web targets from the below link

10.1             
a)      Change extension of downloaded file from “nupkg” to “zip”
b)     extract zip file
c)      open extracted folder and navigate to
msbuild.microsoft.visualstudio.web.targets.14.0.0.3 -> tools -> VSToolsPath -> Web
d)     Copy “Microsoft.Web.XmlTransform.dll” file into “c:\sitecore\deploy\assets”.

11.   
Copy file “Sitecore.Commerce.Engine.DB.dacpac” from “C:\Sitecore\deploy\Sitecore.Commerce.Engine.SDK.2.2.72” into “C:\sitecore\deploy\assets”
Unzip “C:\sitecore\deploy\Sitecore.Commerce.Engine.2.2.126.zip” into “C:\sitecore\deploy\Sitecore.Commerce.Engine.2.2.126” folder and open “C:\sitecore\deploy\Sitecore.Commerce.Engine.2.2.126\wwwroot\bootstrap\Global.json” file.
a)      Set the “Database” value under “SourceStoreSqlPolicy” to “SitecoreCommerce9_Global”
b)      Set the “Server” value under “SourceStoreSqlPolicy” to “.”
c)      Zip the folder “C:\deploy\Sitecore.Commerce.Engine.2.2.126” as “C:\deploy\Sitecore.Commerce.Engine.2.2.126.zip” file overwriting the existing file “C:\deploy\Sitecore.Commerce.Engine.2.2.126.zip”.
d)      Remove “C:\deploy\Sitecore.Commerce.Engine.2.2.126” folder afterwards

CERTIFICATE FOR SITECORE COMMERCE ENGINE CONNECT:

We create this certificate for Commerce Engine to authenticate with Sitecore XC Engine.
1.      Open PowerShell as Admin
2.      Run the following command

New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname “sc902.engineconnect”

Copy and Save the Thumbprint in notepad.
3.      Export certificate by running the following command

Export-Certificate -Cert cert:\localMachine\my\{Thumbprint} -FilePath ‘C:\sitecore\deploy\assets\sc902.engineconnect.cer’

Replace {Thumbprint} with your generated Thumbprint value from above step.

INSTALLATION:

1.      Check whether you have all your necessary files placed in your deploy(c:\sitecore\deploy) folder
And assets(c:\sitecore\deploy\assets) folder

Pic 1.
Pic 2.





2.      Check your Sitecore Instance

2.1             Rebuild link databases(core, master)


2.2             Rebuild search index




2.3             Sitecore PowerShell Extensions 4.7.2


2.4             Install “Sitecore Experience Accelerator 1.7.1 rev. 180604 for 9.0” package



After Successful installation.

Go to
Sitecore Control Panel -> Indexing Manager -> Select the Below 2 Indexes and Click Rebuild





3.      Running Deploy Script

Copy the Script from this https://gitlab.com/viet.hoang/workshop/blob/master/Scripts%20for%20Sitecore%20Commerce%20902/sc9_com_install.ps1 link, Create a Powel Shell Script “Deploy-Sitecore-Commerce.ps1” file, Save it into c:\sitecore\deploy\SIF.Sitecore.Commerce.1.2.14

               Open PowerShell in Administration mode, run the script.