Try our conversational search powered by Generative AI!

Self optimizing block



I'm trying to add a blocks to a page programatically. The blocks randomize on page refresh.

I've found this is fine with blocks I create muself but doesn't work for self optimizing blocks.

Code I have looks like this:

                var contentRepository = ServiceLocator.Current.GetInstance();
                var blocks = contentRepository.GetChildren(bannerFolder).Take(bannerQty);

This works fine for blocks I create but not for self optimizing blocks. They all inherit from BlockData so didn't think this would present an issue.

Any way to resolve this?



Aug 03, 2015 12:56

Have you tried adding LanguageSelector.AutoDetect(true) to you GetChildren() call? I recall that will give an unfiltered list which might include the S.O.B. which I recall work with some kind of Visitor Group internally.

Feb 15, 2016 21:20
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.