Skip to content

Instantly share code, notes, and snippets.

View JRondeau16's full-sized avatar

Jeffrey Rondeau JRondeau16

View GitHub Profile
public ActionResult ContactUs()
{
var model = new ContactUsViewModel();
if ((Tracker.Current != null) && (Tracker.Current.Contact != null))
{
var contact = Tracker.Current.Contact;
var personal = contact.GetFacet<IContactPersonalInfo>("Personal");
var phoneFacet = contact.GetFacet<IContactPhoneNumbers>("Phone Numbers");
var addressFacet = contact.GetFacet<IContactAddresses>("Addresses");
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<mvc.requestBegin>
<processor type="YourNamespace.Pipelines.MvcRequestBegin, YourNamespace"
patch:after="processor[@type='Sitecore.Mvc.Analytics.Pipelines.MvcEvents.RequestBegin.StartTracking, Sitecore.Mvc.Analytics']"/>
</mvc.requestBegin>
</pipelines>
</sitecore>
</configuration>
@JRondeau16
JRondeau16 / IdentifyContact.cs
Created June 27, 2018 16:27
Populate Sitecore Contact Data from Salesforce Marketing Cloud
using System;
using System.Linq;
using Sitecore.Analytics;
using Sitecore.Analytics.Tracking;
using Sitecore.Diagnostics;
using Sitecore.Mvc.Pipelines.Request.RequestBegin;
using Sitecore.Analytics.Model.Entities;
using Sitecore.Analytics.Model.Framework;
namespace YourNamespace.Pipelines.MvcRequestBegin
@JRondeau16
JRondeau16 / ProjectName.Website.Web.Index.config
Created November 21, 2017 20:52
Lucene Index Configuration for Web Database - Sitecore 9
<?xml version="1.0"?>
<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="ContentDelivery" search:require="lucene">
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<!--Index Configuration-->
</configuration>
</contentSearch>
</sitecore>
</configuration>
@JRondeau16
JRondeau16 / ProjectName.Website.Master.Index.config
Last active November 21, 2017 20:51
Lucene Index Configuration for Master Database - Sitecore 9
<?xml version="1.0"?>
<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 Reporting or ContentManagement or Processing" search:require="lucene">
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<!--Index Configuration-->
</configuration>
</contentSearch>
</sitecore>
</configuration>
@JRondeau16
JRondeau16 / SiteDefinition.config
Created November 21, 2017 20:37
SiteDefinition.config for Sitecore 9
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:env="http://www.sitecore.net/xmlconfig/env/">
<sitecore>
<sites>
<!--Local-->
<site name="[ProjectName]" inherits="website"
rootPath="/sitecore/content/ProjectName"
hostName="*"
targetHostName="ProjectName.local.com"
patch:before="site[@name='website']" />
@JRondeau16
JRondeau16 / Settings.config
Created November 21, 2017 20:33
Settings.config Sitecore 9
<?xml version="1.0"?>
<configuration
xmlns:patch="http://www.sitecore.net/xmlconfig/"
xmlns:set="http://www.sitecore.net/xmlconfig/set/"
xmlns:role="http://www.sitecore.net/xmlconfig/role/"
xmlns:env="http://www.sitecore.net/xmlconfig/env/">
<sitecore>
<settings>
<!--Local-->
<setting name="[ProjectName].Setting" value="abc123" env:require="Local" />
@JRondeau16
JRondeau16 / web.config
Created November 21, 2017 20:32
web.config Roles + Environments
<appSettings>
<!--Local-->
<add key="env:define" value="Local" />
<add key="role:define" value="Standalone"/>
<!--Develop-->
<add key="env:define" value="Develop" />
<add key="role:define" value="Standalone"/>
<!--Beta-->
@JRondeau16
JRondeau16 / GetFields.cs
Created July 28, 2017 19:39
Get Fields Pipeline Override
using Elision.Foundation.Kernel;
using Sitecore.Data.Fields;
using Sitecore.Data.Templates;
namespace Elision.Foundation.FieldVisibility.Pipelines.GetContentEditorFields
{
public class GetFields : Sitecore.Shell.Applications.ContentEditor.Pipelines.GetContentEditorFields.GetFields
{
protected override bool CanShowField(Field field, TemplateField templateField)
{
@JRondeau16
JRondeau16 / FieldVisibility.config
Created July 28, 2017 19:37
Hide With Standard Fields Config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<pipelines>
<getContentEditorFields>
<processor type="[YOUR_NAMESPACE].GetFields, [YOUR_NAMESPACE]"
patch:instead="processor[@type='Sitecore.Shell.Applications.ContentEditor.Pipelines.GetContentEditorFields.GetFields, Sitecore.Client']" />
</getContentEditorFields>
</pipelines>