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 ​

Outputs products from the same categories (parents) as the given viewed IDs. Excludes those IDs. “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 contextfalse
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—
showUnpublished / showDeletedPassed to the product queryfalse

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 nothing is found by category, the snippet may use a catalog-wide selection with a higher depth.

Via connector (AJAX): POST with action=similar, parameters ids, optionally limit, tpl, depth. See Frontend integration.