• Not Answered

sitecore 9 - basic personalization rule not working

I have done a fresh SITECORE 9 installation on my local PC using latest version of SIM tool

DB - SQL server 2016 express edition

Web server - IIS 10

OS - Windows 10

I have created:

1 simple layout with a place holder. (Code attached)

1 simple component that displays image from the related data source. (Code attached)

1 personalization rule - when a given date is passed change data source. (screenshot attached)

When adding component to the page i chose car image as data source.

As per the rule the component should render either the Bike image or the Helicopter image, but it is rendering the car image.

Screenshots:

Code snippets Layout:

@using Sitecore.Mvc
@using Sitecore.Mvc.Analytics.Extensions
@{
    Layout = null;
}
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        @Html.Sitecore().VisitorIdentification()
    </head>
    <body>
        <h1>test page</h1>
        <div>
            @Html.Sitecore().Placeholder("main")
        </div>
    </body>
</html>

Code snippets Component/Rendering:

@using Sitecore.Rules;
@using Sitecore.Rules.Conditions;

<div style="border-color:red; border-style:solid; border-width:1px; margin:2px 2px 2px 2px;">
    my image
    
    @Html.Sitecore().Field("image", Model.Item)
</div>

2 Replies

  • Hi

    If everything is fine then please try two things more ,

    Please check the @Html.Sitecore().Field("image", Model.iem) does this reflect images in website ,

    and second thing is there any default workflow isassociated with your item or not .

  • Check that it's "normal" mode you're checking for the results, you won't see personalisation in edit mode. Secondly make sure the "Xdb.Enabled" setting is "true"