Skip to content

Developer notes

Overview · Installation · Configuration · Usage · FAQ

Table Content
?:kv_stl_looks look_id, company_id (Ultimate: storefront, Multi-Vendor: vendor, 0 = marketplace), status A/D/P, position, pin_style, timestamps
?:kv_stl_look_descriptions name, description, page_title, meta_description per language
?:kv_stl_hotspots hotspot_id, look_id, product_id, pos_x / pos_y (percent of the photo), position
?:kv_stl_stats day (YYYYMMDD), look_id, hotspot_id (0 = look), event (v view, c click, a add to cart, o ordered), hits, revenue

The look photo is an image pair of object type kv_stl_look (fn_get_image_pairs($look_id, 'kv_stl_look', 'M')). Look page SEO names use the SEO object type l (schemas/seo/objects.post.php); they are written when a look is saved, never lazily on a storefront request.

pre_add_to_cart (marks cart items added with the request parameter kv_stl_look_id of an active look as extra.kv_stl_look), add_to_cart (add event), place_order (ordered units and item subtotals; new orders only, Multi-Vendor parent order once), delete_product_post, delete_company. Template hook products:product_tabs (pre) for the product page section. All signatures are identical in 4.17.2 and 4.21.2 (add_to_cart has a fourth argument since 4.21; the handler takes it as optional).

  • Block type kv_shop_the_look (schemas/block_manager/blocks.post.php), content function fn_kv_shop_the_look_block_looks(), templates in blocks/ (spotlight, grid, carousel), block settings kv_source, kv_look_ids, kv_limit. Block cache: update handlers on the add-on and product tables, request handlers product_id / category_id / company_id, callable key (licence, language, currency, pin style, colour); no cache for signed-in customers (usergroup prices). The products.view main block cache gets the same tables and key.
  • Controller kv_shop_the_look: view (look page), lookbook, track (POST beacon: look_id, event v|c, hotspot_id; 204, Cache-Control: no-store; CSRF check off for this mode only).
  • Templates: components/look.tpl (one look), components/tile.tpl (tile + dialog), views/kv_shop_the_look/*, hooks/products/product_tabs.pre.tpl. CSS classes are prefixed kv-stl-; colours come from the custom properties --kv-stl-accent and --kv-stl-ink.
  • js/addons/kv_shop_the_look/func.js: cards, bottom sheet, pickers and totals ($.formatNum with the store’s currencies), add to cart through $.ceAjax to checkout.add, dialogs, tabs, carousel, beacon via sendBeacon.

To restyle, override the LESS in your theme (css/addons/kv_shop_the_look/styles.less) or add rules for the kv-stl- classes. To place the look markup elsewhere, include addons/kv_shop_the_look/components/look.tpl with look= one item of fn_kv_shop_the_look_block_looks().

Design, not yet run with the cache: all storefront output is catalogue data (no session data). Statistics and cart additions are POST requests. ?:kv_stl_stats is in ignore_cache_tags (schemas/full_page_cache/varnish.post.php), so counter writes are not meant to purge cached pages; the look tables stay cache tags.

Controller kv_shop_the_look: manage, add/update (tabs General, Hotspots, SEO, Performance), analytics, products (JSON product search of the editor), POST update, delete, m_delete, update_status, m_update_status, clone. Privileges: view_catalog / manage_catalog; vendors (vendor_multivendor schema) see and change only their own looks and tag only their own products.

app/addons/kv_shop_the_look/
addon.xml init.php func.php
controllers/backend/kv_shop_the_look.php, kv_shop_the_look_license.php
controllers/frontend/kv_shop_the_look.php, products.post.php
schemas/block_manager/blocks.post.php schemas/full_page_cache/varnish.post.php
schemas/menu/menu.post.php, menu_vendor.post.php schemas/permissions/admin.post.php, vendor_multivendor.post.php
schemas/security/csrf_validation.post.php schemas/seo/objects.post.php, canonical_urls.post.php
Tygh/Addons/KvShopTheLook/Config.php Looks.php Stats.php Storefront.php Seo.php
Tygh/Addons/KvShopTheLook/License/ (licence client) Upgrade/Synchronizer.php
design/backend/templates/addons/kv_shop_the_look/ (views, components, license, hooks)
design/backend/css/addons/kv_shop_the_look/ (styles.less, license.less)
var/themes_repository/responsive/templates/addons/kv_shop_the_look/ (blocks, components, views, hooks)
var/themes_repository/responsive/css/addons/kv_shop_the_look/styles.less
js/addons/kv_shop_the_look/func.js, editor.js
var/langs/en/addons/kv_shop_the_look.po

Tygh\Addons\KvShopTheLook\License\Client::isActive() (through Config::isActive()) gates the storefront output, the beacon and the crediting of cart additions. It reads only the stored result; the check with cs-cart.kaviolabs.com runs from the admin panel or cron (php admin.php --dispatch=kv_shop_the_look_license.check).