← API Index · How to use components
cart component #oo-cart
This component shows the cart with the following features:
- shows cart positions and can render many item and cart position attributes
- offers in-cart manipulation if the amount
- display items and grouped items (such as boxes and recipe positions TBD)
- links back to the original items (or grouped items)
- renders all summary information
- manipulates action buttons depending on the order state. This includes primary buttons (e.g. the very visible "send" button) and secondary buttons (such as a smaller "cancel all" button).
- allows to add a note about the cart
- shows a duplicate indicator
- One page can have only one cart component.
How components are mounted, how switch values are resolved (element attribute, global
configuration, ad-hoc switches, …), which forms a <rel-path> value may take and how debug
output is enabled is described in the use-js-components skill.
<div id="oo-cart" data-oo-shop-page="shop.html" data-oo-date-page="date.html"></div>
component switches
Page switches
| Switch | Default | Description |
|---|---|---|
oo-shop-page |
– | Page hosting the main shop component. Clicks on a cart position (and the "continue shopping" link) lead there; if not provided, the current page is not left. Also the last fallback for the new-order link (see oo-cart-neworderpage). |
oo-date-page |
– | Page hosting the date component. The .oo-cart-datelink element is shown only if this is set (and the user is logged in). |
oo-logon-page |
– | Page hosting the logon component; target of .oo-cart-submit-anon (checkout of an anonymous visitor). |
oo-register-page |
– | Legacy. Fallback for oo-logon-page if that is not set. |
oo-profile-page |
– | Page hosting the profile component. Used by links into profile sections (#payment, #pause, …) e.g. when a payment method must be completed before sending. |
oo-thankyou-page |
– | Optional thank-you page shown after sending. Note: this page must host a cart component too! Don't use it if we stay on the same page. |
oo-thankyou-new-page |
– | Optional thank-you page for new customers (first order); falls back to oo-thankyou-page. |
oo-cart-neworderpage |
– | Target of the "new order" option (shown when the backend allows multiple orders per day). Falls back to oo-neworderpage, then oo-shop-page. |
oo-neworderpage |
– | Older name of oo-cart-neworderpage, still honoured as fallback. |
oo-cart-emptyurl |
– | If given, the cart dispatches to this page as soon as it becomes empty (by removing positions or the cart-clear button). |
Behaviour switches
| Switch | Default | Description |
|---|---|---|
oo-cartmode |
order |
cart: the cart is cleared right after submitting and not offered for re-editing; a new order (for the selected day) can be started instead. order: stay on the order, always show the order. It makes sense to use a dedicated oo-thankyou-page with cart mode. See also the counterpart on the logon component. Best set globally! |
oo-cart-newonsent |
false |
Legacy. true is the same as oo-cartmode=cart. Prefer oo-cartmode. |
oo-cart-cnote |
true |
false disables the open-on-demand logic for the cart note area and leaves the field always visible. Note: the note is enabled only when the cart is ready to be sent. |
oo-cart-summary |
false |
true always shows the profile summary (address, bank, payment, e-mail) in the cart, even for registered users. Otherwise it is shown only while a new customer registers and orders in one go (quick order). |
oo-cart-long |
15 |
Number of positions from which on the cart is considered "long": the in-cart search field (.oo-cart-search) and the view/sort controls (#oo-cart-view-controls) are shown, and the search filter is applied. |
oo-cart-view |
– | Forces the view mode: list or box (adds oo-cart-list / oo-cart-boxes to #oo-cart-table). If not set, the user's last choice (stored client-side) is used. |
oo-cart-sort |
– | Forces the position sorting: abo (classic: subscriptions and assortments first), az (by name), g (by group, then name), ts (by time added). Adds oo-cart-sort-<mode> to #oo-cart-table. If not set, the user's last choice is used. |
oo-cart-pos-mouseover |
true |
false disables the mouse-over interaction of the position controls (.oo-cart-pos-controls) in the cart. |
oo-cart-tpl |
– | Name of the server-side template body to load (e.g. cart.v2) when no body is embedded in the page. Unlike oo-template (HTML only) this can be configured. By default an instance id containing v2- loads cart.v2.html, otherwise cart.html. |
oo-item-image-pi-size |
40,40 |
Image size advice for position images as w,h[,bg] (width, height, background colour), passed through to the image proxy. Shared with the search, status, shop and ticker components. |
oo-quote |
false |
true renders the organic/regional quotes (.oo-cart-quotes-bio, .oo-cart-quotes-regio) — also on if the shop setting quotes is enabled in the backend. Values below 30% are hidden. |
Removed
oo-cart-oneperday/oo-oneperday— removed. Whether multiple orders per day are allowed is now a backend setting (allowMultiOrders in the Config object).
debug options
Debug scope cart (enable with data-oo-debug="true" on the element or debug:cart:<term>+, see the skill):
| Term | Description |
|---|---|
cart:all |
General debug output of the component (init, config values, state changes). |
cart:buttons |
Button configuration: which primary/secondary buttons are shown and why, required profile fields. |
cart:events |
Incoming events (oo-cart-changed, oo-navi-changed, …) and the resulting re-render. |
cart:pp |
PayPal: configuration, button rendering, authorisation/response data. |
cart:render |
Cart rendering: selected order, position loop, view/sort state, resolve callbacks. |
cart:pack |
Minimum order value check per packstation / pick-up station and the resulting warnings. |
cart:voucher |
Voucher and coupon check and redemption results (ok, used, tooearly, old, bad). |
cart:agb |
Terms & conditions (AGB) field handling (needsTC, re-acceptance field). |
Related scopes that are not component switches but are useful when debugging the cart (enabled the same way, e.g. debug:ch:cpos+):
| Scope | Terms | Description |
|---|---|---|
ch |
all, step, cpos, render, touch |
Shared cart position rendering: cpos why +/- controls are removed, step amount stepping, touch touch/mouse-over controls. |
cartjs |
all, dk, mod, abo, add, ld, ino, in |
Order handling: dk delivery costs / MOV override, mod order modification detection, abo subscriptions, add add-to-cart position lookup, ld order selection/loading, ino position availability (in time / preordered), in in-cart item checks. |
actions |
all, cart |
Cart actions (send, cancel, clear). |