custom/plugins/TcinnThemeWareClean/src/Resources/views/storefront/themeware/includes/twt-badge-stock-include.html.twig line 1

Open in your IDE?
  1. {# ThemeWare "Stock badge" content #}
  2. {# TODO: Blöcke prüfen... #}
  3. {# TODO:
  4.     > availableStock via configuration... waiting for sw-multi-select fix
  5.     - stock-badge as include
  6.     - Check availability: if product.availableStock >= product.minPurchase and product.deliveryTime
  7.     - Check if adjusments for variants are neccessary
  8. #}
  9. {# ---------------- START: SET TEMPLATE VARS ---------------- #}
  10. {# ThemeWare: Set theme variables #}
  11. {% set twtProductBadgesStockBadgeColoration = theme_config('twt-product-badges-stock-badge-coloration') %}
  12. {% set twtProductBadgesStockBadgeIconShow = theme_config('twt-product-badges-stock-badge-icon-show') %}
  13. {% set twtProductBadgesStockBadgeThresholdHighstock = theme_config('twt-product-badges-stock-badge-threshold-highstock') %}
  14. {% set twtProductBadgesStockBadgeThresholdLowstock = theme_config('twt-product-badges-stock-badge-threshold-lowstock') %}
  15. {# ---------------- END: SET TEMPLATE VARS ---------------- #}
  16. {% block twt_product_badges_stock_badge %}
  17.     {% if product.availableStock > 0 and product.availableStock <= twtProductBadgesStockBadgeThresholdLowstock %}
  18.         {# ThemeWare: "Nur ... auf Lager!" #}
  19.         <div>
  20.             <span class="badge badge-warning{% if twtProductBadgesStockBadgeColoration == 3 %}-lighten{% endif %} badge-stock twt-badge-stock">
  21.                 {% if twtProductBadgesStockBadgeIconShow == 2 %}
  22.                     {# warning #}
  23.                     {% sw_include '@Storefront/storefront/themeware/twt-icons.html.twig' ignore missing with {
  24.                         icon: "twt.extension.stockBadge.lowStock.icon"|trans
  25.                     } %}
  26.                 {% endif %}
  27.                 {{ "twt.extension.stockBadge.lowStock.label"|trans({'%stock%': product.availableStock })|sw_sanitize }}
  28.             </span>
  29.         </div>
  30.     {% elseif product.availableStock > twtProductBadgesStockBadgeThresholdLowstock and product.availableStock <= twtProductBadgesStockBadgeThresholdHighstock %}
  31.         {# ThemeWare: "Auf Lager." bzw. ".. auf Lager." #}
  32.         {# checkmark, checkmark-wide oder checkmark-circle #}
  33.         {#
  34.         {% if "instock" in theme_config('twt-product-detail-stock-label-options')  %}
  35.         <div>
  36.             <span class="badge badge-secondary badge-stock">
  37.                 {% if twtProductBadgesStockBadgeIconShow %}
  38.                     {% sw_icon 'checkmark' style { 'size': 'xs' } %}
  39.                 {% endif %}
  40.                 {{ "twt.listing.stockBadge.inStock"|trans }}
  41.             </span>
  42.         </div>
  43.         {% endif %}
  44.         #}
  45.     {% elseif product.availableStock > twtProductBadgesStockBadgeThresholdHighstock %}
  46.         {# ThemeWare: "> ... lagernd" #}
  47.         <div>
  48.             <span class="badge badge-success{% if twtProductBadgesStockBadgeColoration == 3 %}-lighten{% endif %} badge-stock twt-badge-stock">
  49.                 {% if twtProductBadgesStockBadgeIconShow == 2 %}
  50.                     {# layers #}
  51.                     {% sw_include '@Storefront/storefront/themeware/twt-icons.html.twig' ignore missing with {
  52.                         icon: "twt.extension.stockBadge.highStock.icon"|trans
  53.                     } %}
  54.                 {% endif %}
  55.                 {{ "twt.extension.stockBadge.highStock.label"|trans({'%stock%': twtProductBadgesStockBadgeThresholdHighstock })|sw_sanitize }}
  56.             </span>
  57.         </div>
  58.     {% endif %}
  59. {% endblock %}