Skip to content
  1. Extras
  2. mxQuickView
  3. For developers

API and interfaces ​

Snippet mxQuickView.initialize ​

Loads quick view CSS/JS and outputs the built-in modal HTML.

Parameters ​

ParameterDefaultDescription
modalSizenon-empty property overrides mxquickview_modal_size (transport modal-lg)modal-sm, modal-lg, modal-xl for native and bootstrap only
mouseoverDelaynon-empty property overrides mxquickview_mouseover_delayHover delay in ms. Empty property string means “not set”: the setting is used (default 300)
modalLibrarynativenative, bootstrap, fancybox (bootstrap5 alias). No window.bootstrap.Modal or no #mxqv-bootstrap-modal → native. No Fancybox API (Fancybox.show) → native
debugmxquickview_debug when parameter omittedConsole [mxqv] logs. Not in manager snippet properties; works via scriptProperties
loadingTextlexicon mxqv_loadingLoading text in modal/selector. Not in transport snippet properties
fancyboxCssmxquickview_fancybox_css if the parameter is omitted or emptyFancybox CSS URL/path; then bundled files or CDN
fancyboxJssameFancybox JS
bootstrapCsssameBootstrap CSS for modalLibrary=bootstrap
bootstrapJssameBootstrap JS

Trigger data attributes ​

AttributeDescription
data-mxqv-clickLoad on click
data-mxqv-mouseoverLoad on hover
data-mxqv-modeOutput mode: modal or selector (default modal)
data-mxqv-actionRender type: chunk, snippet, template (default chunk)
data-mxqv-elementChunk/snippet/template name or ID
data-mxqv-idResource ID
data-mxqv-titleModal title for mode=modal
data-mxqv-outputCSS selector for container when mode=selector
data-mxqv-contextContext key (for multi-language / multi-site)
data-mxqv-parentList container for loop
data-mxqv-looptrue — collect sibling triggers for prev/next (click only, not mouseover)

Call examples ​

modx
[[!mxQuickView.initialize?
  &modalSize=`modal-xl`
  &mouseoverDelay=`350`
  &modalLibrary=`native`
  &debug=`1`
  &loadingText=`Loading...`
]]
fenom
{'!mxQuickView.initialize'|snippet:[
  'modalSize' => 'modal-xl',
  'mouseoverDelay' => 350,
  'modalLibrary' => 'native',
  'debug' => 1,
  'loadingText' => 'Loading...'
]}

What it adds to the page ​

  • <link ... mxqv.min.css?v=filemtime> (fallback to mxqv.css if min not found)
  • <script>window.mxqvConfig = ...</script>
  • <script src="...mxqv.min.js?v=filemtime" defer></script> (fallback to mxqv.js if min not found)
  • Native modal markup (#mxqv-modal-backdrop, #mxqv-modal)
  • For modalLibrary=bootstrap: container #mxqv-bootstrap-modal and Bootstrap from bootstrapCss/bootstrapJs or bundled files. If missing, Bootstrap CDN
  • For modalLibrary=fancybox: Fancybox from fancyboxCss/fancyboxJs or bundled files. If missing, CDN @fancyapps/ui

Native modal CSS variables ​

For modalLibrary=native they are defined in assets/components/mxquickview/css/mxqv.css.

Full list ​

VariableDefaultPurpose
--mxqv-backdrop-bgrgba(0, 0, 0, 0.5)Backdrop background
--mxqv-backdrop-z-index1050Backdrop z-index
--mxqv-backdrop-padding-mobile0Backdrop padding on mobile
--mxqv-backdrop-padding-tablet1remBackdrop padding on tablet/desktop
--mxqv-modal-bg#fffModal background
--mxqv-modal-radius-mobile0Modal radius on mobile
--mxqv-modal-radius-tablet0.25remModal radius on tablet/desktop
--mxqv-modal-shadow0 0.5rem 1rem rgba(0, 0, 0, 0.15)Modal shadow
--mxqv-modal-width-mobile100%Modal width on mobile
--mxqv-modal-width-tablet90vwModal width on tablet/desktop
--mxqv-modal-max-width-mobile100%Modal max-width on mobile
--mxqv-modal-max-width-tablet90vwModal max-width on tablet/desktop
--mxqv-modal-max-height-mobile100%Modal max-height on mobile
--mxqv-modal-max-height-tablet90vhModal max-height on tablet/desktop
--mxqv-modal-size-sm24remMax width for modal-sm
--mxqv-modal-size-lg50remMax width for modal-lg
--mxqv-modal-size-xl70remMax width for modal-xl
--mxqv-header-gap0.5remHeader element spacing
--mxqv-header-padding1rem 1.25remHeader padding
--mxqv-header-border-color#dee2e6Header border
--mxqv-title-font-size1.25remTitle font size
--mxqv-title-font-weight600Title font weight
--mxqv-actions-gap0.25remAction button spacing
--mxqv-btn-padding0.25rem 0.5remControl button padding
--mxqv-btn-radius0.25remControl button radius
--mxqv-btn-font-size1.25remControl button font size
--mxqv-close-font-size1.5remClose button font size
--mxqv-body-padding1.25remBody padding
--mxqv-btn-hover-bg#f0f0f0Header button hover background
--mxqv-loading-color#6c757dLoading indicator text color
--mxqv-loading-padding1rem 0Loading indicator padding

Override example ​

css
:root {
  --mxqv-modal-size-lg: 56rem;
  --mxqv-modal-size-xl: 76rem;
  --mxqv-modal-bg: #ffffff;
  --mxqv-header-border-color: #e9ecef;
  --mxqv-backdrop-bg: rgba(0, 0, 0, 0.6);
}

Connector assets/components/mxquickview/connector.php ​

The connector accepts only POST with action=render and returns JSON.

Endpoint ​

  • Method: POST
  • Request Content-Type: application/x-www-form-urlencoded
  • Response: JSON { success, html?, message? }

POST parameters ​

ParameterRequiredDescription
actionyesOnly render
data_actionnochunk, snippet, template (default chunk)
elementyesChunk/snippet/template name
idyesResource ID (integer > 0)
contextnoContext key. Invalid value falls back to web
modenomodal or selector. Only in renderSnippet for msCart / msMiniCart
outputnoCSS selector. Only for msCart with mode=selector (snippet selector param)

Success response ​

json
{
  "success": true,
  "html": "<div>...</div>"
}

Error response ​

json
{
  "success": false,
  "message": "Chunk not allowed",
  "html": ""
}

Errors and messages ​

JSON field message is a resolved string, not a key. Before MODX loads, the connector returns English literals.

ConditionLexicon keyRUEN
Method not POSTmxqv_invalid_request exists in lexicon; PHP does not call italways Invalid request method
action != rendermxqv_invalid_actionlexicon: Invalid action
index.php not foundmxqv_index_not_found exists; PHP does not call italways index.php not found
Empty element or id <= 0mxqv_missing_element_or_idНе переданы element или idMissing element or id
Resource not foundmxqv_resource_not_foundРесурс не найденResource not found
No view accessmxqv_access_deniedДоступ запрещёнAccess denied
Chunk not in whitelistmxqv_chunk_not_allowedЧанк не разрешёнChunk not allowed
Chunk not foundmxqv_chunk_not_foundЧанк не найденChunk not found
Snippet not in whitelistmxqv_snippet_not_allowedСниппет не разрешёнSnippet not allowed
Snippet not foundmxqv_snippet_not_foundСниппет не найденSnippet not found
Template not in whitelistmxqv_template_not_allowedШаблон не разрешёнTemplate not allowed
Template not foundmxqv_template_not_foundШаблон не найденTemplate not found
Unsupported data_actionmxqv_invalid_data_actionНедопустимый тип рендераInvalid action

Snippet name in POST element for data_action=snippet: leading ! is stripped (Render.php).

JS API (via events) ​

There is no separate API object. CustomEvent events are dispatched on document:

EventWhendetail
mxqv:openModal opened{ title }
mxqv:closeModal closed—
mxqv:loadedContent inserted into modal{ content }
ms3:cart:updatedafter reinitIntegrations(){ source: 'mxqv' }

Keyboard (modal open) ​

  • Escape: closes only modalLibrary=native.
  • ← / →: prev/next in loop list (same as [data-mxqv-nav]), native/bootstrap only.

msCart / ms3 render markers ​

After msCart render, HTML may include hidden <span class="mxqv-ms3-render"> with:

  • data-mxqv-ms3-render-token — token for ms3Config.render.cart
  • data-mxqv-ms3-render-selector — optional cart container CSS selector

JS pushes the token into window.ms3Config.render.cart without inline script.

Request example ​

javascript
const response = await fetch('/assets/components/mxquickview/connector.php', {
  method: 'POST',
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  body: new URLSearchParams({
    action: 'render',
    data_action: 'chunk',
    element: 'mxqv_product',
    id: '7'
  })
});

const data = await response.json();