Files
bssapp/svc/queries/product_pricing_dims_mssql.go
2026-06-19 00:49:59 +03:00

26 lines
948 B
Go

package queries
// GetProductVariantDimsForPricing:
// Pull variant dimension combos from Nebim's variant master table.
// We intentionally keep it small: only the keys we need to write dim-aware prices into PG sdprc.
//
// Note: Column semantics depend on your Nebim setup. We treat ItemDim1Code/ItemDim3Code as the
// primary variant dimensions used by the e-commerce sdprc dim filters.
const GetProductVariantDimsForPricing = `
DECLARE @ProductCode NVARCHAR(50) = @p1;
SELECT DISTINCT
LTRIM(RTRIM(ISNULL(V.ColorCode,''))) AS ColorCode,
LTRIM(RTRIM(ISNULL(V.ItemDim1Code,''))) AS ItemDim1Code,
LTRIM(RTRIM(ISNULL(V.ItemDim3Code,''))) AS ItemDim3Code
FROM prItemVariant V WITH(NOLOCK)
WHERE V.ItemTypeCode = 1
AND V.ItemCode = @ProductCode
AND LEN(V.ItemCode) = 13
AND LEN(@ProductCode) = 13
ORDER BY
LTRIM(RTRIM(ISNULL(V.ColorCode,''))),
LTRIM(RTRIM(ISNULL(V.ItemDim1Code,''))),
LTRIM(RTRIM(ISNULL(V.ItemDim3Code,'')));
`