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

Snippet ms3Favorites

Outputs a list of products or resources by given IDs. Used for the Favorites block with server-side output or after getting IDs from the connector.

Supports resource_type: products (msProducts), resources (pdoResources), articles, pages, custom. MiniShop3 is required for products.

Parameters

ParameterDescriptionDefault
idsComma-separated product/resource IDs
listList name (default, gifts, plans)default
resource_typeResource type: products, resources, articles, pages, customproducts
tplProduct card chunktplFavoritesItem
emptyTplEmpty state chunktplFavoritesEmpty
limitMax items in resultfrom ms3favorites.max_items (20)
pagePage number (for pdoPage)1
offsetOffset (for pdoPage)(page-1)*limit
totalVarPlaceholder for total count

Parameter ids is passed from outside: from JS when calling the connector or from another snippet (ms3FavoritesIds). For pagination use pdoPage with element=ms3Favorites.

Examples

fenom
{'!ms3Favorites' | snippet : [
  'ids' => $favoritesIds,
  'tpl' => 'tplFavoritesItem',
  'emptyTpl' => 'tplFavoritesEmpty',
  'limit' => 10
]}
modx
[[!ms3Favorites?
  &ids=`[[+favorites_ids]]`
  &tpl=`tplFavoritesItem`
  &emptyTpl=`tplFavoritesEmpty`
  &limit=`10`
]]

With pdoPage pagination:

fenom
{'!pdoPage' | snippet : [
  'element' => 'ms3Favorites',
  'ids' => $_modx->getPlaceholder('favorites_ids'),
  'list' => 'default',
  'limit' => 12,
  'tpl' => 'tplFavoritesPageItem',
  'emptyTpl' => 'tplFavoritesEmpty',
  'totalVar' => 'page.total',
  'pageNavVar' => 'page.nav'
]}
<nav class="pagination">{$_modx->getPlaceholder('page.nav')}</nav>
modx
[[!pdoPage?
  &element=`ms3Favorites`
  &ids=`[[+favorites_ids]]`
  &list=`default`
  &limit=`12`
  &tpl=`tplFavoritesPageItem`
  &emptyTpl=`tplFavoritesEmpty`
  &totalVar=`page.total`
  &pageNavVar=`page.nav`
]]
<nav class="pagination">[[!+page.nav]]</nav>

When there are no items the snippet returns emptyTpl content; you can skip outputting the block for empty results in the template.