Skip to content
msBundles
msBundles
Product bundles for miniShop3 with shared pricing, discounts, and cart sync
  • MODX 3
  • PHP 8.2
  • miniShop3
  • Vue 3
  1. Extras
  2. msBundles
  3. Storefront
  4. msBundles snippet

msBundles ​

Renders HTML for product bundles. Put it in the product template or anywhere you need set cards.

Selection order ​

  1. bundle > 0 — one bundle by ID. Inactive with activeOnly=1, or a context_key that does not match the current request context → empty.
  2. Else non-empty bundles — bundles by ID list (order as in the parameter). IDs from another context are skipped.
  3. Else list=all — all bundles in the current context (by sortorder).
  4. Else product > 0 — bundles that include the product in the current context.
  5. Otherwise emptyTpl.

With msbundles_stock_behavior=hide and unavailable required stock, the card is omitted. block and message keep the card with --blocked / --warning modifiers.

With no bundle image and imageFallback=1, the first product thumb is used.

Parameters ​

ParameterDefaultDescription
product0Product resource ID. Bundles that include it in the current context
bundle0Single bundle ID (instead of product)
bundles—Comma-separated IDs: 5,8,12
list—all — all bundles in the current context (by sortorder)
tpltplMsBundlesItemCard chunk
wrapperTpltplMsBundlesListList wrapper
emptyTpltplMsBundlesEmptyEmpty result
productTpltplMsBundlesProductComposition line chunk
imageFallback0No bundle image → first product thumb
activeOnly1Active bundles only
quantity1Bundle count for price and stock
toPlaceholder—Placeholder name. Snippet returns an empty string

Examples ​

On a product page:

fenom
{'!msBundles' | snippet : [
  'product' => $_modx->resource.id,
  'tpl' => 'tplMsBundlesItem',
  'wrapperTpl' => 'tplMsBundlesList',
  'emptyTpl' => 'tplMsBundlesEmpty',
  'activeOnly' => true,
  'quantity' => 1
]}
modx
[[!msBundles?
  &product=`[[*id]]`
  &tpl=`tplMsBundlesItem`
  &wrapperTpl=`tplMsBundlesList`
  &emptyTpl=`tplMsBundlesEmpty`
  &activeOnly=`1`
  &quantity=`1`
]]

Single bundle by ID:

fenom
{'!msBundles' | snippet : [
  'bundle' => 5,
  'tpl' => 'tplMsBundlesItem',
  'wrapperTpl' => 'tplMsBundlesList'
]}
modx
[[!msBundles?
  &bundle=`5`
  &tpl=`tplMsBundlesItem`
  &wrapperTpl=`tplMsBundlesList`
]]

Several bundles on a landing page:

fenom
{'!msBundles' | snippet : [
  'bundles' => '5,8,12',
  'wrapperTpl' => 'tplMsBundlesList',
  'tpl' => 'tplMsBundlesItem'
]}
modx
[[!msBundles?
  &bundles=`5,8,12`
  &wrapperTpl=`tplMsBundlesList`
  &tpl=`tplMsBundlesItem`
]]

All active bundles in the current context:

fenom
{'!msBundles' | snippet : [
  'list' => 'all',
  'wrapperTpl' => 'tplMsBundlesList'
]}
modx
[[!msBundles?
  &list=`all`
  &wrapperTpl=`tplMsBundlesList`
]]

To a placeholder:

fenom
{'!msBundles' | snippet : [
  'product' => $_modx->resource.id,
  'toPlaceholder' => 'bundlesHtml'
]}
{$_modx->getPlaceholder('bundlesHtml')}
modx
[[!msBundles?
  &product=`[[*id]]`
  &toPlaceholder=`bundlesHtml`
]]
[[+bundlesHtml]]

Card and composition placeholders: Frontend. Always call msBundles.initialize nearby.