diff --git a/Bootstrap.php b/Bootstrap.php index e65964c4..c51a741c 100644 --- a/Bootstrap.php +++ b/Bootstrap.php @@ -51,10 +51,11 @@ class Shopware_Plugins_Frontend_NostoTagging_Bootstrap extends Shopware_Componen { const PLATFORM_NAME = 'shopware'; - const PLUGIN_VERSION = '1.2.4'; + const PLUGIN_VERSION = '1.2.5'; const MENU_PARENT_ID = 23; // Configuration const NEW_ENTITY_MANAGER_VERSION = '5.0.0'; const NEW_ATTRIBUTE_MANAGER_VERSION = '5.2.0'; + const SUPPORT_SHOW_REVIEW_SUB_SHOP_ONLY_VERSION = '5.3.0'; const PLATFORM_UI_VERSION = '1'; const PAGE_TYPE_FRONT_PAGE = 'front'; const PAGE_TYPE_CART = 'cart'; diff --git a/CHANGELOG.md b/CHANGELOG.md index 0093b942..a420362e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased][unreleased] +## [1.2.5] +- Add support for Shopware 5.3 + ## [1.2.4] - Make order status handling compatible with Shopware < 5.1 @@ -139,7 +142,8 @@ recommendations - Initial beta-release -[unreleased]: https://github.com/nosto/nosto-shopware-plugin/compare/1.2.4...develop +[unreleased]: https://github.com/nosto/nosto-shopware-plugin/compare/1.2.5...develop +[1.2.5]: https://github.com/nosto/nosto-shopware-plugin/compare/1.2.4...1.2.5 [1.2.4]: https://github.com/nosto/nosto-shopware-plugin/compare/1.2.3...1.2.4 [1.2.3]: https://github.com/nosto/nosto-shopware-plugin/compare/1.2.2...1.2.3 [1.2.2]: https://github.com/nosto/nosto-shopware-plugin/compare/1.2.1...1.2.2 diff --git a/Components/Model/Product.php b/Components/Model/Product.php index 6db3349d..fcfa6df4 100644 --- a/Components/Model/Product.php +++ b/Components/Model/Product.php @@ -36,6 +36,7 @@ use Shopware\Models\Article\Article as Article; use Shopware\Models\Shop\Shop as Shop; +use Shopware_Plugins_Frontend_NostoTagging_Bootstrap as NostoBootstrap; use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Image as ImageHelper; use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Price as PriceHelper; use Shopware_Plugins_Frontend_NostoTagging_Components_Helper_Tag as TagHelper; @@ -378,14 +379,33 @@ public function assignId(\Shopware\Models\Article\Article $article) */ protected function amendRatingsAndReviews(Article $article, Shop $shop) { + //From shopware 5.3, it is possible to display product votes only in sub shop where they posted + $showSubshopReviewOnly = false; + $showSubshopReivewOnlySupported = version_compare( + Shopware::VERSION, + NostoBootstrap::SUPPORT_SHOW_REVIEW_SUB_SHOP_ONLY_VERSION, + '>=' + ); + if ($showSubshopReivewOnlySupported) { + $showSubshopReviewOnly = Shopware()->Config()->get('displayOnlySubShopVotes'); + } + $voteCount = 0; - $votes = array(); + $voteSum = 0; foreach ($article->getVotes() as $vote) { + if ($showSubshopReviewOnly) { + $shopForVote = $vote->getShop(); + if ($shopForVote !== null + && $shop !== null + && $shopForVote->getId() != $shop->getId() + ) { + continue; + } + } ++$voteCount; - $votes[] = $vote->getPoints(); + $voteSum += $vote->getPoints(); } if ($voteCount > 0) { - $voteSum = array_sum($votes); $voteAvg = round($voteSum / $voteCount, 1); $this->setRatingValue($voteAvg); $this->setReviewCount($voteCount); diff --git a/Views/frontend/plugins/nosto_tagging/checkout/finish.tpl b/Views/frontend/plugins/nosto_tagging/checkout/finish.tpl index 4ffec00f..61bd60b1 100644 --- a/Views/frontend/plugins/nosto_tagging/checkout/finish.tpl +++ b/Views/frontend/plugins/nosto_tagging/checkout/finish.tpl @@ -36,7 +36,7 @@ {block name="frontend_index_content" append}
- {if isset($nostoOrder) && is_object($nostoOrder)} + {if isset($nostoOrder) && $nostoOrder}