themes/BootstrapChildTheme/SyliusShopBundle/views/Product/Storyteller/_accessories.html.twig line 1

Open in your IDE?
  1. {% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
  2. {% set accessories = get_products_by_taxon_code('accessories') %}
  3. {% if accessories|length > 1 or (accessories|length == 1 and product != accessories.first) %}
  4.     <h4 class="ui horizontal section divider header without-line mt-5 title">{{ 'app.ui.accessories' | trans }}</h4>
  5.         <div class="row mb-5">
  6.             {% for accessory in accessories|filter(accessory => accessory.code != product.code) %}
  7.                 <div class="col-sm-6 mb-3">
  8.                     <div class="product-frame flex">
  9.                         <a href="{{ path('sylius_shop_product_show', {'slug': accessory.slug}) }}" class="blurring dimmable image">
  10.                             {% include '@SyliusShop/Product/_mainImage.html.twig' with {'product': accessory, 'bordered': false} %}
  11.                         </a>
  12.                         <div class="row">
  13.                             <div class="col-6 font-weight-bold text-left pl-4">
  14.                                 <a href="{{ path('sylius_shop_product_show', {'slug': accessory.slug}) }}" class="header sylius-product-name" {{ sylius_test_html_attribute('product-name', accessory.name) }}>{{ accessory.name }}</a>
  15.                             </div>
  16.                             <div class="col-6">
  17.                                 {% if not accessory.enabledVariants.empty() %}
  18.                                     {% set appliedPromotions = (accessory|sylius_resolve_variant).getAppliedPromotionsForChannel(sylius.channel) %}
  19.                                     {% set price = money.calculatePrice(accessory|sylius_resolve_variant) %}
  20.                                     {% set originalPrice = money.calculateOriginalPrice(accessory|sylius_resolve_variant) %}
  21.                                     {% set taxon = accessory.mainTaxon %}
  22.                                     {# {% set hidePriceForTaxons = ['subscription-packs','story-subscription-packs','welcome-packs','default-packs','teacher', 'special-events','special-events-story', 'special-events-quiz'] %} #}
  23.                                     {% set hidePriceForTaxons = ['subscription-packs','story-subscription-packs','welcome-packs','default-packs','teacher'] %}
  24.                                     {% if taxon is not null %}
  25.                                         {% set displayPrice = true %}
  26.                                         {% for tx in hidePriceForTaxons %}
  27.                                             {% if tx in taxon.slug %}
  28.                                                 {% set displayPrice = false %}
  29.                                             {% endif %}
  30.                                         {% endfor %}
  31.                                         {% if displayPrice %}
  32.                                             <div class="sylius-product-price {% if price != originalPrice %}has_discount{% endif %}" {{ sylius_test_html_attribute('product-price') }}>
  33.                                                 {{ price }}
  34.                                                 {% if price != originalPrice %}
  35.                                                     <div class="sylius-product-original-price" {{ sylius_test_html_attribute('product-original-price') }}><del>{{ originalPrice }}</del></div>
  36.                                                 {% endif %}
  37.                                             </div>
  38.                                         {% endif %}
  39.                                     {% endif %}
  40.                                     {% include '@SyliusShop/Product/Show/_catalogPromotionLabels.html.twig' with {'appliedPromotions': appliedPromotions, 'withDescription': false} %}
  41.                                 {% endif %}
  42.                             </div>
  43.                         </div>
  44.                         <p class="text-left">{{ ('app.ui.product.storyteller.frames.' ~ accessory.mainTaxon.code) | trans }}</p>
  45.                         <div class="row pl-4 pr-4">
  46.                             <a href="{{ path('sylius_shop_product_show', {'slug': accessory.slug}) }}" class="ui button col-sm-4 mr-0">{{ 'app.pages.blog.shop.article.see_more' | trans }}</a>
  47.                             {{ render(url('sylius_shop_partial_cart_add_item', {'template': '@SyliusShop/Product/Storyteller/_quickAddToCart.html.twig', 'productId': accessory.id })) }}
  48.                         </div>
  49.                     </div>
  50.                 </div>
  51.             {% endfor %}
  52.         </div>
  53. {% endif %}