Merge branch 'ticket-12563-TrustedBadge'
This commit is contained in:
commit
dfda640f54
@ -15,12 +15,16 @@ class ReviewIndicatorCollector
|
||||
$returnedArray = array();
|
||||
$tsId = Configuration::get('TRUSTED_SHOP_' . strtoupper(Language::getIsoById((int)$this->id_lang)) . '_ID');
|
||||
try{
|
||||
$jsonResult = $this->getApiResult($tsId);
|
||||
$jsonObject = json_decode($jsonResult,true);
|
||||
TrustedShopsCache::setReviewIndicatorCache($tsId, $jsonResult);
|
||||
$returnedArray['result'] = $jsonObject['response']['data']['shop']['qualityIndicators']['reviewIndicator']['overallMark'];
|
||||
$returnedArray['count'] = $jsonObject['response']['data']['shop']['qualityIndicators']['reviewIndicator']['activeReviewCount'];
|
||||
$returnedArray['shop_name'] = $jsonObject['response']['data']['shop']['name'];
|
||||
// $jsonResult = $this->getApiResult($tsId);
|
||||
// $jsonObject = json_decode($jsonResult,true);
|
||||
// $returnedArray['result'] = $jsonObject['response']['data']['shop']['qualityIndicators']['reviewIndicator']['overallMark'];
|
||||
// $returnedArray['count'] = $jsonObject['response']['data']['shop']['qualityIndicators']['reviewIndicator']['activeReviewCount'];
|
||||
// $returnedArray['shop_name'] = $jsonObject['response']['data']['shop']['name'];
|
||||
$xmlResult = $this->getApiResult($tsId);
|
||||
$xml = new SimpleXMLElement($xmlResult);
|
||||
$returnedArray['result'] = $xml->data->shop->qualityIndicators->reviewIndicator->{'overallMark'};
|
||||
$returnedArray['count'] = $xml->data->shop->qualityIndicators->reviewIndicator->activeReviewCount;
|
||||
$returnedArray['shop_name'] = $xml->data->shop->name;
|
||||
}catch(Exception $ex){
|
||||
Logger::AddLog("file ReviewIndicatorCollector.php - " .$ex->getMessage(), 4, '0000001', 'User', '0');
|
||||
}
|
||||
@ -30,7 +34,7 @@ class ReviewIndicatorCollector
|
||||
|
||||
private function getApiResult($ts_id)
|
||||
{
|
||||
$apiUrl = 'http://api.trustedshops.com/rest/public/v2/shops/' . $ts_id . '/quality/reviews.json';
|
||||
$apiUrl = 'http://api.trustedshops.com/rest/public/v2/shops/' . $ts_id . '/quality/reviews';
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_HEADER, FALSE);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
@ -168,6 +168,7 @@ class TrustedShopsBbb extends Module
|
||||
'result' => $resultArray['result'],
|
||||
'max' => self::TS_BEST_RATING,
|
||||
'count' => $resultArray['count'],
|
||||
'resultArray' => $resultArray
|
||||
));
|
||||
return $this->display(__FILE__, 'views/rich_snippets.tpl');
|
||||
} else {
|
||||
@ -193,7 +194,7 @@ class TrustedShopsBbb extends Module
|
||||
global $smarty;
|
||||
|
||||
Tools::enableCache();
|
||||
$smarty->cache_lifetime = 84000;
|
||||
$smarty->cache_lifetime = 0;
|
||||
|
||||
return $this->isCached('rich_snippets.tpl', $cache_id);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user