fix badge to have comment

This commit is contained in:
Marion Muszynski 2017-02-24 18:07:55 +01:00
parent 90a8112c07
commit 456c33e769
3 changed files with 69 additions and 35 deletions

View File

@ -156,33 +156,38 @@ class TrustedShopsBbb extends Module
return false;
}
global $smarty, $cookie;
if($smarty->tpl_vars['page_name']->value == 'order') {
$cache_id = (int)$cookie->id_lang.'_trustedshopsbbb_leftcolumn';
$cache_id = (int)$cookie->id_lang.'_trustedshopsbbb_leftcolumn';
if (!$this->isTemplateCached($cache_id)) {
$resultArray = array();
if (in_array(strtoupper(Language::getIsoById($cookie->id_lang)), array("FR","ES"), true)) {
$tsId = Configuration::get('TRUSTED_SHOP_' . strtoupper(Language::getIsoById((int)$cookie->id_lang)) . '_ID');
$reviewIndicatorCollector = new ReviewIndicatorCollector((int)($cookie->id_lang));
$resultArray = $reviewIndicatorCollector->getResults();
}
if(count($resultArray)> 0 and (int)$resultArray['count'] > 0){
$smarty->assign(array(
'shopName' => $resultArray['shop_name'],
'result' => $resultArray['result'],
'max' => self::TS_BEST_RATING,
'count' => $resultArray['count'],
'tsId' => $tsId
));
return $this->display(__FILE__, 'views/rich_snippets_2.tpl');
} else {
return false;
if (!$this->isTemplateCached($cache_id)) {
$resultArray = array();
if (in_array(strtoupper(Language::getIsoById($cookie->id_lang)), array("FR","ES"), true)) {
$tsId = Configuration::get('TRUSTED_SHOP_' . strtoupper(Language::getIsoById((int)$cookie->id_lang)) . '_ID');
$reviewIndicatorCollector = new ReviewIndicatorCollector((int)($cookie->id_lang));
$resultArray = $reviewIndicatorCollector->getResults();
}
if(count($resultArray)> 0 and (int)$resultArray['count'] > 0){
$smarty->assign(array(
'shopName' => $resultArray['shop_name'],
'result' => $resultArray['result'],
'max' => self::TS_BEST_RATING,
'count' => $resultArray['count'],
'tsId' => $tsId
));
return $this->display(__FILE__, 'views/rich_snippets_2.tpl');
} else {
return false;
}
}
return $this->flushTemplateCache($cache_id);
}
return $this->flushTemplateCache($cache_id);
}
public function hookFooter($params){
global $smarty, $cookie;
if($smarty->tpl_vars['page_name']->value == 'order') {
return false;
}
$cache_id = (int)$cookie->id_lang.'_trustedshopsbbb';

View File

@ -1,18 +1,44 @@
<div id="customCheckoutDiv2"></div>
<script type="text/javascript">
{literal}(function () {
var _tsid = '{/literal}{$tsId}{literal}';
_tsConfig = {
'yOffset': '0', /* offset from page bottom */
'variant': 'custom_reviews', /* text, default, small, reviews, custom, custom_reviews */
'customElementId': 'customCheckoutDiv2', /* required for variants custom and custom_reviews */
'trustcardDirection': '', /* for custom variants: topRight, topLeft, bottomRight, bottomLeft */
'customBadgeWidth': '200', /* for custom variants: 40 - 90 (in pixels) */
'customBadgeHeight': '70', /* for custom variants: 40 - 90 (in pixels) */
'disableResponsive': 'false', /* deactivate responsive behaviour */
'disableTrustbadge': 'false', /* deactivate trustbadge */
'customCheckoutElementId': 'customCheckoutDiv'
};
var _ts = document.createElement('script');
_ts.type = 'text/javascript';
_ts.charset = 'utf-8';
_ts.async = true;
_ts.src = 'http://widgets.trustedshops.com/js/' + _tsid + '.js';
var __ts = document.getElementsByTagName('script')[0];
__ts.parentNode.insertBefore(_ts, __ts);
})();
$(document).ready(function(){
setTimeout(function(){$('#customCheckoutDiv2 div[id^=\'tsbadge_\']').css('width','200px');},1000);
setTimeout(function(){$('#customCheckoutDiv2 div[id^=\'tsCustomBadge\']').css('width','200px');},1000);
});
{/literal}
</script>
<script type="application/ld+json">
{literal}
$(document).ready(function() {
if($('#customCheckoutDiv div').length>0) {
$('#customCheckoutDiv2').html($('#customCheckoutDiv').html());
$('#customCheckoutDiv2 div[id^=\'tsbadge_\']').css('width','200px');
$('#customCheckoutDiv2 div[id^=\'tsCustomBadge\']').css('width','200px');
} else {
setTimeout(function(){
$('#customCheckoutDiv2').html($('#customCheckoutDiv').html());
$('#customCheckoutDiv2 div[id^=\'tsbadge_\']').css('width','200px');
$('#customCheckoutDiv2 div[id^=\'tsCustomBadge\']').css('width','200px');
},1200);
}
});
{
"@context": "http://schema.org",
"@type": "LocalBusiness",
"name": "{/literal}{$shopName}{literal}",
"aggregateRating" : {
"@type": "AggregateRating",
"ratingValue" : "{/literal}{$result}{literal}",
"bestRating" : "{/literal}{$max}{literal}",
"ratingCount" : "{/literal}{$count}{literal}"
}
}
{/literal}
</script>

View File

@ -26,10 +26,13 @@
<!-- Block payment logo module -->
<div id="paiement_logo_block_left" class="paiement_logo_block">
{if $page_name != 'order'}
<div id="customCheckoutDiv" style="float:left;margin-top: 5px"></div>
{* <a href="{$base_dir_ssl}" style="margin-top:20px">
{else}
<a href="{$base_dir_ssl}" style="margin-top:20px">
<img src="{$img_dir}logo_bbb_footer_{$cookie->id_lang}.png" alt="" />
</a> *}
</a>
{/if}
<a class="payment" href="{$link->getCMSLink($cms_payement_logo)}">
<img src="{$img_dir}payment_{$cookie->id_lang}.png" alt="" />
</a>