custom/plugins/LdsSubCategories/src/Resources/views/storefront/element/cms-element-subcategories.html.twig line 1

Open in your IDE?
  1. {% block element_subcategories %}
  2.     {%  set config = element.fieldConfig.elements %}
  3.     
  4.     {% if element.data.elements|length >0 %}
  5.     <div class="cms-element-subcategories" style="width: 100%">
  6.         <div class="subcategories-text">
  7.             {% if element.config.cattitle.value %}
  8.                 <div class="title">{{element.config.cattitle.value|raw}}</div>
  9.             {% endif %}
  10.             {% if element.config.description.value %}
  11.                 <div class="description">{{element.config.description.value|raw}}</div>
  12.             {% endif %}
  13.         </div>
  14.         <ul class="row">
  15.             {% for subcategory in element.data.elements %}
  16.                 {% if context.salesChannel.id =='3213ffda35704f1a84f5e7376117a2a2' and subcategory.customFields.custom_category_usa_disable %}
  17.                 {% else %}
  18.                 <li class="col-md-2 col-4 {% if subcategory.type=='folder' %}d-none{% endif %}">
  19.                     {% if subcategory.type=='page' %}
  20.                     <a class="link" href="{{ seoUrl('frontend.navigation.page', {navigationId: subcategory.id}) }}">
  21.                     {% elseif subcategory.type=='link' and subcategory.externalLink %}
  22.                     <a class="link" href="{{ subcategory.externalLink }}">
  23.                     {% elseif subcategory.type=='link' and subcategory.linkType=='category' %}
  24.                     <a class="link" href="{{ seoUrl('frontend.navigation.page', {navigationId: subcategory.internalLink}) }}">
  25.                     {% else %}
  26.                     <div class="link">
  27.                     {% endif %}
  28.                         <div class="cat-img">
  29.                             {% if subcategory.media %}
  30.                                 {% sw_thumbnails 'moorl-listing-item-image-thumbnails' with {
  31.                                     media: subcategory.media,
  32.                                     attributes: {
  33.                                         'itemprop': 'image',
  34.                                         'alt': title,
  35.                                         'class': "is-#{config.displayMode.value}",
  36.                                         'style': imageCss|join(';'),
  37.                                         'title': ''
  38.                                     }
  39.                                 } %}
  40.                             {% else %}
  41.                                 <div class="product-image-placeholder">
  42.                                     {% sw_icon 'placeholder' style {
  43.                                         'size': 'fluid'
  44.                                     } %}
  45.                                 </div>
  46.                             {% endif %}
  47.                         </div>
  48.                         <div class="cat-title">
  49.                             {% set name = subcategory.translated.name %}
  50.                             {% for translation in subcategory.translations %}
  51.                                 {% if translation.languageId==context.salesChannel.languageId and translation.name !='' %}
  52.                                     {% set name = translation.name %}
  53.                                 {% endif %}
  54.                             {% endfor %}
  55.                             {{name}}
  56.                         </div>
  57.                     {% if subcategory.type=='page' or (subcategory.type=='link' and subcategory.externalLink) or (subcategory.type=='link' and subcategory.linkType=='category') %}
  58.                         </a>
  59.                     {% else %}
  60.                         </div>
  61.                     {% endif %}
  62.                 </li>
  63.                 {% endif %}
  64.             {% endfor %}
  65.         </ul>
  66.     </div>
  67.     <div align="center">
  68.         <a id="loadmorecats" class="btn btn-primary mb-5" href="#">{{"LdsSubCategories.readmore"|trans}}</a>
  69.     </div>
  70.     {% endif %}
  71.     
  72. {% endblock %}