grand commit
This commit is contained in:
26
lib/db/prisma/sql/getProductByIdWitData.sql
Normal file
26
lib/db/prisma/sql/getProductByIdWitData.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
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,
|
||||
cl.category_id as categoryId,
|
||||
pl.title,
|
||||
pl.short_title as shortTitle,
|
||||
pl.description,
|
||||
pl.content,
|
||||
pl.heading_title as headingTitle,
|
||||
pl.instruction,
|
||||
cl.slug as categorySlug,
|
||||
cl.title as categoryTitle
|
||||
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 category_locales cl ON cl.category_id = cop.category_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 p.id = ?
|
||||
ORDER BY pl.lang
|
||||
Reference in New Issue
Block a user