Custom Promotion - how to use a radio button in the UI?

Vote:
 

Hi,

I'm coding some custom promotion types.

I've noticed that some of the built-in promotion types have a radio button in their UI to select between "Percentage Off" / "Amount Off".

I'd like to do something similar - I want to use a radio button to show 1 of 2 properties on my promotion type..

How can I do it?

Thanks,

 - Ken

#179205
Jun 02, 2017 23:01
Vote:
 

Hi,

To customize UI for properties on your promotion type, you can create a BlockData for those properties like that

public class CustomProperties : BlockData
{
    public Type Property1
    public Type Property2
}

Then you need register an EditorDescriptor for that block to customize UI in the client side.

[EditorDescriptorRegistration(TargetType = typeof(CustomProperties))]
public class CustomPropertiesEditorDescriptor : EditorDescriptor
{
    public CustomPropertiesEditorDescriptor()
    {
        ClientEditingClass = "js/editors/CustomPropertiesEditor";
    }
}

Finally you create a dojo widget to render those properties using radio button as you want.

Hope that helps.

/Tuan

#179423
Edited, Jun 12, 2017 12:19
Vote:
 

Is there a good example online showing how I can do this?  ("dojo widget"?)

I'd like to do something similar to how a "MonetaryReward" looks on a promotion.  Ideally I would just look in the code to see how that one works - but I can't seem to locate that source code....

#185055
Nov 08, 2017 22:57
Vote:
 

Here is an overral example good for you. https://world.episerver.com/blogs/hakon-nordli/dates/2015/10/learn-how-to-develop-your-own-dojo-widget3/

#185075
Nov 09, 2017 4:39
* 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.