Skip to content

Instantly share code, notes, and snippets.

@Azadehkhojandi
Azadehkhojandi / MultiRootEditFrameChromeData.cs
Created July 28, 2015 02:43
sitecore custom edit frame buttons
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sitecore;
using Sitecore.Configuration;
using Sitecore.Data;
using Sitecore.Data.Fields;
using Sitecore.Data.Items;
@Azadehkhojandi
Azadehkhojandi / Implements
Created October 12, 2015 05:17
check sitecore implements a template
public static bool Implements(this Item item, params ID[] templateIds)
{
if (templateIds.Length == 0)
{
throw new ArgumentOutOfRangeException("templateIds", "must include at least one template");
}
if (item == null || item.Template == null)
{
return false;
}
@Azadehkhojandi
Azadehkhojandi / API.cs
Last active January 8, 2016 02:46
create table with GEOGRAPHY column
public class Landmark
{
public string Id { get; set; }
public string Title { get; set; }
public string Latitude { get; set; }
public string Longitude { get; set; }
public string Distance { get; set; }
}
public class LandmarkController : ApiController
{
@Azadehkhojandi
Azadehkhojandi / .bowerrc
Last active January 8, 2016 03:14
Proxy settings
{
"proxy": "http://IP:port/",
"https-proxy": "http://IP:port/",
"strict-ssl": false
}
@Azadehkhojandi
Azadehkhojandi / InsertFormWizard.cs
Last active January 22, 2016 04:46 — forked from jammykam/InsertFormWizard.cs
Updated form selector to allow selection of existing forms
using System;
using System.Text;
using Sitecore;
using Sitecore.Data.Items;
using Sitecore.Globalization;
using Sitecore.Web.UI.HtmlControls;
using Sitecore.Web.UI.Sheer;
//https://jammykam.wordpress.com/2015/10/05/webforms-for-marketers-allow-selection-of-existing-forms/
namespace LendLease.Extension.Sc.WFFM
@Azadehkhojandi
Azadehkhojandi / HtmlCrawledField.cs
Created February 5, 2016 05:19
HtmlCrawledField computed field - extending sitecore indexing
//references https://github.com/hermanussen/sitecore-html-crawler
public class HtmlCrawledField : IComputedIndexField
{
public string FieldName { get; set; }
public string ReturnType { get; set; }
public object ComputeFieldValue(IIndexable indexable)
{
Assert.ArgumentNotNull(indexable, "indexable");
//references
//http://www.sitecore.net/Learn/Blogs/Technical-Blogs/John-West-Sitecore-Blog/Posts/2013/05/Sitecore-7-Enable-Default-Computed-Index-Fields.aspx
//http://kamsar.net/index.php/2014/05/indexing-subcontent/
//http://www.techphoria414.com/Blog/2013/November/Sitecore-7-Computed-Fields-All-Templates-and-Datasource-Content
public class SubcontentField : IComputedIndexField
{
public string FieldName { get; set; }
public string ReturnType { get; set; }
@Azadehkhojandi
Azadehkhojandi / ByLocalSearchNoResult.cs
Created April 6, 2016 06:14
Add Sitecore page event report to Experience Analytics - adding a chart to show top internal search keywords which returns no result (/sitecore/system/Settings/Analytics/Page Events/No search hits found)
public class ByLocalSearchNoResult : PageEventDimensionBase
{
private readonly Guid noSearchHitsFoundId = AnalyticsIds.NoSearchHitsFound.Guid;
public ByLocalSearchNoResult(Guid dimensionId) : base(dimensionId)
{
}
public override bool Filter(PageEventData pageEventData)
{
Assert.IsNotNull((object)pageEventData, "pageEvent");
@Azadehkhojandi
Azadehkhojandi / FixClonedItems.aspx
Created April 12, 2016 03:57
Migrating cloned items to sitcore 8.1 and above
<%@ page language="C#" async="true" autoeventwireup="true" codebehind="FixClonedItems.aspx.cs" inherits="Web.sitecore.admin.Migration.FixClonedItems" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Migartion Fix Cloned Items</title>
<style type="text/css">
body {
font-family: normal 11pt "Times New Roman", Serif;
}
var container = new UnityContainer();
container.RegisterTypes(AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes()));
container.RegisterTypes(AllClasses.FromLoadedAssemblies());
container.RegisterInstance(typeof(UmbracoHelper), new UmbracoHelper(UmbracoContext.Current));
container.RegisterInstance(typeof(UmbracoContext), UmbracoContext.Current);
container.RegisterInstance(typeof(Merchello.Core.IMerchelloContext), MerchelloContext.Current);
container.RegisterInstance(typeof(ApplicationContext), ApplicationContext.Current);
container.RegisterInstance(typeof(ServiceContext), ApplicationContext.Current.Services);