custom home page based on user profile

3 years ago
Hi all!

We wish to create different custom home pages for users based on their profile (and previous order), not just the standard homepage like e.g. Amazon after user login.

How we can do it ?

Thanks in advance
3 years ago
Hello-

That's actually an excellent idea, but unfortunately not yet available out of the box.
The only suggestion that I can think of quickly would not actually provide varying home pages for each customer, but would at least allow for a different home page layout based on the customer's role.

For example, you could edit your /Views/Home/Index.cshtml like this:

<div class="page home-page">
    <div class="page-body">
@if  (_workContext.CurrentCustomer.IsInCustomerRole("Role1")) {
        @Html.Widget("home_page_top")
        @Html.Action("TopicBlock", "Topic", new { systemName = "HomePageText1" })
        @Html.Widget("home_page_bottom")
}
else if (_workContext.CurrentCustomer.IsInCustomerRole("Role2"))
{

        @Html.Widget("home_page_top")
        @Html.Action("TopicBlock", "Topic", new { systemName = "HomePageText2" })
        @Html.Action("HomepageBestSellers", "Product")
        @Html.Action("HomePageNews", "News")
        @Html.Action("HomePagePolls", "Poll")
        @Html.Widget("home_page_bottom")
}
else
}
        @Html.Widget("home_page_top")
        @Html.Action("TopicBlock", "Topic", new { systemName = "HomePageText" })
        @Html.Action("HomepageCategories", "Catalog")
        @Html.Action("HomepageProducts", "Product")
        @Html.Action("HomepageBestSellers", "Product")
        @Html.Action("HomePageNews", "News")
        @Html.Action("HomePagePolls", "Poll")
        @Html.Widget("home_page_bottom")
}
    </div>
</div>


You'd just add/remove the pertinent elements for each potential login role.
3 years ago
Nice, good idea! Thank you