Skip to content

Field types

CDA Custom Fields supports 15 input types covering every common form pattern.

TypeHTMLStorageNotes
text<input type="text">varchar (≤64KB)Single-line. Use for short fields like VAT IDs, names, codes.
textarea<textarea>textMulti-line. Default 3 rows × 40 cols, customizable per template.
email<input type="email">varcharBrowser-level email validation.
phone<input type="tel">varcharNo format restriction — store as user typed.
url<input type="url">varcharBrowser-level URL validation.
number<input type="number">varcharNumeric input, mobile keyboards show numeric pad.
TypeHTMLStorageNotes
select<select> singlevarcharDefine options on the field form. First option is empty / “Please select…”
multiselect<select multiple>JSON arrayStored as JSON; queried as LIKE '%"val1"%' or via cda_custom_field_value parsing.
checkboxGroup of <input type="checkbox">JSON arraySame storage as multiselect but rendered as checkboxes.
radioGroup of <input type="radio">varcharOne selected value.
yesnoTwo-option <select> (Yes / No)varchar (1/0)Binary toggle. Shortcut over manually defining a 2-option select.
TypeHTMLStorageNotes
date<input type="date">varchar (ISO 8601 YYYY-MM-DD)Native browser date picker.
datetime<input type="datetime-local">varchar (YYYY-MM-DDTHH:MM)Native browser datetime picker. No timezone — store local.
TypeHTMLStorageNotes
file<input type="file"> + drag-dropJSON metadataSee secure upload section.
image<input type="file" accept="image/*">JSON metadataSame as file but client-side limited to image/*. MIME still validated server-side.

File and image fields stream the upload to pub/media/cda_custom_fields/<yyyy>/<mm>/<32-hex>.ext via a hardened endpoint:

  1. Magic-byte MIME detectionfinfo_file(FILEINFO_MIME_TYPE) reads the file’s actual content type, ignoring the extension and $_FILES['type'] (both client-controlled).
  2. Extension reverse-mapped from MIME — the saved filename’s extension comes from our server-side MIME→ext table, not from the user.
  3. Filename randomizationbin2hex(random_bytes(16)) ensures storage paths are unguessable.
  4. HMAC-SHA256 signed download URLs — every download link includes a signature derived from a per-installation secret (Magento crypt key, salted). URLs expire after 24h by default (configurable).
  5. 4-tier authorization — even with a valid signature, downloads check: admin session → owned-order match → current-quote match → session-pinned upload. No bearer-token-only access.
image/jpeg, image/png, image/webp, image/gif, application/pdf,
application/msword, application/vnd.openxmlformats-...wordprocessingml.document,
application/zip

Configure under Stores → Configuration → CDA → Custom Fields → File & Image Uploads.

10 MB per file. Configurable per store. Magento’s own upload_max_filesize / post_max_size PHP limits still apply.

A daily cron job (cda_customfields_cleanup_orphans at 03:15 UTC) deletes uploaded files that aren’t referenced by any cart or order. Default retention: 7 days, configurable.

Most fields store their value as a plain string in the value column of the appropriate _value table:

SurfaceTable
Cart / Checkoutcda_custom_field_quote_value
Order (denormalised at place-order)cda_custom_field_order_value
Customer registration / profilecda_custom_field_customer_value
Customer address bookcda_custom_field_address_value
Contact formcda_custom_field_contact_value
Product reviewcda_custom_field_review_value
Newslettercda_custom_field_subscriber_value
Wishlist itemcda_custom_field_wishlist_item_value

file and image field values are stored as a JSON blob:

{
"path": "2026/05/abc123def456...12char.jpg",
"name": "customer-original-filename.jpg",
"mime": "image/jpeg",
"size": 245678
}

multiselect and checkbox values are stored as JSON arrays of selected values.

Everything else is plain string storage. This keeps querying simple — no joins to look up an option’s label.

  1. Customer submits a form (POST).
  2. The relevant observer (e.g. cart_save_after, customer_register_success) reads the cda_*_custom_fields[code] POST keys.
  3. Values insert into the surface-specific _value table, keyed by quote/customer/order/etc.
  4. On Place Order, a sales_model_service_quote_submit_success observer copies cart values from quote_value into order_value, preserving them for historical orders even if you later delete the field definition.