url 中带有随机字符串的 shopware 6 商品编号
shopware 6 article number with random string in url
在 Shopware 6 我有这个产品 url:
/{{ product.autoIncrement }}/{{ product.translated.name|lower}}/
例如:/1539/mercedes-benz/
是否可以将产品名称设为自由文本?那么如果我输入url/1539/mercedesbenzzz/
那我就去同一个产品?
我试图覆盖 SeoUrlPlaceholderHandlerInterface
但我认为这不是正确的方法。有什么想法吗?
覆盖 SeoUrlPlaceholderHandlerInterface
没有帮助,因为这是为了生成存储在 Shopware 6 数据库中的 URL。
你想要的是覆盖路由,所以Shopware只匹配自增Id。
使用调试栏找出产品页面使用的路由器并进行修改。
起点:
\Shopware\Storefront\Framework\Routing\RequestTransformer::resolveSeoUrl
\Shopware\Core\Content\Seo\SeoResolver::resolve
在 Shopware 6 我有这个产品 url:
/{{ product.autoIncrement }}/{{ product.translated.name|lower}}/
例如:/1539/mercedes-benz/
是否可以将产品名称设为自由文本?那么如果我输入url/1539/mercedesbenzzz/
那我就去同一个产品?
我试图覆盖 SeoUrlPlaceholderHandlerInterface
但我认为这不是正确的方法。有什么想法吗?
覆盖 SeoUrlPlaceholderHandlerInterface
没有帮助,因为这是为了生成存储在 Shopware 6 数据库中的 URL。
你想要的是覆盖路由,所以Shopware只匹配自增Id。
使用调试栏找出产品页面使用的路由器并进行修改。
起点:
\Shopware\Storefront\Framework\Routing\RequestTransformer::resolveSeoUrl
\Shopware\Core\Content\Seo\SeoResolver::resolve