View Shopper Account Details
Version: 8.2
Create a page that shows various properties of a user account.
Complete the following prerequisites:
-
You have set up a page in Sitecore with associated codebehind or MVC Controller.
At your Visual Studio Solution setup:
-
Controller action
RequestResponseUserObject model = null; if (Sitecore.Context.User.IsAuthenticated) { var user = Sitecore.Context.User; model = user.GetCommerceProfileModel(); } return View(model);
-
View
RequestResponse@model MVCSite.Models.Generated.UserObject <h4>Hi @Sitecore.Context.User.LocalName, could we please get some more details from you... </h4> @using (Html.BeginRouteForm(Sitecore.Mvc.Configuration.MvcSettings.SitecoreRouteName, FormMethod.Post, new { @class = "form-horizontal" })) { @Html.Sitecore().FormHandler() <div class="control-group"> @Html.LabelFor(model => model.TelephoneNumber, new {@class = "control-label"}) <div class="controls"> @Html.TextBoxFor(model => model.TelephoneNumber, new { placeholder="+1 (613) 123-1234" }) </div> </div> <div class="control-group"> @Html.LabelFor(model => model.Email, new {@class = "control-label"}) <div class="controls"> @Html.TextBoxFor(model => model.Email, new { placeholder="[email protected]" }) </div> </div>