Skip to content

Developer notes

Item Value
Add-on id kv_theme_cadence
Theme kv_cadence (child of responsive)
Data class Tygh\Addons\KvThemeCadence\Theme\Box (hooks gather_additional_products_data_post, dispatch_before_display, render_block_register_cache; admin: dispatch_before_display for Theme\Seed)
Card data $product.ca_box (month {ym, mon, month, year}, theme, items [{name, note}], n, serves), $product.ca_plans (n, list [{plan_id, name, label, saving, price, beat[8], skip, pause, trial}], best, skip, pause)
Block source $ca_src = Theme\BoxSource (subs(), bab(), cycle(), byMonth($items), bestPlan($items)); $ca_cycle = {cutoff, ship}
Feature codes BOX_MONTH (YYYY-MM), BOX_THEME, BOX_ITEMS, BOX_SERVES
Plans read from kv_sub_plans / kv_sub_plan_products with the same rule as Plans::forProduct (active, marketplace-wide or the product’s vendor); prices through Pricing::unit, labels through Plans::label / discountLabel; no write to those tables except the demo setup below
Rhythm beat Box::beat(unit, cnt): 8 slots = 8 weeks, a slot is lit every round(period / 7) weeks
Order-by countdown settings cutoff_day, ship_day -> Tygh.ca_cycle; js/addons/kv_theme_cadence/theme.js computes the open cycle for today in the browser ([data-ca-month]); in the static demo “today” is KVDEMO.exported
Demo setup Tygh\Addons\KvThemeCadence\Theme\Seed from data/box.json through Plans::save; state var/kv_storage/kv_theme_cadence/box.json, own list box_plans.json (removed on uninstall; Plans::delete disables plans that have subscribers)

Block templates: blocks/products/kv_ca_tiers.tpl, kv_ca_month.tpl, kv_ca_calendar.tpl, kv_ca_shelf.tpl. Hooks: products:product_data (post: calendar tab + repeat sticker into the product labels capture), products:list_price_block (pre: rhythm beat, per-delivery price, chips), products:main_info_title (post: box head, promise chips, plan data for the script), products:product_detail_bottom (post: In the box, Made for, maker), index:scripts (pre: JS strings and cycle). Cached pages carry catalogue data and the two settings only (full page cache); everything that depends on today is computed in the browser. The product blocks key their block cache by currency and drop it on plan and feature changes. Build-a-Box Bundles takes its colours from the CSS variables --kv-bab-* set on .kv-bab-builder by the theme.