From 90721466ce479919cc5ca020e849530027c931a7 Mon Sep 17 00:00:00 2001 From: Paulius Butkus Date: Tue, 7 Sep 2021 14:11:54 +0300 Subject: [PATCH] Adding code changes from version 2.6.564 --- Block/Trustbox.php | 18 +++++++++++------- Model/Config.php | 2 +- composer.json | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) mode change 100755 => 100644 Block/Trustbox.php diff --git a/Block/Trustbox.php b/Block/Trustbox.php old mode 100755 new mode 100644 index 1a3e1a8..d203742 --- a/Block/Trustbox.php +++ b/Block/Trustbox.php @@ -54,15 +54,15 @@ public function loadTrustboxes() $trustboxSettings = $settings->trustbox; if (isset($trustboxSettings->trustboxes)) { $currentUrl = $this->getCurrentUrl(); + $currentCategory = $this->_registry->registry('current_category'); $loadedTrustboxes = $this->loadPageTrustboxes($settings, $currentUrl); if ($this->_registry->registry('current_product')) { $loadedTrustboxes = array_merge((array)$this->loadPageTrustboxes($settings, 'product'), (array)$loadedTrustboxes); - } - else if ($this->_registry->registry('current_category')) { + } else if ($currentCategory) { $loadedTrustboxes = array_merge((array)$this->loadPageTrustboxes($settings, 'category'), (array)$loadedTrustboxes); if ($this->repeatData($loadedTrustboxes)) { - $trustboxSettings->categoryProductsData = $this->loadCategoryProductInfo($scope, $storeId); + $trustboxSettings->categoryProductsData = $this->loadCategoryProductInfo($scope, $storeId, $currentCategory); } } if ($this->_request->getFullActionName() == 'cms_index_index') { @@ -128,12 +128,16 @@ private function checkCustomPage($tbPage, $page) { ); } - public function loadCategoryProductInfo($scope, $storeId) { + public function loadCategoryProductInfo($scope, $storeId, $category = null) { try { - $block = $this->getLayout()->getBlock('category.products.list'); - $products = $block->getLoadedProductCollection(); + if ($category == null) { + $block = $this->getLayout()->getBlock('category.products.list'); + $products = $block->getLoadedProductCollection(); + } else { + $products = $cat->getProductCollection(); + } return $this->_helper->loadCategoryProductInfo($products, $scope, $storeId); - } catch(\Throwable $e) { + } catch(\Throwable $e) { return array(); } catch(\Exception $e) { return array(); diff --git a/Model/Config.php b/Model/Config.php index 79b8c92..fcaeb0e 100644 --- a/Model/Config.php +++ b/Model/Config.php @@ -16,7 +16,7 @@ class Config const TRUSTPILOT_GENERAL_CONFIGURATION = 'general'; const TRUSTPILOT_TRUSTBOX_CONFIGURATION = 'trustbox'; const TRUSTPILOT_INTEGRATION_KEY = 'key'; - const TRUSTPILOT_PLUGIN_VERSION = '2.6.563'; + const TRUSTPILOT_PLUGIN_VERSION = '2.6.564'; const TRUSTPILOT_SCRIPT = 'TrustpilotScriptUrl'; const TRUSTPILOT_INTEGRATION_APP = 'IntegrationAppUrl'; const TRUSTPILOT_WIDGET_SCRIPT = 'WidgetScriptUrl'; diff --git a/composer.json b/composer.json index 7626550..a64d809 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "trustpilot/module-reviews", "description": "The Trustpilot Review extension makes it simple and easy for merchants to collect reviews from their customers to power their marketing efforts, increase sales conversion, build their online reputation and draw business insights.", "type": "magento2-module", - "version": "2.6.563", + "version": "2.6.564", "license": [ "OSL-3.0" ],