Skip to content

Instantly share code, notes, and snippets.

@naveed-ahmad-biz
naveed-ahmad-biz / PLAY! Shop Product Feed - Sample
Last active July 30, 2023 11:00
PLAY! Shop Product Feed - Sample
"Items": [
{
"PriceSchedule": {
"OwnerID": "cbca442c-6fbe-47db-af35-9351b029b437",
"ID": "PSPOTG10CSWSB",
"Name": "10-Club Set With a Stand Bag",
"ApplyTax": false,
"ApplyShipping": false,
"MinQuantity": 1,
"MaxQuantity": null,
@naveed-ahmad-biz
naveed-ahmad-biz / install-commerce-9up1.ps1
Created March 22, 2018 20:57
Sitecore Experience Commerce 9 update 1 - Working Script
#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 March 22, 2018 20:53
Create Sitecore Experience Commerce Certificate and add it to your trusted root
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 February 20, 2018 00:43
Get Token From Sitecore.IdentityServer
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:
@naveed-ahmad-biz
naveed-ahmad-biz / install-commerce.ps1
Last active February 20, 2018 00:29
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" )
@naveed-ahmad-biz
naveed-ahmad-biz / uninstall-sc9.ps1
Created February 19, 2018 23:54
Uninstall SC 9
#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'
)
@naveed-ahmad-biz
naveed-ahmad-biz / uninstall-commerce.ps1
Last active February 20, 2018 16:03
Uninstall XC9 Commerce
#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',
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
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);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FileHelpers;
namespace MyProject
{
[DelimitedRecord(",")]