Developer notes
Data flow
Section titled “Data flow”dispatch_before_display puts the page settings (Tygh.kv_side_cart) into storefront pages except checkout.*. They are the same for every visitor, so a cached page stays correct.
The script adds a hidden kv_sc=1 field to the add-to-cart forms of the page. controllers/frontend/checkout.post.php (mode add, POST, with that field) removes the “added to cart” notifications that the core set during the request and answers kv_sc_open (AJAX) or sets the one-time cookie kv_sc_open (full page load). The script opens the drawer on ce.ajaxdone or on the next page.
The drawer content comes from kv_side_cart.view|update|remove|coupon|uncoupon: POST and AJAX only, Cache-Control: no-store. Cart changes use the core functions of the cart page (fn_add_product_to_cart in update mode, fn_delete_cart_product, pending_coupon), so stock, quantity rules and promotions behave as on the cart page. Notifications raised during a change are shown in the drawer instead of the pop-up. After a change the script re-renders the core cart_status* blocks of the page.
JavaScript
Section titled “JavaScript”window.kvSideCart.open() and window.kvSideCart.close().
Templates
Section titled “Templates”| Template | Purpose |
|---|---|
hooks/index/scripts.post.tpl |
Script, texts and page settings |
components/body.tpl |
Drawer content |
License gate
Section titled “License gate”Drawer::isOn(): enabled, licensed and not a theme with the kit dock wrapper (blocks/wrappers/kv_dock.tpl).