Skip to content

Assigned Categories#


Description#

Lookup Categories each product is assigned to and output them as a single | (pipe) separated list.

Snippet#

<mvt:comment>
| Lookup Categories each product is assigned to and output them as a single
| pipe (|) separated list
</mvt:comment>

<mvt:assign name="g.assigned_categories" value="''" />
<mvt:assign name="g.category_list" value="''" />

<mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Offset_Product_Assigned(l.settings:record:id,0,'','',0,l.null, g.assigned_categories )" />


<mvt:if expr="NOT ISNULL g.assigned_categories">

  <mvt:assign name="g.category_list" value="''" />
  <mvt:foreach iterator="category" array="global:assigned_categories">
    <mvt:assign name="g.category_list" value="g.category_list $ l.settings:category:name $ '|'" />
  </mvt:foreach>

  <mvt:assign name="g.category_list" value="substring( g.category_list, 1, len( g.category_list )-1 )" />
  <mvt:assign name="g.category_list" value="miva_csv_encode( g.category_list, '|' )" />


</mvt:if>

Output:
&mvt:global:category_list;

Functions Used#

  • CategoryList_Load_Offset_Product_Assigned