magento 2中存在一个已知问题: https://www.experts-exchange.com/questions/29015069/Magento-2-URL-key-for-specified-store-already-exists.html
我已经创建了一个模块来解决上述问题。当我运行升级命令时。我收到这个错误。
1 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.
The following modules are outdated:
Jjcommerce_CatalogUrlRewrite data: current version - none, required version - 2.0.0
现在这是我的registration.php文件代码
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Jjcommerce_CatalogUrlRewrite',
__DIR__
);
这是module.xml文件:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Jjcommerce_CatalogUrlRewrite" setup_version="0.0.1">
</module>
</config>
这是di.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\CatalogUrlRewrite\Model\Product\AnchorUrlRewriteGenerator" type="Jjcommerce\CatalogUrlRewrite\Model\Product\AnchorUrlRewriteGenerator" />
<preference for="Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator" type="Jjcommerce\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator" />
</config>
请帮忙做什么?
由于
答案 0 :(得分:0)
您可以将setup_version更新为当前所需的版本。以下是解决方案module.xml文件的文件更新