Skip to content
ms3Favorites
ms3Favorites
Wishlists for MiniShop3 and other resources — browser storage, DB sync
  1. Extras
  2. ms3Favorites
  3. Snippets
  4. ms3FavoritesBtn

Snippet ms3FavoritesBtn

Outputs the add/remove from favorites button. Shows “in favorites” / “not in favorites” state and tooltip from the lexicon.

Parameters

ParameterDescriptionDefault
idResource/product ID (required)
listList identifierdefault
resource_typeResource type: products, resourcesproducts
tplButton chunktplMs3fBtn
remove1 — reload on remove; or element id prefix (e.g. product-item) to remove #product-item-{id}
labelLabel for analytics (passed to chunk)
classesExtra CSS classes

Chunk placeholders

PlaceholderDescription
[[+ms3f_id]]Resource ID
[[+ms3f_list]]List name
[[+ms3f_resource_type]]Resource type
[[+ms3f_in_favorites]]1 — in favorites, 0 — not
[[+ms3f_tooltip]]Tooltip text
[[+ms3f_label]]Analytics label
[[+ms3f_classes]]Extra classes
[[+ms3f_remove_attr]]data attribute for remove

Examples

In product card (MODX):

modx
[[!ms3FavoritesBtn? &id=`[[+id]]`]]
fenom
{'!ms3FavoritesBtn' | snippet : ['id' => $id]}

On product page:

modx
[[!ms3FavoritesBtn? &id=`[[*id]]`]]
fenom
{'!ms3FavoritesBtn' | snippet : ['id' => $_modx->resource.id]}

With reload on remove:

modx
[[!ms3FavoritesBtn? &id=`[[*id]]` &remove=`1`]]
fenom
{'!ms3FavoritesBtn' | snippet : ['id' => $_modx->resource.id, 'remove' => '1']}

Remove block by id prefix:

modx
<div id="product-item-[[+id]]">
  ...
  [[!ms3FavoritesBtn? &id=`[[+id]]` &remove=`product-item`]]
</div>
fenom
<div id="product-item-{$id}">
  ...
  {'!ms3FavoritesBtn' | snippet : ['id' => $id, 'remove' => 'product-item']}
</div>

Box-style button (wishlist, tooltip):

modx
[[!ms3FavoritesBtn? &id=`[[*id]]` &tpl=`tplMs3fBtnWishlistBox`]]
fenom
{'!ms3FavoritesBtn' | snippet : [
  'id' => $_modx->resource.id,
  'tpl' => 'tplMs3fBtnWishlistBox'
]}