Skip to content

Developer notes

Overview · Installation · Configuration · Usage · FAQ

Hook dispatch_before_display (storefront only, controller status OK) handles products.view, categories.view, product_features.view, pages.view and, on Multi-Vendor, companies.products / companies.view. Runtime::apply():

  1. loads the object’s variables and its stored meta from the database (Context::load(), current storefront and language; Ultimate: ult_product_descriptions / ult_product_prices of the storefront company);
  2. picks the template text per field (Templates::resolve()), renders it (Syntax::render()) and applies the length rules (Templates::finish());
  3. for each field whose template is Override, or whose stored value is empty, assigns the core view variables page_title, meta_description, meta_keywords and the same keys of the page’s object (product, category_data, variant_data, page).

The “stored value” is read from the database, not from the view, because CS-Cart fills an empty product meta description from the full description at runtime (AUTO_META_DESCRIPTION). For vendor pages the value already assigned to the view counts.

The add-on prints no tags. Its priority is 2850, so it runs before SEO Pro Suite (2900), which reads the object’s page_title / meta_description for its Open Graph and Twitter tags.

Full page cache. The output depends only on the URL, the storefront and the language. Prices are base prices in the primary currency. Templates are read through a Registry cache tagged kv_smt_templates; the aggregates ({min_price}, {product_count}) through Registry caches tagged with the product tables. No storage_data writes at runtime.

Table Columns
?:kv_smt_templates template_id, object_type (P product, C category, B brand page, V vendor page, A page), scope_id (category or feature, 0 = all), storefront_id (0 = all), lang_code (‘’ = all), mode (E only when empty, O override), status (A/D), title, description, keywords, updated_at; unique (object_type, scope_id, storefront_id, lang_code)
?:kv_smt_fill_log log_id, run_id, object_type, object_id, lang_code, field (core column), value_hash (md5 of the written value), created_at, user_id

Resolution rank: category/feature distance × 4 + (storefront 0 ? 2 : 0) + (language ‘’ ? 1 : 0); lowest wins per field among templates with a non-empty text.

Bulk::start() counts the objects of each type and language with at least one selected field empty; Bulk::step() processes 100 objects after a cursor (primary key), writes only fields that are still empty (UPDATE ... WHERE column = '') and logs every write; Bulk::undo() empties a logged field while its current value still has the logged hash. The admin page drives the steps with AJAX. Brand pages are the variants of brand-type features; link pages are skipped.

Endpoints (admin, kv_seo_meta_templates.*)

Section titled “Endpoints (admin, kv_seo_meta_templates.*)”

manage, update (GET/POST), delete (POST), preview (POST, AJAX), samples (GET, AJAX), audit, bulk, bulk_start / bulk_step / bulk_undo (POST, AJAX). Permissions: view_catalog / manage_catalog. Vendors (Multi-Vendor) are refused.

Hook Use
dispatch_before_display Applies the templates on the storefront
delete_category_post, delete_feature_post Removes the templates scoped to the deleted category / feature
delete_product_post, delete_page, delete_product_feature_variants_post Removes bulk-fill log rows of deleted objects

All hooks exist with the same arguments in 4.17.2 and 4.21.2.

Tygh\Addons\KvSeoMetaTemplates\License\Client (generated) verifies the license. Gate points: Runtime::apply() (through fn_kv_seo_meta_templates_storefront_active()) and bulk_start / bulk_step. Not gated: the template editor, the preview, the audit and undo.

Image ALT text templates, templates edited by vendors, duplicate detection of generated (not stored) values, Open Graph-only templates (SEO Pro Suite follows the generated values).

Path Purpose
app/addons/kv_seo_meta_templates/addon.xml Settings, tables
init.php, func.php Hooks, licence helpers, preview samples
Tygh/Addons/KvSeoMetaTemplates/Syntax.php Template syntax, clean-up, truncation, keywords
Types.php, Env.php Object types and variables; storefronts, languages, settings, prices
Context.php Variables and stored meta of one object
Templates.php Storage, resolution, build of the fields
Runtime.php Storefront application
Bulk.php, Audit.php Bulk fill with undo; meta audit
License/, controllers/backend/kv_seo_meta_templates_license.php License check (generated)
Upgrade/Synchronizer.php Self-healing upgrades (generated)
controllers/backend/kv_seo_meta_templates.php Admin pages and AJAX endpoints
schemas/ Menu, permissions
design/backend/templates/addons/kv_seo_meta_templates/ Admin pages
js/addons/kv_seo_meta_templates/backend.js Editor (variables, live preview) and bulk job