Developer notes
Enforcement points
Section titled “Enforcement points”| Path | Where |
|---|---|
| Panel uploads, direct POST, API uploads, CSV images, URL and server images | update_image_pairs_pre |
| Descriptions in the panel, bulk edit, API | update_product_pre |
| Descriptions in CSV import | schemas/exim/products.post.php wraps fn_import_product_descr for Description, Short description and Promo text |
| “Remove additional images” in CSV | exim_import_images_pre |
| REST updates that replace images | api_check_access, at a priority after vendor_privileges, which is what opens product writes to vendors: core deletes old images before the upload, so the request is judged first |
GraphQL update_product, create_product |
update_image_pairs_pre, update_product_pre. Core deletes old images when the mutation sends a new list, with no hook before it |
| Attachments | attachment_add_file, attachment_update_file: emptying $uploaded_data stops core before the file is stored |
Who is limited: Limits::actorCompanyId() reads the session auth, set for the panel and for the API. Only user_type V with a company counts.
Core removes removed_image_pair_ids after the uploads, so update_product_pre records them and the count subtracts them.
Tables
Section titled “Tables”| Table | Contents |
|---|---|
?:kv_vpl_limits |
One row per plan. NULL is no limit, 0 is none allowed. plan_id 0 is for vendors without a plan. |
?:kv_vpl_events |
Refused items per company_id, type, day. |
Classes
Section titled “Classes”Tygh\Addons\KvVendorPlanLimits: Limits (values, actor, better plan), Guard (enforcement), Html (count and limit images in HTML), Notice (messages), Meter (product page), Events (log and report).
Full page cache
Section titled “Full page cache”The add-on prints only on plan cards, and that text depends on the plan, not on the visitor. Vendor panel output is never cached.
Core caches the “Vendor plan info” block, which contains the plan cards. schemas/block_manager/blocks.post.php adds ?:kv_vpl_limits to its update handlers, and a stamp for the license and the card setting to its cache key, so the block never shows old limits.
Hooks of other add-ons
Section titled “Hooks of other add-ons”Add-ons that save products through fn_update_product() and images through fn_update_image_pairs() are covered without extra code. Spreadsheet Bulk Product Editor writes this way.