internal product index
This commit is contained in:
@@ -47,6 +47,9 @@ func resolveTaxBp(class string) int {
|
||||
// quietly swapping in a default 2500 and miscategorising)
|
||||
// Title (canonical, post-trim)
|
||||
// Image (canonical)
|
||||
// ItemID (positive bus values override HTTP; zero is the
|
||||
// documented "no id" signal, so a tombstone's zero or an
|
||||
// unbus-fed cache value won't clobber a real HTTP id.)
|
||||
// InventoryTracked (only flips to true; false is the zero value in proto
|
||||
// and may be unset on the wire, so we don't second-guess)
|
||||
// DropShip (only flips to true; same reasoning)
|
||||
@@ -54,12 +57,14 @@ func resolveTaxBp(class string) int {
|
||||
// The HTTP-fetched values remain authoritative for fields the cache does not
|
||||
// carry: SellerId / SellerName (marketplace split), Stock (per docs/inventory-
|
||||
// shape.md stock is queried synchronously from inventory, not cached),
|
||||
// OrgPrice / Discount (not yet on the projection schema), the dynamic
|
||||
// OrgPrice / Discount (not yet on the projection schema), and the dynamic
|
||||
// ExtraJson product data (configurator options — width/height used by
|
||||
// accessory child-pricing), and the catalog uint32 ItemId (the product
|
||||
// service's integer id which messages.AddItem.ItemId dedupes on — Projection
|
||||
// only carries the opaque string ID, so a cache-only build path is blocked
|
||||
// and the HTTP fetch is preserved).
|
||||
// accessory child-pricing).
|
||||
//
|
||||
// Now that ItemID round-trips from the bus, a future "cache-only" build path
|
||||
// (skipping PRODUCT_BASE_URL entirely for known SKUs) is unblocked — the
|
||||
// only fields left HTTP-only in that future path are Sellers, Stock, OrgPrice
|
||||
// and configurator extras, none of which affect line dedup.
|
||||
//
|
||||
// Tombstoned SKUs (catalog.projection_published with deleted=true) → the
|
||||
// caller checks idx.IsDeleted(sku) before this helper and short-circuits.
|
||||
@@ -78,6 +83,12 @@ func ApplyProjectionOverlay(msg *messages.AddItem, p catalog.Projection) {
|
||||
if p.TaxClass != "" {
|
||||
msg.Tax = int32(resolveTaxBp(p.TaxClass))
|
||||
}
|
||||
// ItemId: positive bus values override HTTP. Zero means the producer
|
||||
// didn't publish an id (some sources have no integer id) — we leave the
|
||||
// HTTP-fetched id intact in that case rather than zeroing out a real id.
|
||||
if p.ItemID != 0 {
|
||||
msg.ItemId = p.ItemID
|
||||
}
|
||||
// Display fields: only override if non-empty so the HTTP-fanned value
|
||||
// remains in place when the cache hasn't populated them yet.
|
||||
if p.Title != "" {
|
||||
|
||||
Reference in New Issue
Block a user