I just finished creating a simple product catalog for a client using the excellent Collections (https://rtfm.modx.com/extras/revo/collections
) addon. I also used the Tagger (https://rtfm.modx.com/extras/revo/tagger
) addon for it’s relative ease in setup and usage. One thing I wanted to do was add a column in the Collections product list that showed the tags that were assigned to each product. It turns out, this was pretty easy.
Step 1 - Add Column
Go to Extras -> Collection Views and open your collection. Click the Add Column button and enter your label (I used “Categories”). For the Name, I just entered an unused field (which for this setup, happened to be “published”). Collections evidently only allows you to use each field once in the columns list.
In the Snippet Renderer field, add the name of your snippet - I used “collections_getCategories”, but this can be anything.
Step 2 - Create Snippet Renderer
Create your snippet using the name you entered in the Snippet Renderer field and add the following code:
$row = $modx->getOption('row', $scriptProperties, '');
$tags = $modx->runSnippet('TaggerGetTags', array(
'rowTpl' => 'collections_taggerRowTpl',
'resources' => $row['id']
Save your snippet.
Step 3: Create the rowTpl Chunk
Create a chunk and name it “collections_taggerRowTpl”. Place this in the chunk:
Save your chunk and that should be it! Hope this helps.