diff --git a/src/datasources/sql/products-sql.ts b/src/datasources/sql/products-sql.ts index 334fd2e..50b7849 100644 --- a/src/datasources/sql/products-sql.ts +++ b/src/datasources/sql/products-sql.ts @@ -225,5 +225,17 @@ export function searchByFieldValue(fieldid: number) { } export function getProductListPrice() { - return 'SELECT listprice FROM v_listprices WHERE market_id = ? AND printproduct_id = ?'; + // Temporary solution during partial release of new pricing system. + // Wallpapers read price from new pricing system's listprice view, external products use the old view. + return ` + SELECT CASE + WHEN groupid IN (1,3) THEN new.listprice + ELSE old.listprice + END AS listprice + FROM v_listprices_new new + JOIN "product-printproducts" pp ON new.printproduct_id = printid + JOIN v_listprices old USING (market_id, printproduct_id) + WHERE new.market_id = ? AND new.printproduct_id = ? + `; + // return 'SELECT listprice FROM v_listprices WHERE market_id = ? AND printproduct_id = ?'; }