diff --git a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/CustomOrderController.cs b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/CustomOrderController.cs index 7542d30..8c40534 100644 --- a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/CustomOrderController.cs +++ b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/CustomOrderController.cs @@ -232,10 +232,12 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers foreach (var item in orderProducts) { var product = await _productService.GetProductByIdAsync(item.Id); - if (product == null) + if (product == null || product.StockQuantity - item.Quantity < 0) { - _logger.Error($"(product == null); {item}"); - continue; + var errorText = $"product == null || product.StockQuantity - item.Quantity < 0; productId: {product?.Id}; product?.StockQuantity - item.Quantity: {product?.StockQuantity - item.Quantity}"; + + _logger.Error($"{errorText}"); + throw new Exception($"{errorText}"); } //if (productDtosById.TryGetValue(item.Id, out var productDto)) @@ -450,10 +452,11 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers { result.Add(new { - label = product.Name, + label = $"{product.Name} [KÉSZLET: {product.StockQuantity}]", value = product.Id, sku = product.Sku, - price = product.Price + price = product.Price, + stockQuantity = product.StockQuantity }); } diff --git a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/List.cshtml b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/List.cshtml index b8d4ee6..92adda0 100644 --- a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/List.cshtml +++ b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/List.cshtml @@ -847,6 +847,7 @@ name: product.label, sku: product.sku || '', quantity: 1, + stockQuantity : product.stockQuantity, price: product.price || 0 }; @@ -876,7 +877,7 @@ ); var quantityCell = $('').html( - '' + '' ); var priceCell = $('').html(