Skip to content

Developer notes

Technical reference of Click & Collect Workflow: data, hooks, REST API and the full page cache. Back to the overview.

The add-on never changes core files. Add-on ID: kv_click_collect. It depends on the core add-on store_locator.

Table Content
?:kv_clc_locations Pickup settings per store location (store_location_id, company_id; location 0 = the shop address of a company): enabled, window mode (S / D / N), hours source (A = Store Locator Pro when filled, O = own), hours (JSON, ISO weekday => [[open, close]]), closed dates, window length, capacity, preparation minutes, cut-off, days to offer, instructions. Empty / -1 = add-on default.
?:kv_clc_orders One pickup per order (Multi-Vendor: per vendor order): company, location, shipping method, location name, window (date, from, to), code, state (P preparing, R ready, C collected, X cancelled), ready / collected time and user, reminders.
?:kv_clc_log Pickup history per order (event, user, detail, time).

The Ready for pickup status is a normal order status with the status param kv_clc_ready = Y; its customer e-mail template is order_notification.<status>. Store Locator Pro data is read from ?:kv_sloc_stores (hours, special days, time zone) and its holidays setting.

PHP: checkout_update_steps_pre (posted kv_clc_slot[<group>] kept in $cart['kv_clc_slot']), calculate_cart_post (checkout data $cart['kv_clc'], “collect instead” offers $cart['kv_clc_hint'], only on the storefront checkout), pre_place_order (window check under GET_LOCK per window), place_order (pickup record; Multi-Vendor parent orders skipped), place_order_post (locks released), get_order_info ($order['kv_clc']), change_order_status (state sync), delete_order, delete_company, store_locator_delete_store_location_post.

Templates: storefront checkout:shipping_method (post, picker), checkout:shipping_methods_list (post, Local Delivery Zones hint), orders:info (post, pickup pass); admin orders:shipping_info (post, order panel). Pages: kv_clc.manage, kv_clc.locations, kv_clc.location (admin / vendor), kv_clc.pass (storefront).

The chosen store is read from product_groups[*].chosen_shippings[*].store_location_id, select_store (4.17 / 4.18) and select_pickup_point (4.21).

$order_info.kv_clc (Smarty) / order_info.kv_clc (Twig): state, state_text, code, code_display, payload (QR text KVCC:<order id>:<code>), location_name, address, phone, instructions, slot_date, slot_from, slot_to, window_text, ready_at, collected_at, reminders, reminder (true in a reminder e-mail), pass_url, qr_url (PNG, empty when the QR code is off).

Entity kv_pickups (administrator API keys; Multi-Vendor vendor administrators reach their own pickups when the vendor desk is on).

Request Result
GET /api/kv_pickups?tab=today&location=12:1&q=smith Pickups (tab: today, prepare, ready, overdue, collected, cancelled, all).
GET /api/kv_pickups/1234 One pickup with its history.
GET /api/kv_pickups?slots=Y&store_location_id=12 Pickup windows of a location: days with from, to, left (null = no limit), full.
PUT /api/kv_pickups/1234 {"action": "ready"} Marks ready (status + notice as configured).
PUT /api/kv_pickups/1234 {"action": "collect", "code": "7KQ9AB"} Hand-over with the code; {"action": "collect", "override_reason": "..."} without it.
PUT /api/kv_pickups/1234 {"action": "remind"} / cancel / regenerate Reminder, cancel, new code.

Errors answer 400 with a message (wrong code, wrong state), 403 when the add-on is off or not licensed, 404 for another company’s pickup.

php admin.php --dispatch=kv_clc.cron (console) or index.php?dispatch=kv_clc.cron&key=<cron key> (403 with a wrong key). One run handles up to 200 (console) / 100 (URL) pickups and is guarded by a database lock.

The add-on prints nothing on cacheable dispatches (products, categories, pages, home). The picker is on checkout.*, the pass on orders.details and kv_clc.pass (Cache-Control: private, no-store, noindex). The QR image kv_clc.qr is private, max-age=3600. Pass and QR links carry an HMAC of the order id and the code; a new code invalidates them.

Without a valid license the checkout picker, new pickup records, the desk actions, the pass page, the QR image and the automation are off; existing data and settings are kept.