diff --git a/app/code/community/Yotpo/Yotpo/Helper/ApiClient.php b/app/code/community/Yotpo/Yotpo/Helper/ApiClient.php index 5f98522..7748b87 100644 --- a/app/code/community/Yotpo/Yotpo/Helper/ApiClient.php +++ b/app/code/community/Yotpo/Yotpo/Helper/ApiClient.php @@ -61,6 +61,7 @@ public function isEnabled($store_id) public function prepareProductsData($order) { + $activeStore = Mage::app()->getStore(); Mage::app()->setCurrentStore($order->getStoreId()); $products = $order->getAllVisibleItems(); //filter out simple products $products_arr = array(); @@ -93,6 +94,7 @@ public function prepareProductsData($order) $products_arr[$full_product->getId()] = $product_data; } + Mage::app()->setCurrentStore($activeStore); return $products_arr; } diff --git a/app/code/community/Yotpo/Yotpo/Helper/RichSnippets.php b/app/code/community/Yotpo/Yotpo/Helper/RichSnippets.php index 0190555..908d81a 100644 --- a/app/code/community/Yotpo/Yotpo/Helper/RichSnippets.php +++ b/app/code/community/Yotpo/Yotpo/Helper/RichSnippets.php @@ -48,7 +48,7 @@ public function getRichSnippet() return array( "average_score" => $snippet->getAverageScore(), "reviews_count" => $snippet->getReviewsCount()); } catch(Exception $e) { - Mage::log($e); + Mage::logException($e); } return array(); } diff --git a/app/code/community/Yotpo/Yotpo/Model/Richsnippet.php b/app/code/community/Yotpo/Yotpo/Model/Richsnippet.php index 0033431..6c9fbec 100644 --- a/app/code/community/Yotpo/Yotpo/Model/Richsnippet.php +++ b/app/code/community/Yotpo/Yotpo/Model/Richsnippet.php @@ -19,7 +19,8 @@ public function getSnippetByProductIdAndStoreId($product_id, $store_id) if ($col->getSize() == 0) { return null; } - $snippet = $col->getItemByColumnValue('product_id', $product_id); + $col->addFieldToFilter('product_id', $product_id); + $snippet = $col->getFirstItem(); return $snippet; } } \ No newline at end of file