Varient in Personalization

innovix solutions asked on September 24, 2019 19:00

I m using Kentico 12 MVC development model and I have created varient.NOw i would like to get that varient value in MVC widget Controller.Are there anyway to get that kind of functionality?

Recent Answers


Dmitry Bastron answered on September 24, 2019 23:55

Hi,

I'm not sure I understood the question. Could you rephrase please? What "varient" do you mean?

0 votesVote for this answer Mark as a Correct answer

innovix solutions answered on September 25, 2019 04:20 (last edited on September 25, 2019 08:34)

I have created one condition type.And I Have created variant configuration dialog box and which has one checkbox.I can create variant successfully but we don't know how to get that selected variant value from mvc widget controller. The reason we are trying to get assigned variant value from widgetcontroller.cs is that we need to check which content will be showed based on assign variant to specific widget.

You can take a look into sample code in following link. link(https://drive.google.com/file/d/1GsgUJ947luPFQZNbEJ64i4R49sDyD5yQ/view)

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on September 26, 2019 11:02

Hi,

You cannot get this value inside widget controller as it is not supposed to be passed there. The system use this value to determine if the personalization variant should be shown. Here is what you should do:

  1. Add a new checkbox with similar name into your widget properties and use it in the widget for your logic (let's call it "widget checkbox")
  2. Create 2 personalization variants: "true" and "Original"
  3. In "true" personalization variant check your "widget checkbox"
  4. In "Original" personalization variant leave your "widget checkbox" unchecked

Hope it all makes sense.

0 votesVote for this answer Mark as a Correct answer

innovix solutions answered on October 7, 2019 10:51 (last edited on October 7, 2019 10:52)

thanks,Dmitry Bastron.But I have one questin.I reference sample from Dancing Goat.This sample return true,if match condition find.How to know this condtion types return true or false from other places(like controller ,widget controller).Same as above ,there is no way to get that result?

using System.Collections.Generic; using System.ComponentModel.DataAnnotations;

using CMS.ContactManagement;

using DancingGoat.Personalization;

using Kentico.Forms.Web.Mvc; using Kentico.PageBuilder.Web.Mvc.Personalization;

[assembly: RegisterPersonalizationConditionType("DancingGoat.Personalization.IsInContactGroup", typeof(IsInContactGroupConditionType), "Testing Group BG", Description = "Testin1", IconClass = "icon-app-contact-groups")]

namespace DancingGoat.Personalization { /// public class IsInContactGroupConditionType : ConditionType { /// [EditingComponent("DancingGoat.ContactGroupSelector", Order = 0, Label = "")] public List

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.