Skip to content

Instantly share code, notes, and snippets.

@skttl
skttl / GetFieldValue.cs
Created March 2, 2016 09:41
Extension method for getting field value from Examine.SearchResult, with string fallback
using Examine;
namespace MyNamespace
{
public static class ExamineExtensions
{
public static string GetFieldValue(this SearchResult searchResult, string key, string fallback = "")
{
if (searchResult.Fields.Keys.Contains(key))
{
@skttl
skttl / hideEmptyBaskets.js
Created March 11, 2016 12:52
Hide empty baskets in ucommerce backend
/*
Go to uCommerce > Orders > Search.
In the console, choose right(search.aspx) as the target, and run the following code.
*/
$("#orderTable tbody tr").each(function() {
if ($(this).children("td:last-child").text() == "0" || $(this).children("td:last-child").text() == "0,00") {
@skttl
skttl / include-ucommerce-bins.xml
Last active March 30, 2016 06:13
Include ucommerce bins in csproj on build
<!-- add the following to csproj file -->
<Content Include="bin\ucommerce\**">
<Link>ucommerce\%(RecursiveDir)%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@skttl
skttl / Profile.txt
Created March 30, 2016 06:14
Include ucommerce bins from NonNugetAssemblies when publishing through msdeploy
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- add ucommerce assemblies -->
<!-- http://www.asp.net/mvc/overview/deployment/visual-studio-web-deployment/deploying-extra-files -->
<Target Name="CustomCollectFiles">
<ItemGroup>
<_CustomFiles Include="..\NonNugetAssemblies\uCommerce\**\*" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
@skttl
skttl / FrontpageUrlProvider.cs
Created October 21, 2016 07:15
Umbraco URL Provider for frontpage set in "the ultimate site structure" (https://cultiv.nl/blog/tip-of-the-week-the-ultimate-site-structure-setup/)
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
using Umbraco.Web;
using Umbraco.Web.Routing;
namespace MyWebsite.Core.UrlProviders
{
public class FrontpageUrlProviderApplicationEventHandler : ApplicationEventHandler
@skttl
skttl / ViewDataExtensions
Last active October 21, 2016 07:23
Extrension for getting values from a ViewDataDictionary Usage: @ViewData.GetValue<int>("someIntValue")
using System.Web.Mvc;
namespace MyWebsite.Core.Extensions
{
public static class ViewDataExtensions
{
/// <summary>
/// Gets value of dictionary key, returns defaultValue if key not found
/// </summary>
/// <typeparam name="T"></typeparam>
@skttl
skttl / UrlHelpers.cs
Created October 21, 2016 07:26
Adds the last write time of a file, to a querystring parameter, for busting local caches. Usage: @UrlHelpers.CachebustPath("~/path/to/styles.css")
using Umbraco.Core;
namespace MyWebsite.Core.Helpers
{
public static class UrlHelpers
{
/// <summary>
/// Takes a path, and adds a querystring value matching the last write time, to bust eventual browser caching.
/// </summary>
@skttl
skttl / install-ucommerce-on-umbraco-cloud.md
Created December 9, 2016 12:50
Sådan installeres uCommerce på Umbraco Cloud

Sådan installeres uCommerce på Umbraco Cloud

For at installere uCommerce på Umbraco Cloud lokalt, skal du oprette en tom MSSQL database uCommerce kan arbejde i lokalt. Det skyldes at uCommerce ikke fungerer med SQLCE som Umbraco Cloud bruger lokalt.

I din web.config tilføjer du under connectionstrings

<add name="uCommerce" connectionString="server=YOUR_SERVER;database=YOUR_DATABASE;user id=YOUR_USER;password=YOUR_PASSWORD" providerName="System.Data.SqlClient" />

Start herefter Umbraco up, og navigér til Developer > Packages, hvor du installerer uCommerce fra. Note: Det er muligt at installerer Nuget pakker i Umbraco Cloud - vi har blot ikke prøvet det før, så derfor gælder den her gammeldags pakkeinstallerings måde.

@skttl
skttl / Editors\Base.cshtml
Created February 3, 2017 14:11 — forked from naepalm/Editors\Base.cshtml
Grid view & controls for Skybrud's strongly typed models with Responsive BP
@model GridControl
@using Grid.Web
@using Skybrud.Umbraco.GridData
@try
{
<text>@Html.Partial(Model.EditorView(), Model)</text>
}
catch (Exception ex) {
<pre>@ex.ToString()</pre>
@skttl
skttl / uformrecords.xml
Last active February 20, 2017 10:35
Default XML output from Umbraco Forms
<uformrecord>
<state>Submitted</state>
<created>0001-01-01T00:00:00</created>
<updated>0001-01-01T00:00:00</updated>
<id>0</id>
<uniqueId>a4cd3341-cded-426e-9041-3128f971bf13</uniqueId>
<ip>::1</ip>
<pageid url="http://localhost:56068/de/test-login/" name="Test login">2329</pageid>
<memberkey email="" login=""></memberkey>
<fields>