Skip to content

Developer notes

Path Purpose
app/addons/kv_vendor_storefront_pro/addon.xml Settings, install/uninstall queries (tables, privileges), e-mail templates
func.php Licence gate fn_kv_vendor_storefront_pro_is_licensed(), storefront view data fn_kv_vendor_storefront_pro_get_view_data(), block content function, cache key, hook handlers, uninstall
init.php Hook registration, synchronizer and licence blocks
controllers/backend/kv_vendor_storefront.php Modes manage, update (+ actions save, submit, publish), approve, reject, unpublish, m_approve, plans, preview
controllers/frontend/companies.post.php Assigns $kv_vsp and the meta description on companies.view / companies.products
controllers/frontend/kv_vendor_storefront.php Signed draft preview kv_vendor_storefront.preview
Tygh/Addons/KvVendorStorefrontPro/Profile.php Profile structure, defaults, sanitizing and validation, changed sections, colour contrast
.../Images.php Banner upload: validation, GD re-encoding, storage, cleanup
.../Service.php Storage, draft/review/publish workflow, plan features, featured product filter, e-mails
.../Preview.php HMAC preview tokens (24 hours)
.../License/Client.php, License/Ed25519.php Domain-bound licence client (generated)
.../Upgrade/Synchronizer.php Self-healing in-place upgrades (generated)
controllers/backend/kv_vendor_storefront_pro_license.php “Check now” and cron licence check (generated)
schemas/block_manager/blocks.post.php Block type kv_vendor_storefront_pro; cache handlers for the companies.products main block
schemas/menu/menu_multivendor.post.php, menu_vendor.post.php Vendors → Storefront profiles (admin), Storefront profile (vendor; Seller tools with the Vendor panel configurator)
schemas/permissions/admin.post.php, vendor_multivendor.post.php Privileges; vendors may use update, preview (and manage, which redirects to update)
design/backend/templates/addons/kv_vendor_storefront_pro/views/kv_vendor_storefront/{manage,update,plans}.tpl Admin and vendor pages (each starts with the licence status bar)
.../components/status_label.tpl Profile status label
.../license/{card,status_bar,badge,info}.tpl Licence UI (generated)
var/themes_repository/responsive/templates/addons/kv_vendor_storefront_pro/components/*.tpl page, announcement, header, about, featured, icon (inline SVG)
.../hooks/companies/{view,products}.pre.tpl Automatic placement
.../blocks/vendor_storefront/{header,about,featured,announcement}.tpl Block templates
.../views/kv_vendor_storefront/preview.tpl Preview page
var/themes_repository/responsive/css/addons/kv_vendor_storefront_pro/styles.less Storefront styles, scoped under .kv-vsp, built on the theme variables
design/backend/css/addons/kv_vendor_storefront_pro/styles.less Admin styles, scoped under .kv-vsp-admin
js/addons/kv_vendor_storefront_pro/func.js “Open now” status and today’s row (browser, store time zone)
js/addons/kv_vendor_storefront_pro/backend.js Editor helpers: colour picker, character counters, closed days

cscart_kv_vsp_profiles: company_id (primary key), status (D draft, P waiting for review, A published, R changes rejected), draft and published (JSON, ASCII-escaped), trusted (Y/N), reject_reason, submitted_at, published_at, updated_at, reviewed_by.

cscart_kv_vsp_plan_features: plan_id (primary key), features (comma list of banner, accent, announcement, about, policies, contact, social, featured), featured_limit.

The storefront reads only published. Banners are stored with the core images storage at kv_vendor_storefront_pro/<company_id>/<sha1>.<ext>; the content-addressed name lets the draft and the published version use different files. Files that neither version references are deleted after each save, approval or unpublish.

Hook Where (4.21.2 / 4.17.2) Handler
render_block_pre Tygh\BlockManager\RenderManager::renderBlockContent() 545 / 543 Returns empty content for the core vendor_logo and vendor_information blocks on companies.products / companies.view of vendors with a published profile (setting “Replace the core vendor blocks”, automatic placement)
delete_company fn.companies.php 1234 / 1223 Deletes the vendor’s profile and banners
vendor_plan_after_delete vendor_plans VendorPlan.php 441 / 441 Deletes the plan’s feature row
init_templater_post (synchronizer, only while an upgrade is pending) Upgrade\Synchronizer::run()
before_dispatch (static handler of License\Client, admin area) Licence checks and notices

Template hooks: companies:view and companies:products (pre), index:styles and index:scripts (post). The add-on’s priority is 2200, after Vendor Vacation Mode (2100), so the vacation banner is printed above the profile.

Own hook: kv_vendor_storefront_pro_get_view_data_post($company_id, $profile, &$view) after the storefront data of a vendor is built.

  1. The editor posts the whole form; Profile::sanitize() turns it into a clean profile (plain text, validated URLs and colours, normalised times and dates). Sections the vendor’s plan does not include keep their stored values. Featured products are limited to the vendor’s own products and the plan limit.
  2. Service::save() stores the draft and, depending on the action, publishes it (published = draft), marks it for review (P, e-mail to the administrator) or keeps a draft. Vendors cannot publish while approval is required (a forged publish becomes submit); the vendor is always runtime.company_id.
  3. On the storefront, controllers/frontend/companies.post.php calls fn_kv_vendor_storefront_pro_page_data() → fn_kv_vendor_storefront_pro_get_view_data(), which combines the published profile, the plan features, the core vendor data (logo, address, timestamp), the rating from the discussion tables, the active product count and the featured products (fn_get_products + fn_gather_additional_products_data), and assigns $kv_vsp.
  • The published profile is read through Registry::registerCache() with the condition table kv_vsp_profiles, so every change invalidates the Registry cache and, with the full page cache, BANs the cached pages tagged with the table.
  • The core caches the main block of companies.products for guests. The add-on adds kv_vsp_profiles, kv_vsp_plan_features, companies, company_descriptions, logos, images_links, images, discussion_posts, discussion_rating, vendor_plans to its update handlers and a callable handler (licence state, day, display settings) to its key. The block type has the same handlers plus product tables and the currency.
  • Nothing per visitor is printed: “Open now” and today’s row are calculated by func.js. Storefront requests never write (no ?:storage_data, no own tables).
  • Draft previews use their own dispatch, which is not cacheable, and send X-Robots-Tag: noindex.
  • Tested with the full page cache emulation: the About page is served from the cache (HIT) with identical profile markup for different guests; companies.products is not cacheable in core (it writes the session for sorting), with or without the add-on.

fn_kv_vendor_storefront_pro_is_licensed() (cached per request, never throws) gates the storefront: fn_kv_vendor_storefront_pro_page_data() (automatic placement, meta description, core block replacement), the block content function and the preview controller. Admin and vendor pages, the workflow, e-mails, uninstall and data are never gated. Block-cached output varies with the licence through the kv_vsp callable handler.

  • Vendors: every backend request uses runtime.company_id; company_id in the request is ignored for vendors; list, approve, reject, unpublish and plans are denied for vendors in the permission schema and in the controller.
  • CSRF: all changes are POST requests with the core security hash.
  • Output: all profile texts are plain text and auto-escaped by the templates; URLs are limited to http(s) (social links to the network’s hosts, https forced); target="_blank" links use rel="nofollow noopener".
  • Uploads: type detected from the content (JPEG, PNG, WebP), size and pixel limits, decoded and re-encoded with GD (drops metadata and payloads), stored under a hash name with a fixed extension.
  • Preview tokens: HMAC-SHA256 with the store’s crypt key, bound to the vendor, valid 24 hours.