Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Back-in-stock notifications not sent for attribute combinations with multiple warehouses

Abierto
#881 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
65/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp, mongodb

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

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

  1. Create a product, published, with Manage inventory method = Manage stock by attributes, Use multiple warehouses enabled, Allow out of stock subscriptions enabled and Backorders = No backorders.
  2. Add an attribute combination with warehouse stock 0 in one warehouse.
  3. As a customer, subscribe to the "notify me when available" for that combination.
  4. In admin, edit the combination (edit popup) and raise that warehouse's stock above 0.
  5. 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.

Lenguaje dominante
C#
Estrellas
1.3k
Forks
549
Merge medio
8 h 14 min
PR fusionados (30 d)
53

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de grandnode/grandnode2

Todos los issues de grandnode/grandnode2

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.