November Happy Hour will be moved to Thursday December 5th.

Self optimizing block

Vote:
 

Hi,

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?

Regards,

Alan.

#131690
Aug 03, 2015 12:56
Vote:
 

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.

#144579
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.