Skip to content

Developer notes

Each event owns one core promotion (?:promotions, zone catalog, company 0, no conditions, dates = event dates, status A only while the event is published and has approved products). Its only bonus is kv_campaign_event (value = event id), registered in schemas/promotions/schema.post.php. The bonus function looks the product up in the approved nominations of running events and calls the core fn_promotion_apply_discount() with a fixed amount that brings the price down to the event price (option modifiers kept). It never raises a price: when another promotion or a customer group price is already lower, it does nothing.

The bonus row on the product gets a marker kv_ce (n nomination id, e event id, d discount per unit). The core stores it in order_details.extra.promotions, which is the proof used for funding.

Marketing > Promotions sends the editor and delete actions of an event promotion to the event page (controllers/backend/promotions.pre.php).

  • One ledger row per order, event and kind in ?:kv_ce_funding (F funding, R reversal for return rma<return_id>), unique key on (order_id, event_id, kind, ref).
  • The core row is written with Tygh\VendorPayouts::update(): type payout, approval C, order_id = the vendor (child) order, amount negative for a credit and positive for a reversal, comment ending with [KCE-<entry id>].
  • Core counts payout rows with an order id only while the order status has “calculate for payouts”, so the credit follows the order status without our code.
  • Writes run under a MySQL lock per order; an interrupted write is adopted by its marker.
Table Content
kv_ce_events, kv_ce_event_descriptions Events and their texts per language
kv_ce_nominations Nominations with regular price (frozen at approval), reference price and source, event price, discount, unit limit, status P/A/R/W, rule check result
kv_ce_order_lines Vendor order lines sold at an event price, discount per unit, funding, returned units
kv_ce_funding Funding ledger linked to vendor_payouts.payout_id

place_order (event lines + funding of vendor orders, also on order edits), rma_update_details_create_payout (returns), delete_order, delete_product_post, delete_company.

  • Omnibus Price History: History::getLowest([...], storefront, 30, 'rolling') for the reference price; Recorder::queue() after approvals so the new prices are recorded.
  • Urgency & Social Proof reads promotion end dates itself; our countdown setting “Automatic” hides ours while it is active.

Badge, strip and event page contain no visitor data. The countdown is computed in the browser from the end time. Approvals and event changes write ?:promotions, which invalidates cached pages and blocks through the core cache tags.