Files
bewell-in-ua/lib/db/prisma/sql/getCatalogIndexData.sql
2025-02-07 08:34:42 +02:00

21 lines
695 B
SQL

SELECT DISTINCT
p.id as productId,
pl.lang,
pl.slug,
pr.uri as image,
pr.width as imageWidth,
pr.height as imageHeight,
pts.price,
pts.price_promotional as pricePromotional,
pl.title,
pl.short_title as shortTitle,
pl.description
-- pl.content, pl.heading_title as headingTitle, pl.instruction
FROM products p
JOIN categories_on_products cop ON p.id = cop.product_id
JOIN product_locale pl ON pl.product_id = p.id
JOIN product_to_store pts ON pts.product_id = p.id AND pts.store_id = cop.store_id
LEFT JOIN product_resources pr ON p.id = pr.product_id AND pr.isFeature = TRUE
WHERE cop.store_id = 1 AND pl.lang = ?
ORDER BY p.id DESC;