Skip to content

Instantly share code, notes, and snippets.

naveed-ahmad-biz

Block or report user

Report or block naveed-ahmad-biz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@naveed-ahmad-biz
naveed-ahmad-biz / install-commerce-9up1.ps1
Created Mar 22, 2018
Sitecore Experience Commerce 9 update 1 - Working Script
View install-commerce-9up1.ps1
#Requires -Version 3
param(
[string]$SiteName = "xp0.sc",
[string]$SiteHostHeaderName = "sxa.storefront.com",
[string]$SqlDbPrefix = "xp0",
[string]$CommerceSearchProvider = "SOLR"
)
$global:DEPLOYMENT_DIRECTORY=Split-Path $MyInvocation.MyCommand.Path
$modulesPath=( Join-Path -Path $DEPLOYMENT_DIRECTORY -ChildPath "Modules" )
@naveed-ahmad-biz
naveed-ahmad-biz / xc9-certificate.ps1
Created Mar 22, 2018
Create Sitecore Experience Commerce Certificate and add it to your trusted root
View xc9-certificate.ps1
New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname "sxa.storefront.com"
Export-Certificate -Cert cert:\localMachine\my\<thumbprint> -FilePath sxa.storefront.cer
Set-Location -Path cert:\CurrentUser\My
Import-Certificate -Filepath "C:\deploy\assets\sxa.storefront.com.cer"
@naveed-ahmad-biz
naveed-ahmad-biz / get-token-error.txt
Last active Feb 20, 2018
Get Token From Sitecore.IdentityServer
View get-token-error.txt
PS>TerminatingError(Invoke-RestMethod): " IIS 502.5 Error HTTP Error 502.5 - Process Failure Common causes of this issue: The application process failed to start The application process started but then stopped The application process started but failed to listen on the configured port Troubleshooting steps: Check the system event log for error messages Enable logging the application process' stdout messages Attach a debugger to the application process and inspect For more information visit: https://go.microsoft.com/fwlink/?LinkID=808681 "
>> TerminatingError(Invoke-RestMethod): " IIS 502.5 Error HTTP Error 502.5 - Process Failure Common causes of this issue:
View install-commerce.ps1
#Requires -Version 3
param(
[string]$SiteName = "sitecore901.sc",
[string]$SiteHostHeaderName = "sitecore901.commerce",
[string]$SqlDbPrefix = "sitecore901",
[string]$CommerceSearchProvider = "SOLR"
)
$global:DEPLOYMENT_DIRECTORY=Split-Path $MyInvocation.MyCommand.Path
$modulesPath=( Join-Path -Path $DEPLOYMENT_DIRECTORY -ChildPath "Modules" )
View uninstall-sc9.ps1
#define parameters
Param(
[string]$Prefix = 'sitecore901',
[string]$SitecoreSiteName = 'sitecore901.sc',
[string]$SolrService = 'Solr-6.6.2',
[string]$PathToSolr = 'C:\Solr\Solr-6.6.2',
[string]$SqlServer = 'DESKTOP\SQLEXPRESS',
[string]$SqlAccount = 'sa',
[string]$SqlPassword = 'mysupersecretpassword'
)
View uninstall-commerce.ps1
#define parameters
Param(
[string]$Prefix = 'sitecore901',
[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-6.6.2',
View WriteCsvFile.cs
private void WriteCSVFile(List<SomeDataSource> dataSource)
{
try
{
//filehelper object
FileHelperEngine engine = new FileHelperEngine(typeof(MyProdcuts));
//csv object
List<MyProduct> csv = new List<MyProduct>();
//convert any datasource to csv based object
View ReadCsvFile.cs
private void ReadCSVFile(string fileName)
{
try
{
//file location, better to get it from configuration
string fileName = "C:\\temp\\MyProducts.csv";
//create a CSV engine using FileHelpers for your CSV file
var engine = new FileHelperEngine(typeof(MyProduct));
//read the CSV file into your object Arrary
var products = (MyProduct[])engine.ReadFile(fileName);
View MyProduct.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FileHelpers;
namespace MyProject
{
[DelimitedRecord(",")]
View NormalizePostcode.cs
public static string NormalizePostcode(string postcode)
{
//removes end and start spaces
postcode = postcode.Trim();
//removes in middle spaces
postcode = postcode.Replace(" ", "");
switch (postcode.Length) {
//add space after 2 characters if length is 5
case 5: temp_postcode = temp_postcode.Insert(2, " "); break;
You can’t perform that action at this time.