attributes

Last modified by Joel Schmalöer on 14.09.2022, 14:00

This page contains code examples for attributes in feed/export.

Tested for PIM 8.22 | PXM 1.3.7

Note: Exports attribute data regardless of a product affiliation.

Iterator

<#list attributes as attrKey, attribute>
 ${attribute.attributeId?if_exists}
</#list>

Result

Free_Supplier
TRN_EXT_Del
MC_MinRAM
CM_WetGripClass
MC_LicenseYears
REC_IT_Manager
REC_IT_Office
P_Hell
ProductEnrichmentLevelTranslation_Fallback
CM_Height
HR_Car_Model
CM_Delivery
ShortDescription
MC_CablePlating
...

All fields (in JSON format)

<#macro escapeJson text>${text?js_string?replace("\\'", "\'")?replace("\\>",">")}</#macro>
<#assign languages = ["de-DE", "en-GB"]>
{
  "attribute" :  <#list attributes as attrKey, attribute>{
    "attributeId" : "${attribute.attributeId!}",
    "type" : "${attribute.type!}",
    "documentUrl" : "${attribute.documentUrl!}",
    "extAttributeId" : "${attribute.extAttributeId!}",
    "extDefaultName" : "${attribute.extDefaultName!}",
    "singleExpression" : "${attribute.singleExpression!}",
    "parentAttributeId" : "${attribute.parentAttributeId!}",
    "attributeSectionId" : "${attribute.attributeSectionId!}",
    "fallbackDescription" : "${attribute.fallbackDescription!}",
    "createdClassVersion" : "${attribute.createdClassVersion!}",
    "changedClassVersion" : "${attribute.changedClassVersion!}",
    "extClassificationSystem" : "${attribute.extClassificationSystem!}",
    "isRequired" : ${(attribute.isRequired?string('true', 'false'))!},
    "isVariable" : ${(attribute.isVariable?string('true', 'false'))!},
    "isReadonly" : ${(attribute.isReadonly?string('true', 'false'))!},
    "isMultivalued" : ${(attribute.isMultivalued?string('true', 'false'))!},
    "isMultiLanguage" : ${(attribute.isMultiLanguage?string('true', 'false'))!},
    "isForPropagation" : ${(attribute.isForPropagation?string('true', 'false'))!},
    "isSupplierResponse" : ${(attribute.isSupplierResponse?string('true', 'false'))!},
    "isDefaultOverWritable" : ${(attribute.isDefaultOverWritable?string('true', 'false'))!},
    "excludeFromProductSearch" : ${(attribute.excludeFromProductSearch?string('true', 'false'))!},
    "orderNo" : ${attribute.orderNo!},
    "facetOrderNo" : ${attribute.facetOrderNo!},  
    "shortDescription" : {
    <#list languages as language>   
     "${language}": "${attribute.description(language)!}",
    </#list>
},
    "longDescription" : {
  <#list languages as language>
     "${language}": "${attribute.longDescriptions[language]!}",
  </#list>
},
    "createdOn" : "${attribute.createdOn!}",
    "createdBy" : "${attribute.createdBy!}"
}
}
</#list>

Result

{
 "attribute" :  {
   "attributeId" : "Free_Supplier",
   "type" : "string",
   "documentUrl" : "",
   "extAttributeId" : "",
   "extDefaultName" : "",
   "singleExpression" : "",
   "parentAttributeId" : "",
   "attributeSectionId" : "",
   "fallbackDescription" : "Suggested Supplier",
   "createdClassVersion" : "",
   "changedClassVersion" : "",
   "extClassificationSystem" : "",
   "isRequired" : false,
   "isVariable" : true,
   "isReadonly" : false,
   "isMultivalued" : false,
   "isMultiLanguage" : false,
   "isForPropagation" : ,
   "isSupplierResponse" : ,
   "isDefaultOverWritable" : true,
   "excludeFromProductSearch" : ,
   "orderNo" : 20,
   "facetOrderNo" : 0,  
   "shortDescription" : {
    "de-DE": "Suggested Supplier",
    "en-GB": "Suggested Supplier",
},
   "longDescription" : {
    "de-DE": "",
    "en-GB": "",
},
   "createdOn" : "Apr 25, 2022 12:03:10 AM",
   "createdBy" : "jcadmin"
}
{
   "attributeId" : "TRN_EXT_Del",
   "type" : "string",
   "documentUrl" : "",
   "extAttributeId" : "",
   "extDefaultName" : "",
   "singleExpression" : "",
   "parentAttributeId" : "",
   "attributeSectionId" : "",
   "fallbackDescription" : "Delegate Name",
   "createdClassVersion" : "",
   "changedClassVersion" : "",
   "extClassificationSystem" : "",
   "isRequired" : false,
   "isVariable" : true,
   "isReadonly" : false,
   "isMultivalued" : false,
   "isMultiLanguage" : false,
   "isForPropagation" : true,
   "isSupplierResponse" : ,
   "isDefaultOverWritable" : true,
   "excludeFromProductSearch" : ,
   "orderNo" : 10,
   "facetOrderNo" : 0,  
   "shortDescription" : {
    "de-DE": "Delegate Name",
    "en-GB": "Delegate Name",
},
   "longDescription" : {
    "de-DE": "",
    "en-GB": "",
},
   "createdOn" : "Apr 25, 2022 12:03:11 AM",
   "createdBy" : "jcadmin"
}
{
   "attributeId" : "MC_MinRAM",
   "type" : "integer",
   "documentUrl" : "",
   "extAttributeId" : "",
   "extDefaultName" : "",
   "singleExpression" : "",
   "parentAttributeId" : "",
   "attributeSectionId" : "MC_SystemRequirements",
   "fallbackDescription" : "$Min_benoetigter_RAM_singular_noun",
   "createdClassVersion" : "",
   "changedClassVersion" : "",
   "extClassificationSystem" : "",
   "isRequired" : false,
   "isVariable" : false,
   "isReadonly" : false,
   "isMultivalued" : false,
   "isMultiLanguage" : false,
   "isForPropagation" : ,
   "isSupplierResponse" : false,
   "isDefaultOverWritable" : true,
   "excludeFromProductSearch" : ,
   "orderNo" : ,
   "facetOrderNo" : 0,  
   "shortDescription" : {
    "de-DE": "Min. benötigter RAM",
    "en-GB": "Minimum RAM",
},
   "longDescription" : {
    "de-DE": "",
    "en-GB": "",
},
   "createdOn" : "Apr 25, 2022 12:04:55 AM",
   "createdBy" : "jcadmin"
}
{
   "attributeId" : "CM_WetGripClass",
   "type" : "string",
   "documentUrl" : "",
   "extAttributeId" : "",
   "extDefaultName" : "",
   "singleExpression" : "",
   "parentAttributeId" : "",
   "attributeSectionId" : "MC_TechnicSpec",
   "fallbackDescription" : "Wet grip class",
   "createdClassVersion" : "",
   "changedClassVersion" : "",
   "extClassificationSystem" : "",
   "isRequired" : false,
   "isVariable" : false,
   "isReadonly" : false,
   "isMultivalued" : false,
   "isMultiLanguage" : false,
   "isForPropagation" : ,
   "isSupplierResponse" : false,
   "isDefaultOverWritable" : true,
   "excludeFromProductSearch" : false,
   "orderNo" : 3,
   "facetOrderNo" : 0,  
   "shortDescription" : {
    "de-DE": "Nasshaftungsklasse",
    "en-GB": "Wet grip class",
},
   "longDescription" : {
    "de-DE": "",
    "en-GB": "",
},
   "createdOn" : "Apr 25, 2022 12:04:53 AM",
   "createdBy" : "jcadmin"
}
}
Tags: