variants units
This commit is contained in:
@@ -123,7 +123,14 @@ func (r *productRepository) VariantsForProducts(tenantid, locationid int, produc
|
||||
Select(`
|
||||
v.*,
|
||||
p.productname AS variantproductname,
|
||||
COALESCE(NULLIF((
|
||||
COALESCE(p.unitvalue, '') AS variantunitvalue,
|
||||
COALESCE(p.productunit, '') AS variantproductunit,
|
||||
-- The variant’s own override wins, then the outlet’s price, then the
|
||||
-- master price. The override was being ignored entirely: a size
|
||||
-- priced differently from its product was sold at the product’s
|
||||
-- price. NULLIF because 0 in that column means "no override", not
|
||||
-- "free".
|
||||
COALESCE(NULLIF(v.price, 0), NULLIF((
|
||||
SELECT pl.price FROM productlocations pl
|
||||
WHERE pl.productid = v.variantproductid AND pl.tenantid = v.tenantid AND pl.locationid = ?
|
||||
LIMIT 1
|
||||
|
||||
Reference in New Issue
Block a user