Tutorial: Grouping products by category
You can configure the Developer Portal so that products are displayed in groups according to the category that they are tagged with.
You can use the Views
module to fetch content from your Developer Portal
site, such as lists of products, and present the content to users in different formats. You can
combine multiple views on a new page to display whatever content you want.
Before you begin
You must have a Developer Portal enabled, and you must have administrator access to complete this tutorial. The tutorial Creating the Portal explains how to enable the portal if you have not already done so.About this tutorial
In this tutorial you create three views in the Developer Portal, each one is configured to display a list of products according to their category. You then create a new page to show the views, where you see products that are grouped by category.
- Log in to your Developer Portal as an administrator.
- If the administrator dashboard isn’t displayed, click Manage to display it.
- Create three new taxonomy tags.
- Navigate to .
- Click
Add term
. - Enter Accounts in the
Name
field and clickSave
. - Enter Logistics in the
Name
field and clickSave
. - Enter Marketing in the
Name
field and clickSave
. - Navigate to
- Create a view to display products with the
Accounts
category.- Navigate to .
- Enter Accounts products in the
View name
field. - In
View Settings
, selectShow
:Content
,of type
:Product
,sorted by
:Newest first
, from the drop-down lists. - In
Page settings
leave theCreate a page
cleared. - In
Block settings
selectCreate a block
and enter Accounts products in theBlock title
. - Ensure
Block Display Settings
hasDisplay format
:Masonry
,of
:tiles (linked)
, and selectUse a pager
. - Click
Save and edit
.
- Configure the view block settings.
- Under the
Format
section click theFields
link next to theShow
label. - In the dialog box, select the
Content
radio button then clickApply
. - Select
Card
from theView mode
drop-down list, then clickApply
. - Click
Add
next to theFilter Criteria
section. - In the dialog box, search for tag then select the option
Tags (apic_tags)
from the list then clickAdd and configure filter criteria
. - In the next dialog box, select the
Tags
radio button and theClient-side hierarchical
then clickApply and continue
. - Next set the
Operator
toIs all of
, and from theSelect terms from vocabulary Tags
drop-down selectAccounts
and clickApply
. - Under the
Advanced
options, click theNone
link next to theCSS class
label. - If you are using the default API connect theme, then enter the CSS class name
product-view
and clickApply
. If you have your own css class that you want to use, then enter its name in here instead. - Click
Save
to save all the changes.
- Under the
- Create a view for the Logistics products.
- Select .
- Navigate to the
Accounts products
view and select theDuplicate
option. - Give the duplicated view the name
Logistics products
and clickDuplicate
. - Click the Title
Accounts products
and change it toLogistics products
and clickApply
. - Under the
Filter Criteria
section click theContent: Tags: (=Accounts)
link. - Change the value in the
Select terms from vocabulary Tags
drop-down toLogistics
and clickApply
. - Click
Save
to save all the changes.
- Repeat step 6 for Marketing products.
- Next, create a page to display the views.
- Select .
- Click
Add page
. - Enter Products by category in the
Administrative title
, and products-by-category in thePath
. Select thePanels
option from theVariant type
drop-down list then clickNext
. - Change the
Label
value to Products grouped by category and set theBuilder
toStandard
then clickNext
. - From the
Layout
drop-down list select the valueThree column
then clickNext
. - Leave all the defaults on the next page and click
Next
. - Click
+Add new block
. - Select
Accounts products
from theLists (views)
section. - Ensure that
Display tile
is selected andRegion
is set toLeft
, clickAdd block
. - Click
Add new block
. SelectLogistics products
view from the list and set theRegion
toMiddle
, clickAdd block
. - Click
Add new block
. SelectMarketing products
view from the list and set theRegion
toRight
, clickAdd block
. - Enter Products grouped by category in the
Page title
field, and clickFinish
.
- From your API Manager, create three new products, or update existing ones, to give each one a category value of either Accounts, Logistics, or Marketing. Publish each of the products to the catalog with the configured Developer Portal.
- Check that the
Products grouped by category
page shows your published products by category.- Select .
- Click the
/products-by-category
path link. - You are redirected to the
/products-by-category
page and can see the products that you assigned to these categories.
What you did in this tutorial
You created three new views in the Developer Portal, and configured each one to display a list of products according to their category. You then created a new page to show the views.