Skip to content

Commit

Permalink
Merge pull request #13 from customgento/DEV-362-fix-mageworx-dependency
Browse files Browse the repository at this point in the history
Fix mageworx dependency, DEV-362
  • Loading branch information
sprankhub authored Jun 3, 2024
2 parents 1f42ca7 + 7fd5026 commit 546c83e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
26 changes: 17 additions & 9 deletions Helper/StoreUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,25 @@
use Magento\Store\Model\Store;
use MageWorx\SeoBase\Helper\StoreUrl as MageworxStoreUrl;

class StoreUrl extends MageworxStoreUrl
{
protected function isUseStoreCodeInUrl(StoreInterface $store): bool
if (class_exists(MageworxStoreUrl::class)) {
class StoreUrl extends MageworxStoreUrl
{
if ($store->getCode() !== Store::ADMIN_CODE && $store->isDefault()) {
return false;
}
protected function isUseStoreCodeInUrl(StoreInterface $store): bool
{
if ($store->getCode() !== Store::ADMIN_CODE && $store->isDefault()) {
return false;
}

$storeId = (int)$store->getId();

$storeId = (int)$store->getId();
return !($store->hasDisableStoreInUrl() && $store->getDisableStoreInUrl())
// @phpstan-ignore-next-line
&& $this->configDataLoader->getConfigValue(Store::XML_PATH_STORE_IN_URL, $storeId);
}
}
} else {
class StoreUrl
{

return !($store->hasDisableStoreInUrl() && $store->getDisableStoreInUrl())
&& $this->configDataLoader->getConfigValue(Store::XML_PATH_STORE_IN_URL, $storeId);
}
}
3 changes: 1 addition & 2 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
<type name="Magento\Store\Model\Store">
<plugin name="hide_default_store_code" type="CustomGento\DefaultStoreCodeRemover\Plugin\Store\HideDefaultStoreCodePlugin"/>
</type>

<preference for="MageWorx\SeoBase\Helper\StoreUrl" type="CustomGento\DefaultStoreCodeRemover\Helper\StoreUrl"/>
</config>
</config>

0 comments on commit 546c83e

Please sign in to comment.