Skip to content

Commit

Permalink
Merge pull request #89 from trustpilot/new-version-2-6-564
Browse files Browse the repository at this point in the history
Pagination bugfix
  • Loading branch information
Paulius committed Sep 7, 2021
2 parents 1a1c7a9 + 9072146 commit ad28e60
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
18 changes: 11 additions & 7 deletions Block/Trustbox.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand Down

0 comments on commit ad28e60

Please sign in to comment.