Skip to content
ms3RecentlyViewed
ms3RecentlyViewed
"Recently viewed products" block for MiniShop3 — browser or DB storage, similar products, manager
  • MODX 3
  • PHP 8.1
  • miniShop3
  1. Extras
  2. ms3RecentlyViewed
  3. Snippets
  4. ms3recentlyviewedSimilar

Snippet ms3recentlyviewedSimilar ​

Products from the same categories (parents) as the given viewed IDs. Those IDs are excluded. “Similar to viewed” block.

Parameters ​

ParameterDescriptionDefault
idsComma-separated viewed product IDs—
tplProduct card chunktplSimilarItem
tplOuterWrapper chunk(empty)
limitMax items in result10
depthCategory search depth. Values < 2 are raised to 2 by the snippet and AJAX2
fromDBLoad IDs from DB if the user is authenticated in the current context. Not in transportfalse
autoIdsFallbackDemo IDs when fromDB and the list is empty. Default off, not in transportfalse
fallbackToRoot / fallbackReturnIdsCatalog-wide fallback when the category query is empty. Not in transporttrue
whereExtra msProducts where (JSON). Merged with id:NOT IN viewed IDs. Not in transport—
showUnpublished / showDeletedPassed to the product query. Not in transportfalse

Examples ​

fenom
{'ms3recentlyviewedSimilar' | snippet : [
  'ids' => $_modx->getPlaceholder('viewedIds'),
  'limit' => 8,
  'depth' => 2,
  'tpl' => 'tplSimilarItem'
]}
modx
[[!ms3recentlyviewedSimilar?
  &ids=`[[+viewedIds]]`
  &limit=`8`
  &depth=`2`
  &tpl=`tplSimilarItem`
]]

If the category query is empty, the snippet may search the whole catalog with higher depth. No IDs: empty string.

renderSimilar() in viewed.js defaults to 8 products, excludes the current product, and does not send depth. The server keeps 2. An empty response hides the container. Snippet default limit is 10.

Connector (AJAX): POST action=similar, ids, optionally limit, tpl, depth. Context: ms3recentlyviewed.context (default web). See Frontend integration.