Skip to content

Commit

Permalink
Merge pull request #102 from YotpoLtd/Yes_62_Fix_Sniffer_issue_on_the…
Browse files Browse the repository at this point in the history
…_latest_extention

Yes_62_Fix_Sniffer_issue_on_the_latest_extention
  • Loading branch information
ohadsc committed Aug 19, 2018
2 parents 05c4a8e + e82cf29 commit 599aa63
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Helper/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public function createApiGet($path, $timeout = self::DEFAULT_TIMEOUT) {
$http->write(\Zend_Http_Client::GET, $feed_url, '1.1', array('Content-Type: application/json'));
$resData = $http->read();
return array("code" => \Zend_Http_Response::extractCode($resData), "body" => json_decode(\Zend_Http_Response::extractBody($resData)));
} catch (Exception $e) {
} catch (\Exception $e) {
$this->_logger->addDebug('error: ' . $e);
}
}
Expand Down
8 changes: 5 additions & 3 deletions Helper/RichSnippets.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ public function __construct(
\Yotpo\Yotpo\Block\Config $config,
\Yotpo\Yotpo\Model\Richsnippet $model,
\Yotpo\Yotpo\Helper\ApiClient $helper,
\Psr\Log\LoggerInterface $logger,
\Magento\Store\Model\StoreManagerInterface $storeManager
) {
$this->_config = $config;
$this->_model = $model;
$this->_helper = $helper;
$this->_logger = $logger;
$this->_storeManager = $storeManager;
}

Expand All @@ -43,7 +45,7 @@ public function getRichSnippet() {
//no snippet for product or snippet isn't valid anymore. get valid snippet code from yotpo api
$res = $this->_helper->createApiGet("products/" . ($this->_config->getAppKey()) . "/richsnippet/" . $productId, 2);

print_r(json_encode($res));

if ($res["code"] != 200) {
//product not found or feature disabled.
return "";
Expand All @@ -68,8 +70,8 @@ public function getRichSnippet() {
return array("average_score" => $averageScore, "reviews_count" => $reviewsCount);
}
return array("average_score" => $snippet->getAverageScore(), "reviews_count" => $snippet->getReviewsCount());
} catch (Exception $e) {
Mage::log($e);
} catch (\Exception $e) {
$this->_logger->addDebug('error: ' . $e);
}
return array();
return true;
Expand Down
3 changes: 1 addition & 2 deletions Model/Observer/RemoveBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public function execute(Observer $observer) {
$remove = $this->_scopeConfig->getValue(
'yotpo/settings/mdr_enabled', \Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
echo $remove;


if ($remove) {

$layout->unsetElement('reviews.tab');
Expand Down

0 comments on commit 599aa63

Please sign in to comment.