Skip to content
msBundles
Product bundles for miniShop3 with shared pricing, discounts, and cart sync
  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)
bundlesComma-separated IDs: 5,8,12
listall — 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
toPlaceholderPlaceholder 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.