Skip to content
  1. Extras
  2. Comparison
  3. getComparison

getComparison

Snippet to output a link to the current comparison list anywhere (e.g. in the header).

Parameters

NameDefaultDescription
&listdefaultName of the comparison list.
&tpltpl.Comparison.getChunk for the comparison link.

Page call

Default call:

modx
[[!getComparison]]

Page call

How it works

The snippet reads the comparison list from the user session and outputs a link to the page set as list_id in addComparison.

The default chunk uses classes so the link updates via ajax when products are added or removed from the list (e.g. getComparison in the header, catalog below — the header link updates when the user adds/removes from comparison).

On the comparison page where CompareList is called for this list, the link is not shown.