Posts

Showing posts from 2016

Walk through KPI

A key performance indicator (KPI) records when a visitor on a website performs a desired action, such as clicking on an add button, or runs a piece of java script. A custom KPIs can be creating by implementing IKPI interface, to use in Episerver A/B testing or in any other package that relies on creating instance-based goal objects.

An example Implementation can be found on GIST

Helpful links:
http://world.episerver.com/documentation/developer-guides/CMS/key-performance-indicators-kpis/
https://www.david-tec.com/2016/11/creating-a-custom-conversion-goal-with-episerver-ab-testing/

POC custom pricing provider works

In most ecommerce websites, prices comes from some third system and we import the prices into EPiServer Commerce along with products and variants data, but this is not the case all the time. In some scenarios pricing are quite complex and have to decide at run time or require to retrieve from some web services. A custom pricing provider can be built to support these kind of scenarios. we are require to implement IPriceService for read only prices and IPriceDetailService for Editing prices. We will be require to register these service in structure map e.g.
services.AddSingleton< IPriceService, CustomPriceService >();
Find the POC on GIST

Custom Price Placed Processor

We need to implement IPlacedPriceProcessor interface to get the currently-placed price for an line item if business have additional pricing rules outside of what is implemented in out of the box pricing provider. Here is an example implementation.
We wre required to inject custom classes at startup via structuremap.

Custom Line Item Validator

Amazon offers AddOn products that can be bough with some other product only. Addon products must be removed from basket if added without the parent product. This type of validation can be done easily by implementing ILineItemValidotr interface. You can find a test implementation of custom Line Item Validator on Git.
You will require to register new custom validation class implicitly into your container.
It will be helpful if in future versions a generic type can be used rather ValidationIssue Enum in Validate method.

Handle Exceptions in Find

If it's repetitive, it can be automated. Think about the following requirements. Have you ever hoped there would be a better way to implement them?

INotifyPropertyChangedUndo/redoCode contracts (preconditions)LoggingTransaction handlingException handlingThread dispatchingThread synchronizationImmutableAuthorizationAuditCachingExceptions in Find
Generally we will be doing this

        private SearchResults<DummyObject> GetResults()         {             try             {                 var query = client.Search<DummyObject>();                 var results = query.Take(10).StaticallyCacheFor(TimeSpan.FromMinutes(5)).GetResult();                 return results;             }             catch (ServiceException exception)             {                 //Blah blah             }             catch (ClientException exception)             {                 //Blah blah             }         }

There are few issues in above code 
Exception code will be repititive and will expand the…