Optimizely Spire CMS provides a feature to create variants of CMS pages. Page variants are variations of a website page with rules for displaying it to end users. Optimizely Spire CMS supports page variants for all CMS pages, including the header and footer. The primary purpose of that user is to see different variations of the same page.
Optimizely Spire CMS provides a feature to apply rule types on page variants. Optimizely Configured Commerce supports creating custom rule types and rule type options to further use the Rules Engine. The basic requirement of creating a custom rule type or using OOTB on a rule type is that users can see different CMS pages as per the applied rule type.
This blog provides complete information on creating custom rule-type options. The steps below will help create a custom rule type option in the Optimizely Configured Commerce solution that can be used in the Optimizely Spire CMS.
How to Create a Custom Rule Type Option in Optimizely Spire CMS
- Open Optimizely Configured Commerce solution in Visual Studio.
- Go to the βExtensionsβ class library.
- Create a new class, βCustomRuleTypeOption,β and inherit it from the βCriteriaTypeBaseβ base class.Β Add Dependency Name attribute with a name of βCustomRuleTypeOptionβ.
- Implement inherited abstract class members.
- Change the DisplayName property value to βCustom Rule Type Optionβ.
- Override the remaining properties value.
- To show custom rule type option field in CMS, we need to override the βParameterDescriptionsβ property and set βLabelβ and βValueTypeβ value.
- Override the Validate method and add business logic to validate the input value specified in the CMS. If βtrueβ is returned, the user will see the page variant. If βfalseβ is returned, the user will see the default page.
- Rebuild the solution.
- Login in Admin.
- Go to Administration -> System -> Rule Types listing page.
- Open the βPageβ rule type from the listing page.
- Go to βRule Optionsβ tab and click on βRule Type Optionβ button.
- Enter βDescriptionβ and select the custom rule type option from the βCriteria Typeβ dropdown and click on the βSaveβ button.
- Log in as a content admin and click the βEditβ icon.
- Go to any page and create a variant of the page. For example, go to Header and click on More Options (β¦).
- Select βCreate Variantβ.
- Enter a βVariant Nameβ, select βCopy Content from Defaultβ and click on βSaveβ button.
- Select the custom rule type option from the rule type dropdown, enter the value, and click the save button.
- As per the rule type, verify the variant page on the site.
References:
- https://support.optimizely.com/hc/en-us/articles/4413199746317-Manage-page-variants
- https://docs.developers.optimizely.com/configured-commerce/docs/create-custom-rule-type-option-for-cms-variants
- https://support.optimizely.com/hc/en-us/articles/4413200007437-Rule-type-options
__PRESENT
__PRESENT
__PRESENT
Source: Read MoreΓΒ