{% sw_extends '@Storefront/storefront/base.html.twig' %}
{% block base_body_inner %}
{{ parent() }}
{% if trustedshops.tsId %}
{# Trusted Shops Trustbadge - Start #}
{% if trustedshops.tsTrustbadgeExpertMode %}
{{ trustedshops.tsExpertTrustbadeCode|replace({'%tsid%': trustedshops.tsId})|raw }}
{% else %}
<script type="text/javascript">
(function () {
var _tsid = '{{ trustedshops.tsId|escape('js') }}';
_tsConfig = {
'yOffset': '{{ trustedshops.tsTrustbadgeOffsetY|escape('js')|default('0') }}', /* offset from page bottom */
'variant': '{{ trustedshops.tsTrustbadgeVariant|escape('js')|default('default') }}', /* reviews, default, custom, custom_reviews */
'customElementId': '', /* required for variants custom and custom_reviews */
'trustcardDirection': '', /* for custom variants: topRight, topLeft, bottomRight, bottomLeft */
'customBadgeWidth': '', /* for custom variants: 40 - 90 (in pixels) */
'customBadgeHeight': '', /* for custom variants: 40 - 90 (in pixels) */
'disableResponsive': 'false', /* deactivate responsive behaviour */
{% if trustedshops.tsTrustbadgeVariant == 'hide' %}
'disableTrustbadge': 'true', /* deactivate Trustbadge® */
{% else %}
'disableTrustbadge': 'false', /* deactivate Trustbadge® */
{% endif %}
'responsive': {
'variant': '', /* floating, custom */
'customElementId': '' /* required for variant custom */
}
};
var _ts = document.createElement('script');
_ts.type = 'text/javascript';
_ts.charset = 'utf-8';
_ts.async = true;
_ts.src = '//widgets.trustedshops.com/js/' + _tsid + '.js';
var __ts = document.getElementsByTagName('script')[0];
__ts.parentNode.insertBefore(_ts, __ts);
})();
</script>
{% endif %}
{# Trusted Shops Trustbadge - End #}
{# Trusted Shops Rich Snippets - Start #}
{#{% if trustedshops.tsRichSnippetsActive %}
{% if
( controllerName|lower == 'navigation' and controllerAction|lower == 'home' and trustedshops.tsRichSnippetsPageTypeStart ) or
( controllerName|lower == 'navigation' and controllerAction|lower == 'index' and trustedshops.tsRichSnippetsPageTypeCategory ) or
( controllerName|lower == 'product' and trustedshops.tsRichSnippetsPageTypeProduct )
%}
{% if trustedshops.tsRichSnippetsExpertMode %}
{% set richSnippetCode = trustedshops.tsExpertRichSnippetsCode %}
{% set richSnippetCode = richSnippetCode|replace({'%shopname%': shopware.config.core.basicInformation.shopName}) %}
{% set richSnippetCode = richSnippetCode|replace({'%result%': trustedshops.tsShopAvgRating}) %}
{% set richSnippetCode = richSnippetCode|replace({'%count%': trustedshops.tsShopRatingCount}) %}
{% set richSnippetCode = richSnippetCode|replace({'%max%': '5'}) %}
{{ richSnippetCode|raw }}
{% else %}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Organization",
"name": "{{ shopware.config.core.basicInformation.shopName|escape('js') }}",
"aggregateRating" : {
"@type": "AggregateRating",
"ratingValue" : "{{ trustedshops.tsShopAvgRating|escape('js') }}",
"bestRating" : "5",
"ratingCount" : "{{ trustedshops.tsShopRatingCount|escape('js') }}"
}
}
</script>
{% endif %}
{% endif %}
{% endif %}#}
{# Trusted Shops Trustbadge - End #}
{% endif %}
{% endblock %}
{% block base_body_script %}
{{ parent() }}
{# Trusted Shops jQuery Selector - Start #}
<script type="text/javascript">
(function() {
const reviewStickerElementSelector = ".ts-rating.testimonial";
const productRatingStarsElementSelector = ".ts-rating.productreviewsSummary";
const productReviewsElementSelector = ".ts-rating.productreviews";
const reviewStickerParentSelector = "{% if trustedshops.tsReviewStickerExpertMode %}{{ trustedshops.tsExpertReviewStickerJquerySelector|escape('js') }}{% endif %}";
const productRatingStarsParentSelector = "{% if trustedshops.tsProductRatingStarsExpertMode %}{{ trustedshops.tsExpertProductRatingStarsJquerySelector|escape('js') }}{% endif %}";
const productReviewsParentSelector = "{% if trustedshops.tsProductReviewsTabExpertMode %}{{ trustedshops.tsExpertProductReviewsTabJquerySelector|escape('js') }}{% endif %}";
const onJqueryLoaded = function( $ ) {
const waitForElement = function( selector, callback ) {
const elementChecker = window.setInterval( function() {
if( $( selector ).length ) {
window.clearInterval( elementChecker );
callback.call( $( selector ) );
}
}, 10 );
};
if( reviewStickerParentSelector ) {
waitForElement( reviewStickerElementSelector, function() {
$( reviewStickerParentSelector ).append( this );
});
}
if( productRatingStarsParentSelector ) {
waitForElement( productRatingStarsElementSelector, function() {
$( productRatingStarsParentSelector ).append( this );
});
}
if( productReviewsParentSelector ) {
waitForElement( productReviewsElementSelector, function() {
$( productReviewsParentSelector ).append( this );
});
}
};
window.onload = function() {
const jqueryChecker = window.setInterval( function() {
if( window.jQuery )
{
window.clearInterval( jqueryChecker );
onJqueryLoaded( window.jQuery );
}
}, 100 );
};
})();
</script>
{# Trusted Shops jQuery Selector - End #}
{% endblock %}