Skip to content

Commit

Permalink
Updated the helper class with constant and config logic, changed the …
Browse files Browse the repository at this point in the history
…order of the logic for product paths
  • Loading branch information
ryanjehan-aligent committed Jan 4, 2024
1 parent da84611 commit f2c024b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions Helper/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

declare(strict_types=1);

namespace Aligent\PrerenderIo\Helper;

use Magento\Framework\App\Config\ScopeConfigInterface;
Expand All @@ -13,6 +14,7 @@ class Config
{
private const XML_PATH_RECACHE_ENABLED = 'system/prerender_io/enabled';
private const XML_PATH_PRERENDER_TOKEN = 'system/prerender_io/token';
private const XML_PATH_PRERENDER_USE_PRODUCT_CANONICAL_URL = 'system/prerender_io/use_product_canonical_url';

/** @var ScopeConfigInterface */
private ScopeConfigInterface $scopeConfig;
Expand All @@ -36,7 +38,7 @@ public function isRecacheEnabled(?int $storeId = null): bool
{
return $this->scopeConfig->isSetFlag(
self::XML_PATH_RECACHE_ENABLED,
ScopeInterface::SCOPE_STORE,
ScopeInterface::SCOPE_STORES,
$storeId
);
}
Expand All @@ -51,7 +53,7 @@ public function getToken(?int $storeId = null): ?string
{
return $this->scopeConfig->getValue(
self::XML_PATH_PRERENDER_TOKEN,
ScopeInterface::SCOPE_STORE,
ScopeInterface::SCOPE_STORES,
$storeId
);
}
Expand All @@ -66,7 +68,7 @@ public function isUseProductCanonicalUrlEnabled(?int $storeId = null): bool
{
return $this->scopeConfig->isSetFlag(
self::XML_PATH_PRERENDER_USE_PRODUCT_CANONICAL_URL,
ScopeInterface::SCOPE_STORE,
ScopeInterface::SCOPE_STORES,
$storeId
);
}
Expand Down
2 changes: 1 addition & 1 deletion Model/Url/GetUrlsForProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function execute(array $productIds, int $storeId): array
}

// Ignore the product URL with category path.
if ($urlRewrite->getMetadata() && $useProductCanonical) {
if ($useProductCanonical && $urlRewrite->getMetadata()) {
continue;
}
try {
Expand Down

0 comments on commit f2c024b

Please sign in to comment.