← API Index · How to use components
search component #oo-search
This component implements the search functionality:
- lookup of items, navigation levels and other data from the warehouse
- search through the indexed (calling) website
- rendering of the results to an overlay, including preview items that can be put into the cart
- autocompletion-like suggestions and a few matching navigation entries
- function shortcuts: typing e.g. "Warenkorb", "Pause" or "Abmelden" offers the matching page / profile section as a result (needs the page switches below)
- shortcut search:
i:10opens item #10; the other entity prefixes areg:(group),sg:(subgroup),r:(rubric),a:(assortment),ag:(assortment group),n:(navigation),t:(article)
One page can have only one search component.
As the component provides a free form input field, some testing and administrative features are available through it:
| Input | Effect |
|---|---|
admin: |
Shows a menu with administrative options (e.g. clearing the local store). |
test:msg, test:error |
Triggers an artificial notification / error message. |
test:item |
Renders the built-in test item as a search preview item. The test item (#220765) has every attribute filled (long name and description, tags, origin, producer, discounts, …) — use it to design the item preview in the search overlay. |
test:list |
Switches the shop page to a list of ten copies of the test item (same as entering i:-1) — use it to design the item list display in the shop component. i:220765 opens the test item's detail view, i:-2 a random real item. Test items carry the class oo-shop-data-testitem. |
help! |
Opens the help. |
oo-<switch>=<value>+, oo-<switch>?, oo-clear |
Ad-hoc component switches, see the use-js-components skill. |
debug:<scope>:<term>+, debug:show, debug:off |
Debug switches, see the skill. |
How components are mounted, how switch values are resolved and how debug output is enabled is described in the use-js-components skill.
<div id="oo-search" data-oo-shop-page="shop.html"></div>
component switches
Page switches
| Switch | Default | Description |
|---|---|---|
oo-shop-page |
– | Page hosting the main shop component. Clicks on results and the "more results" link lead there (with the search as parameter); if not provided, the current page is not left. |
oo-profile-page |
– | Page hosting the profile component — enables the function shortcuts to profile sections (pause, last orders, subscriptions, …). |
oo-date-page |
– | Page hosting the date component — enables the "delivery date" function shortcut. |
oo-cart-page |
– | Page hosting the cart component — enables the "cart" function shortcut. |
oo-logon-page |
– | Page hosting the logon component — enables the "logon" / "logout" function shortcuts. |
Behaviour switches
| Switch | Default | Description |
|---|---|---|
oo-search-onenter |
false |
true: Enter runs the full search in the shop page right away. Default behaviour is to focus the "more results" link and wait for a second Enter. |
oo-search-maxitems |
6 |
Number of preview items shown in the overlay. |
oo-search-click |
keep |
close: the overlay closes upon a click on an item. Useful if the search sits atop of the page and is reasonably big, so nothing can be seen underneath. |
oo-search-group |
– | Restricts results to entries reachable through the given navigation groups (1, 2, 3 for shop 1..3, comma separated). The value is made global for the page, so other components use the same restriction. |
oo-cartmode |
order |
Controls the background cart check triggered from the admin menu. Best set globally — see the cart component. |
oo-item-image-pi-size |
– | Image size advice for preview item images as w,h[,bg]. Shared with cart, status, shop and ticker. |
debug options
Debug scope search (enable with data-oo-debug="true" on the element or debug:search:<term>+, see the skill):
| Term | Description |
|---|---|
search:all |
General debug output (init, input processing, overlay state). |
search:cmd |
Function shortcuts and page changes triggered from results. |
search:art |
Item results: availability and add-to-cart handling of preview items. |
search:nav |
Navigation search: matching of navigation entries to the search term. |
search:sort |
Sorting of the result list. |