Back-in-stock notifications not sent for attribute combinations with multiple warehouses
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
Direzione di ricerca
Start with src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.cs, especially InsertOrUpdateProductAttributeCombinationPopup and PrepareCombinationWarehouseInventory, then inspect ProductAttributeCombination.Clone() in src/Core/Grand.Domain/Catalog/ProductAttributeCombination.cs and the multi-warehouse branch of OutOfStockNotifications. Add a unit test for editing a combination's warehouse stock from zero to positive with a subscriber; done means a notification is queued and the existing single-warehouse behavior remains unaffected.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
When a product uses stock management by attribute combinations with multiple warehouses, raising the stock of a combination's warehouse in the admin panel does not send back-in-stock notifications to subscribers.
Steps to reproduce
- Create a product, published, with
Manage inventory method = Manage stock by attributes,Use multiple warehousesenabled,Allow out of stock subscriptionsenabled andBackorders = No backorders. - Add an attribute combination with warehouse stock 0 in one warehouse.
- As a customer, subscribe to the "notify me when available" for that combination.
- In admin, edit the combination (edit popup) and raise that warehouse's stock above 0.
- No notification is queued for the subscriber.
Cause
ProductViewModelService.InsertOrUpdateProductAttributeCombinationPopup (src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.cs, ~line 2239) snapshots the previous state with combination.Clone(). ProductAttributeCombination.Clone() (src/Core/Grand.Domain/Catalog/ProductAttributeCombination.cs, line 87) is MemberwiseClone(), a shallow copy, so the WarehouseInventory list and its items are shared between the clone and the original.
PrepareCombinationWarehouseInventory (~line 2088) then modifies those shared ProductCombinationWarehouseInventory items in place (existingPwI.StockQuantity = ..., and Add/Remove on the shared list). When OutOfStockNotifications(product, combination, prevCombination) runs (~line 223), the multi-warehouse branch compares prevcombination.WarehouseInventory with combination.WarehouseInventory, which are the same objects, so "previously out of stock, now in stock" is never detected, both for the per-warehouse check and for the total-sum check.
The single-warehouse branch is not affected, since StockQuantity is a value type copied by the clone. The product-level path is not affected either: it snapshots prevMultiWarehouseStock into new ProductWarehouseInventory objects (~line 781).
Suggested fix
Deep-copy WarehouseInventory when snapshotting the previous state (e.g. in Clone() or in the service, create new ProductCombinationWarehouseInventory items with WarehouseId, StockQuantity, ReservedQuantity), or capture the previous per-warehouse quantities before PrepareCombinationWarehouseInventory mutates them. A unit test for the combination edit path with multiple warehouses would cover this.
Notes
Related: #880 (journaling manual stock changes), which touches the same manual stock edit flow.
- Lingua principale
- C#
- Stelle
- 1.3k
- Fork
- 549
- Merge medio
- 8h 14m
- PR unite (30g)
- 53
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di grandnode/grandnode2
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
grandnode/grandnode2#880 ·
I maintainer di solito rispondono entro 1 giorno
-
Please add the offer systemAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
grandnode/grandnode2#849 ·
I maintainer di solito rispondono entro 1 giorno
-
grandnode/grandnode2#499 ·
I maintainer di solito rispondono entro 1 giorno
-
grandnode/grandnode2#410 ·
I maintainer di solito rispondono entro 1 giorno
-
grandnode/grandnode2#396 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di grandnode/grandnode2
Issue simili
-
[i18n] 安装实例完成后的成功提示未正确本地化Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
PCL-Community/PCL-CE#3658 ·
I maintainer di solito rispondono entro 1 giorno
-
Deploy & Patch-issues opprettes ikke: create-pnd-issues.yml har feilet hver uke siden 2025-09-08Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Altinn/altinn-auth#4359 ·
I maintainer di solito rispondono entro 1 giorno
-
アプリ: チャット 優先: 中 提案
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
yksr-melt/Meltype#243 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
type/automation type/tech-debt
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
High-DPI fixes for release/1.3: editor toolbar icons and Color Picker layout (patch included)Apertano-stack-trace
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno