unitOfMeasures

Zuletzt geändert von Frank Hilleringhaus am 31.01.2023, 08:18

This page contains code examples for units of measures in feed/export.

Tested for PIM 8.22 | PXM 1.3.7

Note: Exports data regardless of a product affiliation.

Iterator

<#list unitOfMeasures as unitOfMeasureKey, unitOfMeasure>
    ${unitOfMeasureKey}
</#list>

Example result

DD
PR
KTM
HP
PX
MTR
MTS
077
110
078
035
MLT
OHM
039
WTT
...

All Fields (in JSON Format)

{
    "unitOfMeasures" :
    <#list unitOfMeasures as unitOfMeasureKey, unitOfMeasure>
    {
        "UOMID" : "${(unitOfMeasure.UOMID!)}",
        "symbol" : "${(unitOfMeasure.symbol!)}",
        "translations" :
        {
            <#list unitOfMeasure.translations! as translation>
            "${translation.languageId!}" : "${translation.description!}",
            </#list>
        }
    }
    </#list>
}

Example Result

UoM for an Attribute

<#function getUoMId attributeId>
  <#assign tx = typeExtensions[attributeId]!/>
  <#assign uomId = ""/>
  <#if tx?has_content>
    <#assign uomId = tx.unitOfMeasureId!""/>
  </#if>
  <#return uomId>
</#function>

Usage

<#list attributes as attrKey, attribute>
   <UnitOfMeasure id="${getUoMId(attrKey)}"/> 
   ...

Tags: