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