Skip to content

Instantly share code, notes, and snippets.

View tackme31's full-sized avatar

tackme tackme31

View GitHub Profile
@tackme31
tackme31 / Sitecore.ContentSearch.Solr.CoreNames.config
Created November 14, 2019 04:07
A patch file for changing Solr's core name in the configuration.
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:search="http://www.sitecore.net/xmlconfig/search/">
<sitecore role:require="Standalone or ContentManagement or ContentDelivery" search:require="Solr">
<!-- Set your prefix of Solr's core. -->
<sc.variable name="SolrCorePrefix" value="prefix.of.core" />
<contentSearch>
<configuration>
<indexes>
<index id="sitecore_core_index">
<param desc="core">$(SolrCorePrefix)_core_index</param>
@tackme31
tackme31 / setup-commerce-sdk.ps1
Last active December 27, 2019 02:38
PowerShell script to create a Commerce Engine solution from SDK. (tested only on Sitecore Commerce 9.2)
<#
.SYNOPSIS
PowerShell script to create a Commerce Engine solution from SDK. (tested only on Sitecore Commerce 9.2)
.EXAMPLE
PS> .\setup-commerce-sdk.ps1 authoring.site.name \path\to\Sitecore.Commerce.Engine.SDK.4.0.102.zip
PS> dotnet run -p .\Sitecore.Commerce.Engine.SDK\src\Sitecore.Commerce.Engine\Sitecore.Commerce.Engine.csproj
.PARAMETER AuthoringSiteName
Name of your Commerce Authoring website in IIS.
@tackme31
tackme31 / UnpublishedPages.ps1
Created December 9, 2019 05:43 — forked from hombreDelPez/UnpublishedPages.ps1
Sitecore PowerShell script to list all unpublished pages
<#
.SYNOPSIS
Lists the pages which are not published yet (in the current version or any version at all).
.NOTES
Manuel Fischer
#>
function Get-AllUnpublishedPages {
Get-ChildItem -Path $homeFolder -Recurse | IsPage | IsPublished
@tackme31
tackme31 / scaffold-route.js
Last active February 24, 2020 11:04
An npm script to generating a new route manifest for Sitecore JSS. See usage.md below.
/*
Route Scaffolding Script
This is a script that enables scaffolding a new JSS route using `jss scaffold:route <RouteName>`.
Edit this script if you wish to use your own conventions for route storage in your JSS app.
*/
/* eslint-disable no-throw-literal,no-console */
const fs = require('fs');
const path = require('path');
function Get-FormData($formId, $startDate, $endDate) {
$provider = [Sitecore.DependencyInjection.ServiceLocator]::ServiceProvider.GetService([Sitecore.ExperienceForms.Data.IFormDataProvider])
$entries = $provider.GetEntries($formId.Guid, $startDate, $endDate)
if (-not $entries) {
return $null
}
# Get all column title
$titles = new-object System.Collections.Generic.HashSet[string]
$entries | % { $_.Fields | % { $titles.Add($_.FieldName) > $null } }
@tackme31
tackme31 / example.js
Created April 23, 2020 00:21
Download a file asynchronously with JavaScript
var url = 'https://sitecorecdn.azureedge.net/-/media/sitecoresite/images/global/logo/sitecore-logo.svg';
download(url);
// => sitecore-logo.svg will be downloaded.
var filename = 'logo.svg';
download(url, filename);
// => 'logo.svg' will be downloaded.
@tackme31
tackme31 / parent-category-list.sql
Created July 1, 2020 06:32
SQL query to check the ParentCategoryList property of a SellableItem entity.
USE [Commerce_SharedEnvironments]
SELECT
Id,
EntityVersion,
JSON_VALUE(Entity, '$.ParentCategoryList') AS ParentCategoryList
FROM
sitecore_commerce_storage.CatalogEntities AS CatalogEntities
INNER JOIN sitecore_commerce_storage.CatalogEntity AS CatalogEntity
ON CatalogEntities.UniqueId = CatalogEntity.UniqueId
@tackme31
tackme31 / Invoke-DeployProjects.ps1
Last active June 30, 2021 10:03
A PowerShell script to deploy multiple projects in a VidualStudio solution.
param (
[Parameter(Mandatory=$false)]
[string]
$Profile = "FolderProfile",
[Parameter(Mandatory=$false)]
[string]
$Project = "*",
[Parameter(Mandatory=$false)]
[string]
$SolutionPath = ".",
@tackme31
tackme31 / New-UnicornPackage.ps1
Created September 29, 2020 07:50
A Sitecore PowerShell script to make a package based on an unicorn configuration.
$options = [ordered]@{};
[Unicorn.Configuration.UnicornConfigurationManager]::Configurations | % { $options[$_.Name] = $_.Name }
$result = Read-Variable `
-Parameters `
@{ Name='packageName'; Title='Package Name'; Value=(Get-Date -Format yyyyMMddHHmmss); }, `
@{ Name='configuration'; Title='Configuration'; Options=$options; Editor='radio'; } `
-Title "Unicorn Package" `
-Description "Make a package based on an unicorn configuration."
@tackme31
tackme31 / Restart-IIS.ps1
Created October 23, 2020 03:00
A PowerShell snippet to wait for executing iisreset.exe to succeed.
function Restart-IIS {
do {
& { iisreset }
$iis = Get-Service -Name W3SVC
}
while ($iis.Status -ne 'Running')
}
Restart-IIS