diff --git a/viz/app/search_page.js b/viz/app/search_page.js index d535b9d..2ba0e7e 100644 --- a/viz/app/search_page.js +++ b/viz/app/search_page.js @@ -157,16 +157,22 @@ export function renderSearch($app) { const when = r.ts ? prettyTs(r.ts) : r.date || ""; const rawSku = String(r.sku || ""); const sku = canon(rawSku); - const img = aggBySku.get(sku)?.img || ""; + + const agg = aggBySku.get(sku) || null; + const img = agg?.img || ""; + + // show "+N" if the canonical SKU exists in other stores (via SKU mapping) + const storeCount = agg?.stores?.size || 0; + const plus = storeCount > 1 ? ` +${storeCount - 1}` : ""; const href = String(r.url || "").trim(); const storeBadge = href ? `${esc( - r.storeLabel || "" + (r.storeLabel || "") + plus )}` - : `${esc(r.storeLabel || "")}`; + : `${esc((r.storeLabel || "") + plus)}`; // date as a badge so it sits nicely in the single meta row const dateBadge = when ? `${esc(when)}` : "";