Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 1.25 KB

readme.md

File metadata and controls

19 lines (14 loc) · 1.25 KB

Sitecore.Mvc.TestingHotfix

A/B and MV testing don't work in Sitecore 7.2 when using MVC. You will always see the original content, not the variations configured for your test. I logged this issue the Sitecore support and they confirmed that it is a bug. This is an unofficial hotfix.

There is really only one line of code that needed changing, but because that line was in a pipeline processor that was inherited by another processor, both had to be fixed. The problem is in the Sitecore.Mvc.Analytics.Pipelines.Response.CustomizeRendering.SelectVariation class. The evaluate method tries to get the test variable item with this line of code:

Item variableItem = args.PageContext.Database.GetItem(renderingReference.Settings.MultiVariateTest);

However, renderingReference.Settings.MultiVariateTest is not a simple ID, it is actually a query string language names as keys and IDs as values. The variable item is always null as a result and the method aborts. This problem can be fixed by using the APIs from the core library:

Item variableItem = args.PageContext.Database.GetItem(renderingReference.Settings.GetMultiVariateTestForLanguage(Context.Language));

Download the package