Skip to content

Load All Product Custom Field Codes as Member Names#


Description#

This code snippet demonstrates how to load all custom field codes for products and assign them as member names.

Snippet#

<mvt:comment>
|
|   Custom Field Codes as member names
|
</mvt:comment>

<mvt:item name="customfields" param="Read_Product_ID( l.settings:product:id, '', l.settings:fields )" />
<mvt:foreach iterator="field" array="fields">
    <mvt:if expr="l.field_string">
        <mvt:assign name="l.field_string" value="l.field_string $ ','"/>
    </mvt:if>
    <mvt:assign name="l.field_string" value="l.field_string $ ':' $ l.settings:field:code $ '=' $ l.settings:field:value" />
</mvt:foreach>
<mvt:assign name="l.settings:product:fields" value="miva_array_deserialize( l.field_string )" />

<mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:fields), ',', '<br>'))" />
<hr>
<mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:product:fields), ',', '<br>'))" />