msBundles
Product bundles for miniShop3 with shared pricing, discounts, and cart sync

Renders HTML for product bundles. Put it in the product template or anywhere you need set cards.
bundle > 0 — one bundle by ID. If it is inactive and activeOnly=1, the result is empty.product > 0 — bundles that include that product.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.
| Parameter | Default | Description |
|---|---|---|
product | 0 | Product resource ID. Bundles that include it |
bundle | 0 | Single bundle ID (instead of product) |
tpl | tplMsBundlesItem | Card chunk |
wrapperTpl | tplMsBundlesList | List wrapper |
emptyTpl | tplMsBundlesEmpty | Empty result |
productTpl | tplMsBundlesProduct | Composition line chunk |
imageFallback | 0 | No bundle image → first product thumb |
activeOnly | 1 | Active bundles only |
quantity | 1 | Bundle count for price and stock |
toPlaceholder | — | Placeholder name. Snippet returns an empty string |
On a product page:
{'!msBundles' | snippet : [
'product' => $_modx->resource.id,
'tpl' => 'tplMsBundlesItem',
'wrapperTpl' => 'tplMsBundlesList',
'emptyTpl' => 'tplMsBundlesEmpty',
'activeOnly' => true,
'quantity' => 1
]}[[!msBundles?
&product=`[[*id]]`
&tpl=`tplMsBundlesItem`
&wrapperTpl=`tplMsBundlesList`
&emptyTpl=`tplMsBundlesEmpty`
&activeOnly=`1`
&quantity=`1`
]]Single bundle by ID:
{'!msBundles' | snippet : [
'bundle' => 5,
'tpl' => 'tplMsBundlesItem',
'wrapperTpl' => 'tplMsBundlesList'
]}[[!msBundles?
&bundle=`5`
&tpl=`tplMsBundlesItem`
&wrapperTpl=`tplMsBundlesList`
]]To a placeholder:
{'!msBundles' | snippet : [
'product' => $_modx->resource.id,
'toPlaceholder' => 'bundlesHtml'
]}
{$_modx->getPlaceholder('bundlesHtml')}[[!msBundles?
&product=`[[*id]]`
&toPlaceholder=`bundlesHtml`
]]
[[+bundlesHtml]]Card and composition placeholders: Frontend. Always call msBundles.initialize nearby.