Building a Members Portal
Learn how to build a members portal in Umbraco Commerce.
Last updated
Was this helpful?
Learn how to build a members portal in Umbraco Commerce.
Last updated
Was this helpful?
A members portal is a private area of your website where customers can access their order history, manage their account details, and view personalized content. This guide will show you how to build a members portal in Umbraco Commerce.
The first step in building a members portal is to create a Member Type for your customers. This Member Type will define the properties that customers can have, such as their name, email address, and password.
Navigate to the Members section of the backoffice.
Click the + button next to the Member Groups heading in the navigation to create a new Member Type.
Enter a name for the Member Group, such as Customer
.
Click the Save button to create the Member Group.
Navigate to the Members section of the backoffice.
Click on the Members tab in the navigation.
Click on the Member you want to assign to the Customer
Member Group.
Select the Customer
Member Group in the Member Group property.
Click the Save button to assign the Member to the Customer
Member Group.
The next step in building a members portal is to create the pages and templates that will make up the members area of your website.
Navigate to the Settings section of the backoffice.
Create two new Document Types: Customer Portal
and Login
.
Update your site root Document Type to include the Customer Portal
and Login
Document Types as child-pages.
Navigate to the Content section of the backoffice.
Create a new page using the Customer Portal
Document Type and name it Customer Portal
.
Create a new page using the Login
Document Type and name it Login
.
Expand the context menu for the Customer Portal
node by clicking the three dots.
Click on the Public Access option.
Choose the Group based protection option in the Public Access dialog and select Next.
Select the Customer
Member Group for the group option.
Select the Login
node for the login and error page options.
Click Save to apply the public access settings.
To access the members portal, customers need to log in. Through the following steps a login form allowing customers to enter their username and password to access the portal is created.
Open the Login.cshtml
template file.
Add the following code to create a login form:
The UmbLoginController
class comes pre-installed with Umbraco. It handles the login process, so you don't need to create a custom controller.
On the frontend, customers can enter their username and password and click the Login button to access the members portal.
Now that members can log in, update the Customer Portal
page to display the order history for the logged-in member.
Open the CustomerPortal.cshtml
template file.
Add the following code to display the order history:
The Customer Portal
page will now display a table of the member's order history, including the order number, date, and total price.
The order history will display all orders that have been finalized for the logged-in member. Orders created whilst the member is logged in will automatically be associated with the member. If you wish to assign an order to a member at any point, you can use the API method:
In your site header, add the following code to display the member login status:
To allow customers to register as members, you can create a registration form allowing customers to enter their name, email address, and password.
Implement a registration Document Type and page in the same way as the login page.
Open the Register.cshtml
template file and add the following code to create a registration form:
The UmbRegisterController
class comes pre-installed with Umbraco. It handles the login process, so you don't need to create a custom controller.
On the frontend, customers can enter their name, email address, and password to register as a member.