Skip to content
Panel(opens in a new tab)

Build a Search Page

Build your search page from separate components when you want control over the layout, for example the Search Bar, the filters and the results side by side, with image search on the same page. The components connect through events, so you place them on the page and they work together.

To keep the Search Bar on other pages too and send shoppers here when they search, see Redirect Search to a Results Page.

You need:

  • vviinn-widgets 2.76.1 or later, preferably the latest version (see Install the Widgets)
  • the read-only token (see Authentication)
  • an active Text Search campaign, plus a Visual Search campaign if shoppers search by image (see Campaigns)
  1. Add the Search Bar, vviinn-text-search. Set mode="extended" to offer image search next to the text input.

  2. Add the Product List, vviinn-results, where the results appear. results-count sets how many results it fetches, up to the maximum set in the campaign.

  3. Add the filters: vviinn-filters for the primary filters in a compact bar, vviinn-extended-filters for all filters, and vviinn-selected-filters for the values the shopper has chosen.

  4. Add the Cropper, vviinn-cropper, to show the uploaded image after an image search and let shoppers change the search area.

Every component except the filters takes the read-only token in token. The other attributes are on each component’s page.

The example puts all of them on one page: the Cropper and the full filter list in a sidebar, and the Search Bar, the filters and the results in the main column. On small screens the sidebar is hidden and the filters move above the results. --product-card-width sets the card width (see CSS Variables).

The filters show the columns the Text Search campaign offers as filters. In Panel, under Campaigns, open the Text Search campaign, then under Interface Controls select Filters. Columns marked Primary appear in vviinn-filters, and every column turned on appears in vviinn-extended-filters. The campaign settings are described on Text Search.

On your search page:

  • Search for a product you know is in your catalog. Results appear in the Product List.
  • Select a filter value. The results narrow, and the value appears in vviinn-selected-filters.
  • With mode="extended", upload a photo. The Cropper shows it, and the results change when you move the search area.

Next pieces to add: