Skip to content

Instantly share code, notes, and snippets.

View rustyswayne's full-sized avatar

Rusty Swayne rustyswayne

  • Health Catalyst
  • Bellingham, WA
View GitHub Profile
@rustyswayne
rustyswayne / CurrencyContext
Last active April 12, 2016 15:42
Possible static class for currency formatting
/// <summary>
/// A helper that provides quick access to common Merchello currency and operations.
/// </summary>
public static class CurrencyContext
{
/// <summary>
/// Merchello's <see cref="IStoreSettingService"/>.
/// </summary>
/// <remarks>
/// This is lazy to prevent problems with application bootstrapping
@rustyswayne
rustyswayne / gist:bf06bb6e5ca5f80b0ae9
Created March 25, 2015 20:26
Sample ApplicationEventHandler
public namespace MyNamespace
{
/// <summary>
/// Handles the Umbraco Application "Starting" and "Started" event and initiates the Merchello startup
/// </summary>
public class UmbracoApplicationEventHandler : ApplicationEventHandler
{
/// <summary>
/// The Umbraco Application Starting event.
@rustyswayne
rustyswayne / gist:6d1d75ee29dc8f0f6f67
Created December 23, 2014 00:56
Merch-v6 Simple ExamineIndex.config
<?xml version="1.0"?>
<!--
Umbraco examine is an extensible indexer and search engine.
This configuration file can be extended to create your own index sets.
Index/Search providers can be defined in the UmbracoSettings.config
More information and documentation can be found on CodePlex: http://umbracoexamine.codeplex.com
-->
<ExamineLuceneIndexSets>
<!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->
@rustyswayne
rustyswayne / gist:777ed32802124f9d2557
Created December 23, 2014 00:55
Merch-v6 Simple ExamineSettings.config
<?xml version="1.0"?>
<!--
Umbraco examine is an extensible indexer and search engine.
This configuration file can be extended to add your own search/index providers.
Index sets can be defined in the ExamineIndex.config if you're using the standard provider model.
More information and documentation can be found on CodePlex: http://umbracoexamine.codeplex.com
-->
<Examine>
<ExamineIndexProviders>
@rustyswayne
rustyswayne / gist:598049064a02fce1597c
Created October 27, 2014 16:54
Manually generating an order in Merchello
// Adding the shipmethod is typically done in the back office through the UI.
// Interested in the use case to dynamically add theses?
var key = Constants.ProviderKeys.Shipping.FixedRateShippingProviderKey;
var defaultCatalogKey = Constants.DefaultKeys.Warehouse.DefaultWarehouseCatalogKey;
// this would have to be done through the back office as it uses an internal service
var us = MerchelloContext.Current.Services.StoreSettingService.GetCountryByCode("US");
var usCountry = new ShipCountry(defaultCatalogKey, us);
((ServiceContext)MerchelloContext.Current.Services).ShipCountryService.Save(usCountry);