Skip to content

Developer notes

Technical reference for developers who customize Bulk Quick Order Form.

Item Value
Add-on id kv_b2b_quick_order_form
Function prefix fn_kv_b2b_quick_order_form_
Language variables kv_b2b_quick_order_form.*
CSS scope .kv-b2b-quick-order-form (BEM elements __row, __sku, __qty, …)
PHP namespace Tygh\Addons\KvB2bQuickOrderForm

The page and the block render a static shell (components/form.tpl, no prices, no customer data). js/addons/kv_b2b_quick_order_form/func.js starts the form on ce.commoninit for every [data-kv-qof] element and talks to the storefront controller kv_b2b_quick_order_form with core $.ceAjax (answers in response.kv_qof).

Mode Method Purpose
view GET The quick order page (not a full-page-cache dispatch; X-Robots-Tag: noindex)
init GET Access result, signed-in flag, enabled features
search GET q Type-ahead: fn_get_products with pcode_from_q, pname, include_child_variations=Y, group_child_variations=N; exact SKU first, up to 8
check POST lines[n][sku|product_id|qty] Result per line
add POST lines Checks again, adds the valid lines with fn_add_product_to_cart(), then fn_calculate_cart_content() + fn_save_cart_content() like checkout.add
orders, order_lines GET Recent orders of the signed-in customer (fn_get_orders), lines of one own order
lists, list_get, list_save, list_delete GET / POST Saved lists of the signed-in customer

All endpoints answer AJAX requests only (Cache-Control: private, no-store). POST requests need the core security hash: schemas/security/csrf_validation.post.php turns on CSRF validation for the controller. Ownership of orders and lists is checked on every request (user id, and the storefront on Ultimate).

Prices and availability come from core: fn_get_product_data($id, $auth, …, $get_qty_discounts = true) and fn_gather_additional_product_data(…, get_discounts). Whatever hooks into these (user-group prices, catalog promotions, quantity tiers, price-list add-ons, hidden prices) is respected automatically. The unit price for a quantity is the best quantity tier at or below it (core applies catalog promotions to each tier). Products whose price another add-on hides (kv_rfq_price_hidden) show no price.

Line results (Catalog::check): status = ok, adjusted (reasons: min, step, max, stock), merged (into = key of the first line) or error (code: unknown, unavailable, out_of_stock with available, options, no_price, qty, not_added, empty). The quantity rules mirror fn_check_amount_in_stock() (min rounded to the step, max floored to the step, stock minus the cart, pre-order, EDP, negative stock and inventory tracking settings). After add, the real cart content decides: core notifications raised while adding are folded into the line results and removed from the session, so they do not pop up later.

Multi-Vendor: a SKU used by several vendors resolves to the vendor with stock and the lowest price; common products of the Master products add-on resolve to their best vendor offer (master_product_id).

Hook Purpose
post_delete_user (PHP) Deletes the saved lists of a deleted customer
profiles:my_account_menu (template, post) The Quick order link in the account menu (signed-in customers only, part of the core account block)
index:scripts, index:styles (template, post) Script and LESS

No hooks into the cart, checkout or prices: the add-on only calls core functions.

Table Columns
?:kv_qof_lists list_id, user_id, company_id (storefront on Ultimate, 0 on Multi-Vendor), name, created_at, updated_at
?:kv_qof_list_items list_id, position, product_id (0 when only a SKU was saved), product_code, amount

Both tables are dropped on uninstall.

  • Templates: var/themes_repository/responsive/templates/addons/kv_b2b_quick_order_form/ (views/…/view.tpl page, blocks/quick_order_form.tpl block, components/form.tpl shell, components/strings.tpl texts for the script). Copy a template to your own theme’s folder to change it; keep the data-kv-qof* attributes.
  • Styles: css/addons/kv_b2b_quick_order_form/styles.less, every rule scoped under .kv-b2b-quick-order-form.
  • Tygh.kvQuickOrder.parseList(text) returns the parsed [{sku, qty}] lines (for your own import buttons).

Tygh\Addons\KvB2bQuickOrderForm\License\Client (generated) verifies the license. Gate point: Config::isActive() (enabled setting + license) in the controller (page and every endpoint), the block and the account link. Off means: the page, block and link disappear and the endpoints answer nothing; the cart, checkout, orders and saved lists are untouched.

A product matrix for variations on the product page, quick order inside the vendor panel or admin order editor, a REST API entity, sharing lists between customers of one company.

Path Purpose
app/addons/kv_b2b_quick_order_form/addon.xml Settings, tables
init.php, func.php Hooks, storefront flags, settings info, fn_kv_b2b_quick_order_form_is_licensed()
Tygh/Addons/KvB2bQuickOrderForm/Catalog.php Search, SKU resolution, line checks, prices
Cart.php Adding to the cart with core functions
Lists.php Saved lists, recent orders, order lines
Config.php, Format.php Settings and access rule, price/date text
License/, controllers/backend/kv_b2b_quick_order_form_license.php License check (generated)
Upgrade/Synchronizer.php Self-healing upgrades (generated)
controllers/frontend/kv_b2b_quick_order_form.php, init.post.php Page, endpoints, flags
schemas/ Block, CSRF rule, settings variants
var/themes_repository/responsive/templates/addons/kv_b2b_quick_order_form/ Page, block, form shell, account link
js/addons/kv_b2b_quick_order_form/func.js The form (jQuery, core $.ceAjax)