
mxQuickView render types
General rules
- Always pass a valid
data-mxqv-id(the resource must exist and be viewable). data-mxqv-actiondefines what to render:chunk,snippet, ortemplate.data-mxqv-modedefines where to output:modalorselector.- The connector accepts only
POSTand onlyaction=render.
Choice matrix
| Task | data-mxqv-action | data-mxqv-mode |
|---|---|---|
| Product card | chunk | modal |
| Cart / mini-cart | snippet | modal |
| Quick view in a custom block | chunk or snippet | selector |
| Resource template render | template | modal or selector |
1. chunk
For manager
The basic, safest case: a dedicated card chunk (e.g. mxqv_product).
For developer
- Checked against
mxquickview_allowed_chunk. - Render:
$modx->getChunk($name, $props). $propsincludes resource fields,msProductData,variants_*(has_variants=true|false,variants_html,variants_json).
Example
modx
<button data-mxqv-click data-mxqv-mode="modal"
data-mxqv-action="chunk"
data-mxqv-element="mxqv_product"
data-mxqv-id="[[+id]]"
data-mxqv-title="[[+pagetitle]]">
mxQuickView
</button>fenom
<button data-mxqv-click data-mxqv-mode="modal"
data-mxqv-action="chunk"
data-mxqv-element="mxqv_product"
data-mxqv-id="{$id}"
data-mxqv-title="{$pagetitle}">
mxQuickView
</button>2. snippet
For manager
Use for elements already built by a snippet (e.g. msCart).
For developer
- Checked against
mxquickview_allowed_snippet. - Render:
$modx->runSnippet($name, $props). - Resource fields are passed as snippet parameters; for
msCart,idis removed andresource_idis set. - The snippet name in
data-mxqv-elementmay start with!(stripped in the processor). - POST fields
mode,output,modal_libraryapply only tomsCartrender (cart selector), nottemplate.
Example
modx
<button data-mxqv-click data-mxqv-mode="modal"
data-mxqv-action="snippet"
data-mxqv-element="msCart"
data-mxqv-id="[[+id]]"
data-mxqv-title="[[+pagetitle]]">
Cart
</button>fenom
<button data-mxqv-click data-mxqv-mode="modal"
data-mxqv-action="snippet"
data-mxqv-element="msCart"
data-mxqv-id="{$id}"
data-mxqv-title="{$pagetitle}">
Cart
</button>3. template
For manager
Used less often: when the resource should be rendered with a full template.
For developer
- Always checked against
mxquickview_allowed_template. - Empty
mxquickview_allowed_templatemeanstemplaterender is disabled. elementaccepts a template ID ortemplatename.- Render: the resource
templateis swapped temporarily, then$resource->process()runs with the template fromdata-mxqv-element(not necessarily the resource’s default template in the manager).
Example
modx
<button data-mxqv-click data-mxqv-mode="modal"
data-mxqv-action="template"
data-mxqv-element="12"
data-mxqv-id="[[+id]]"
data-mxqv-title="[[+pagetitle]]">
Template
</button>fenom
<button data-mxqv-click data-mxqv-mode="modal"
data-mxqv-action="template"
data-mxqv-element="12"
data-mxqv-id="{$id}"
data-mxqv-title="{$pagetitle}">
Template
</button>Output modes
modal
- Uses the mode from
modalLibrary(native,bootstrap,fancybox) inmxQuickView.initialize. - Supports a title (
data-mxqv-title). - Prev/next buttons and ←/→ keys work only with
modalLibrarynativeorbootstrap. Fancybox has no loop navigation.
selector
- Inserts the response into the container from
data-mxqv-output. - Use this when the site already has its own modal or a dedicated output area.
