custom/plugins/FourtwosixThemeExtension/src/Resources/views/storefront/page/product-detail/fts-properties-from-custom-fields.html.twig line 1

Open in your IDE?
  1. {% block ftsCustomFieldsPropertyRows %}
  2.     {#  Custom fields key that will be used as property in table #}
  3.     {% set keysToShow = [
  4.         "akeneo_packboxkg",
  5.         "akeneo_packboxm",
  6.         "akeneo_packboxm2",
  7.         "akeneo_packboxstk",
  8.         "akeneo_packpalletbox",
  9.         "akeneo_packpalletkg",
  10.         "akeneo_packpalletm2"
  11.     ] %}
  12.     {#  Filter only populated properties  #}
  13.     {% set cfToShow = [] %}
  14.     {% for cf in page.product.translated.customFields|keys %}
  15.         {% if cf in keysToShow %}
  16.             {% set cfToShow =  cfToShow|merge([cf]) %}
  17.         {% endif %}
  18.     {% endfor %}
  19.     {# Show filtered CF as properties #}
  20.     {% for cfKey in cfToShow %}
  21.         {% if page.product.translated.customFields[cfKey] %}
  22.             {% set propertyLabel= "fts.uom."~cfKey %}
  23.             {% set propertyValue= page.product.translated.customFields[cfKey] %}
  24.             {# @fourtwosix-edit: add snippet for imported Uom in Custom fields properties#}
  25.             {% if cfKey === 'akeneo_packboxstk' and context.salesChannel.languageId === '2fbb5fe2e29a4d70aa5854ce7ce3e20b' %}
  26.                 {% set propertyValue = propertyValue|replace({' Pc' : " " ~ 'fourtwosix.customFields.unit'|trans|sw_sanitize}) %}
  27.             {% endif  %}
  28.             <tr class="properties-row">
  29.                 <th class="properties-label">{{ propertyLabel|trans }}:</th>
  30.                 <td class="properties-value">
  31.                     {% apply spaceless %}
  32.                         {{ propertyValue }}
  33.                     {% endapply %}
  34.                 </td>
  35.             </tr>
  36.         {% endif %}
  37.     {% endfor %}
  38. {% endblock %}