Skip to content

Instantly share code, notes, and snippets.

View RyanDurkin's full-sized avatar

Ryan Durkin RyanDurkin

View GitHub Profile
@RyanDurkin
RyanDurkin / UnusedMediaItemsWithPrompt.ps1
Last active March 16, 2018 11:45
Sitecore PowerShell script to find media items that are not in use with a prompt for the folder location
<#
.SYNOPSIS
Lists all media items that are not linked to other items. Extended from original to allow the user to provide a location to search
.NOTES
Adapted from the script by Michael West
#>
function HasReference {
param(
$Item
@RyanDurkin
RyanDurkin / TridionPageProvider.cs
Last active March 31, 2016 14:24
DXA Preview DD4T 2013 SP1
public string GetContentByUrl(string Url)
{
LoggerService.Debug(">>GetContentByUrl({0})", LoggingCategory.Performance, Url);
//Custom DXA Preview code added here
string retVal = string.Empty;
if (
HttpContext.Current.Request.QueryString.Count > 0 &&
HttpContext.Current.Request.QueryString["preview"] != null &&
HttpContext.Current.Request.QueryString["pageUrl"] == Url
)
@RyanDurkin
RyanDurkin / gist:6578058
Created September 16, 2013 08:39
ComponentLink Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Serialization;
/// <summary>
/// Summary description for ComponentLink
/// </summary>
[Serializable]
@RyanDurkin
RyanDurkin / gist:3879176
Created October 12, 2012 13:21
Restarting Tridion Services Using A Batch File
@echo off
net stop "Tridion Cache Channel Service"
net stop "Tridion Content Deployer"
net stop "Tridion Content Manager Publisher"
net stop "Tridion Content Distributor Transport Service"
net stop "Tridion Content Manager Business Connector"
net stop "Tridion Content Manager Search Host"
net stop "Tridion Content Manager Search Indexer"
net stop "Tridion Content Manager Service Host"
@RyanDurkin
RyanDurkin / gist:3808111
Created September 30, 2012 18:41
Item Mapping
<Item typeMapping="ComponentPresentation" itemExtension=".Xml" cached="true" storageId="MSSQL_01" />
@RyanDurkin
RyanDurkin / gist:3808105
Created September 30, 2012 18:37
Get Product Price Method
public ProductPrice GetProductPrice(string tcmId)
{
return GetAllPrices().Where(p => p.TcmId == tcmId).First();
}
@RyanDurkin
RyanDurkin / gist:3808103
Created September 30, 2012 18:36
Product Price Utilities Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public class ProductPriceUtilities
{
public static List<ProductPrice> GetAllPrices()
{
//create a list to return
@RyanDurkin
RyanDurkin / gist:3808100
Created September 30, 2012 18:35
Product Price Class
using System;
using System.Linq;
using System.Xml.Serialization;
using System.IO;
using System.Xml;
[Serializable]
[XmlRoot(ElementName = "product_price")]
public class ProductPrice
{
@RyanDurkin
RyanDurkin / gist:3808097
Created September 30, 2012 18:35
Product Price XML CT Source Code
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tcm="http://www.tridion.com/ContentManager/5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tcmi="http://www.tridion.com/ContentManager/5.0/Instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:tcmse="http://www.tridion.com/ContentManager/5.1/TcmScriptAssistant" exclude-result-prefixes="productPrice tcm tcmse xsl xlink tcmi xsd xhtml" xmlns:productPrice="uuid:341ebd00-fcf9-46d3-b4db-c8402acf798b">
<xsl:output method="xml" omit-xml-declaration="yes" version="1.0" indent="yes" cdata-section-elements="tcm_id product_tcm_id three_month_rate twelve_month_rate" />
<xsl:template match="tcm:Component">
<xsl:variable name="productPriceContent" select="./tcm:Data/tcm:Content/productPrice:Content" />
<xsl:element name="product_price">
<xsl:element name="tcm_id">
<xsl:value-of select="@ID" />