Skip to content

Commit f2c024b

Browse files
Updated the helper class with constant and config logic, changed the order of the logic for product paths
1 parent da84611 commit f2c024b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Helper/Config.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
declare(strict_types=1);
7+
78
namespace Aligent\PrerenderIo\Helper;
89

910
use Magento\Framework\App\Config\ScopeConfigInterface;
@@ -13,6 +14,7 @@ class Config
1314
{
1415
private const XML_PATH_RECACHE_ENABLED = 'system/prerender_io/enabled';
1516
private const XML_PATH_PRERENDER_TOKEN = 'system/prerender_io/token';
17+
private const XML_PATH_PRERENDER_USE_PRODUCT_CANONICAL_URL = 'system/prerender_io/use_product_canonical_url';
1618

1719
/** @var ScopeConfigInterface */
1820
private ScopeConfigInterface $scopeConfig;
@@ -36,7 +38,7 @@ public function isRecacheEnabled(?int $storeId = null): bool
3638
{
3739
return $this->scopeConfig->isSetFlag(
3840
self::XML_PATH_RECACHE_ENABLED,
39-
ScopeInterface::SCOPE_STORE,
41+
ScopeInterface::SCOPE_STORES,
4042
$storeId
4143
);
4244
}
@@ -51,7 +53,7 @@ public function getToken(?int $storeId = null): ?string
5153
{
5254
return $this->scopeConfig->getValue(
5355
self::XML_PATH_PRERENDER_TOKEN,
54-
ScopeInterface::SCOPE_STORE,
56+
ScopeInterface::SCOPE_STORES,
5557
$storeId
5658
);
5759
}
@@ -66,7 +68,7 @@ public function isUseProductCanonicalUrlEnabled(?int $storeId = null): bool
6668
{
6769
return $this->scopeConfig->isSetFlag(
6870
self::XML_PATH_PRERENDER_USE_PRODUCT_CANONICAL_URL,
69-
ScopeInterface::SCOPE_STORE,
71+
ScopeInterface::SCOPE_STORES,
7072
$storeId
7173
);
7274
}

Model/Url/GetUrlsForProducts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function execute(array $productIds, int $storeId): array
6767
}
6868

6969
// Ignore the product URL with category path.
70-
if ($urlRewrite->getMetadata() && $useProductCanonical) {
70+
if ($useProductCanonical && $urlRewrite->getMetadata()) {
7171
continue;
7272
}
7373
try {

0 commit comments

Comments
 (0)