You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Shopware6中seo_url与product_category表关联查询可行性及关联表咨询

Shopware6中seo_url与product_category的关联方法

可以通过查询语句将seo_url表与product_category表关联,核心是利用seo_url的实体标识字段匹配product_category中的关联ID,具体逻辑如下:

  • 关联核心规则:
    • seo_url.entity_id 需对应 product_category 中的 product_id(此时seo_url.entity_type指定为product),或对应category_id(此时seo_url.entity_type指定为category)

无需额外中间表,直接通过上述字段条件即可关联。以下是示例查询,可同时获取产品分类关联的产品SEO链接和分类SEO链接:

SELECT 
    pc.product_id,
    pc.category_id,
    prod_seo.seo_path_info AS product_seo_path,
    prod_seo.sales_channel_id AS product_seo_channel_id,
    cat_seo.seo_path_info AS category_seo_path,
    cat_seo.sales_channel_id AS category_seo_channel_id
FROM product_category pc
LEFT JOIN seo_url prod_seo 
    ON pc.product_id = prod_seo.entity_id 
    AND prod_seo.entity_type = 'product'
LEFT JOIN seo_url cat_seo 
    ON pc.category_id = cat_seo.entity_id 
    AND cat_seo.entity_type = 'category';

若需限定特定销售渠道的SEO链接,可在JOIN条件中添加prod_seo.sales_channel_id = 目标渠道ID或cat_seo.sales_channel_id = 目标渠道ID。

内容的提问来源于stack exchange,提问作者user24710148

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 16:03:12