mysqlrelationshipshopware6

Connection between table seo_url and table product_category in Shopware6


is it possible, connecting table seo_url with table product_category by Query? If yes, which tables have to be joined?


Solution

  • Use the combination of foreign_key and route_name when joining.

    SELECT *
    FROM seo_url su
    LEFT JOIN product p ON p.id = su.foreign_key AND su.route_name = 'frontend.detail.page';
    

    With this query, you get the SEO URLs of product details pages and the corresponding product data.