In this example, a visitor provides information about who they want to buy a gift for, and the site makes recommendations based on their answers.
How We Built It
The Collection We Added: productsKeywords
The productsKeywords collection has the following fields:
product: A reference field that points to an item in the Products collection
keywords: A list of keywords that relate to the product
Adding the Quiz
We added a slideshow on the Gift Quiz page. Each slide contains a quiz question. The slideshow is set up so that when a question is answered, the next slide appears.
Displaying the Recommendations
When the last question is answered, we query the productsKeywords collection for all the products with keywords that match the answers.
The last slide in the slideshow then displays a random selection of the query results in a repeater. Each repeated item has elements that display the image, name, and price of the recommended gifts.
Open this example in the Editor to work with the template.
Publish the site and refresh your browser so the Stores collections appear in the Database.
Learn how to work with examples in Corvid.