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. If it is inactive and activeOnly=1, the result is empty.
  2. Else product > 0 — bundles that include that product.
  3. Otherwise emptyTpl is returned.

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
bundle0Single bundle ID (instead of product)
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`
]]

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.