From 41bb80fc26b8fc0ca9675826c65a29952b3c01fe Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 25 Oct 2025 13:28:04 +0200 Subject: [PATCH 1/3] faszt --- Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/List.cshtml | 4 ++-- .../Areas/Admin/Views/Product/List.cshtml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 fbeb8bb..031771d 100644 --- a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/List.cshtml +++ b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/List.cshtml @@ -307,8 +307,8 @@ Name = "orders-grid", UrlRead = new DataUrl("OrderList", "CustomOrder", null), SearchButtonId = "search-orders", - Ordering = true, - ServerSide = false, + // Ordering = true, + // ServerSide = false, Length = Model.PageSize, LengthMenu = Model.AvailablePageSizes, FooterCallback = !Model.IsLoggedInAsVendor ? "ordersfootercallback" : null, diff --git a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Product/List.cshtml b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Product/List.cshtml index c0c274b..131142f 100644 --- a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Product/List.cshtml +++ b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Product/List.cshtml @@ -219,8 +219,8 @@ UrlRead = new DataUrl("ProductList", "CustomProduct", null), SearchButtonId = "search-products", Length = Model.PageSize, - Ordering = true, - ServerSide = false, + // Ordering = true, + // ServerSide = false, LengthMenu = Model.AvailablePageSizes, Filters = new List { From f73c434ca8ff003819b1d1a4a6695705527528a5 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 25 Oct 2025 17:36:08 +0200 Subject: [PATCH 2/3] empty order fix --- .../Order/_CustomOrderDetails.Products.cshtml | 722 +++++++++--------- 1 file changed, 366 insertions(+), 356 deletions(-) diff --git a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/_CustomOrderDetails.Products.cshtml b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/_CustomOrderDetails.Products.cshtml index fbdddec..3a583bd 100644 --- a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/_CustomOrderDetails.Products.cshtml +++ b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Views/Order/_CustomOrderDetails.Products.cshtml @@ -4,271 +4,278 @@ @using Nop.Core.Domain.Catalog;
-
-
- @foreach (var item in Model.ItemExtendeds) - { - - } - - - - - @if (Model.HasDownloadableProducts) - { - - } - - - - - @if (!Model.IsLoggedInAsVendor) - { - - } - - -@* + } + } + } + + +
+
+
+ @{ + if (Model.ItemExtendeds != null) + { + foreach (var item in Model.ItemExtendeds) + { + + } + } + } + + + + @if (Model.HasDownloadableProducts) + { + + } + + + + + @if (!Model.IsLoggedInAsVendor) + { + + } + + + @* *@ - @if (Model.HasDownloadableProducts) - { - - } - - - - - - @* + @if (Model.HasDownloadableProducts) + { + + } + + + + + + @* *@ - - @if (!Model.IsLoggedInAsVendor) - { - - } - - - - @foreach (var item in Model.ItemExtendeds) - { - -@* + @if (!Model.IsLoggedInAsVendor) + { + + } + + + + @{ + if (Model.ItemExtendeds != null) + { + foreach (var item in Model.ItemExtendeds) + { + + @* *@ - @if (Model.HasDownloadableProducts) - { - + @if (Model.HasDownloadableProducts) + { + - } - + } + + - + - + - + - + - @* *@ - - @if (!Model.IsLoggedInAsVendor) - { - + @if (!Model.IsLoggedInAsVendor) + { + - } - - } - -
@T("Admin.Orders.Products.Picture") - @T("Admin.Orders.Products.ProductName") - - @T("Admin.Orders.Products.Download") - - @T("Admin.Orders.Products.Price") - - @T("Admin.Orders.Products.Quantity") - - @T("FruitBank.StockQuantity") - - @T("FruitBank.NetWeight") - - @T("FruitBank.IsMeasurable") - + @T("Admin.Orders.Products.ProductName") + + @T("Admin.Orders.Products.Download") + + @T("Admin.Orders.Products.Price") + + @T("Admin.Orders.Products.Quantity") + + @T("FruitBank.StockQuantity") + + @T("FruitBank.NetWeight") + + @T("FruitBank.IsMeasurable") + @T("Admin.Orders.Products.Discount") - @T("Admin.Orders.Products.Total") - - @T("Admin.Common.Edit") -
+ + @T("Admin.Orders.Products.Total") + + @T("Admin.Common.Edit") +
- @item.ProductName - @if (!string.IsNullOrEmpty(item.AttributeInfo)) - { -

- @Html.Raw(item.AttributeInfo) -

- } - @if (!string.IsNullOrEmpty(item.RecurringInfo)) - { -

- @Html.Raw(item.RecurringInfo) -

- } - @if (!string.IsNullOrEmpty(item.RentalInfo)) - { -

- @Html.Raw(item.RentalInfo) -

- } - @if (!string.IsNullOrEmpty(item.Sku)) - { -

- @T("Admin.Orders.Products.SKU"): - @item.Sku -

- } - @if (!string.IsNullOrEmpty(item.VendorName)) - { -

- @T("Admin.Orders.Products.Vendor"): - @item.VendorName -

- } - @if (item.ReturnRequests.Count > 0) - { -

- @T("Admin.Orders.Products.ReturnRequests"): - @for (var i = 0; i < item.ReturnRequests.Count; i++) - { - var returnRequest = item.ReturnRequests[i]; - @returnRequest.CustomNumber - if (i != item.ReturnRequests.Count - 1) - { - , - } - } -

- } -
- @if (item.IsDownload) - { - - @T("Admin.Orders.Products.Download.Download") - + @item.ProductName + @if (!string.IsNullOrEmpty(item.AttributeInfo)) + { +

+ @Html.Raw(item.AttributeInfo) +

+ } + @if (!string.IsNullOrEmpty(item.RecurringInfo)) + { +

+ @Html.Raw(item.RecurringInfo) +

+ } + @if (!string.IsNullOrEmpty(item.RentalInfo)) + { +

+ @Html.Raw(item.RentalInfo) +

+ } + @if (!string.IsNullOrEmpty(item.Sku)) + { +

+ @T("Admin.Orders.Products.SKU"): + @item.Sku +

+ } + @if (!string.IsNullOrEmpty(item.VendorName)) + { +

+ @T("Admin.Orders.Products.Vendor"): + @item.VendorName +

+ } + @if (item.ReturnRequests.Count > 0) + { +

+ @T("Admin.Orders.Products.ReturnRequests"): + @for (var i = 0; i < item.ReturnRequests.Count; i++) + { + var returnRequest = item.ReturnRequests[i]; + @returnRequest.CustomNumber + if (i != item.ReturnRequests.Count - 1) + { + , + } + } +

+ } +
+ @if (item.IsDownload) + { + + @T("Admin.Orders.Products.Download.Download") + - } - else - { - @T("Admin.Orders.Products.Download.NotAvailable") - } - - @if (Model.AllowCustomersToSelectTaxDisplayType) - { -
@Html.Raw(item.UnitPriceInclTax)
-
@Html.Raw(item.UnitPriceExclTax)
- } - else - { - switch (Model.TaxDisplayType) - { - case TaxDisplayType.ExcludingTax: - { - @Html.Raw(item.UnitPriceExclTax) - } - break; - case TaxDisplayType.IncludingTax: - { - @Html.Raw(item.UnitPriceInclTax) - } - break; - default: - break; - } - } -
-
-
- @T("Admin.Orders.Products.Edit.InclTax") -
-
- -
-
- @*
+ } + else + { + @T("Admin.Orders.Products.Download.NotAvailable") + } +
+ @if (Model.AllowCustomersToSelectTaxDisplayType) + { +
@Html.Raw(item.UnitPriceInclTax)
+
@Html.Raw(item.UnitPriceExclTax)
+ } + else + { + switch (Model.TaxDisplayType) + { + case TaxDisplayType.ExcludingTax: + { + @Html.Raw(item.UnitPriceExclTax) + } + break; + case TaxDisplayType.IncludingTax: + { + @Html.Raw(item.UnitPriceInclTax) + } + break; + default: + break; + } + } +
+
+
+ @T("Admin.Orders.Products.Edit.InclTax") +
+
+ +
+
+ @*
@T("Admin.Orders.Products.Edit.ExclTax")
@@ -277,44 +284,44 @@
*@ -
-
@(item.Quantity) kt.
-
-
-
- -
-
-
-
+
@(item.Quantity) kt.
+
+
+
+ +
+
+
+
-
- @($"{item.ProductStockQuantity} kt.")@($"{(item.ProductIncomingQuantity > 0 ? " (+" + item.ProductIncomingQuantity + ")" : string.Empty)}") -
-
+
+ @($"{item.ProductStockQuantity} kt.")@($"{(item.ProductIncomingQuantity > 0 ? " (+" + item.ProductIncomingQuantity + ")" : string.Empty)}") +
+
- @(item.NetWeight) kg. - - + @(item.NetWeight) kg. + + - @if(item.IsMeasurable) - { - Yes - } - else - { - No - } - - + @if (item.IsMeasurable) + { + Yes + } + else + { + No + } + + + @* @if (Model.AllowCustomersToSelectTaxDisplayType) {
@Html.Raw(item.DiscountInclTax)
@@ -357,41 +364,41 @@
- @if (Model.AllowCustomersToSelectTaxDisplayType) - { -
@Html.Raw(item.SubTotalInclTax)
-
@Html.Raw(item.SubTotalExclTax)
- } - else - { - switch (Model.TaxDisplayType) - { - case TaxDisplayType.ExcludingTax: - { - @Html.Raw(item.SubTotalExclTax) - } - break; - case TaxDisplayType.IncludingTax: - { - @Html.Raw(item.SubTotalInclTax) - } - break; - default: - break; - } - } -
-
-
- @T("Admin.Orders.Products.Edit.InclTax") -
-
- -
-
- @*
+
+ @if (Model.AllowCustomersToSelectTaxDisplayType) + { +
@Html.Raw(item.SubTotalInclTax)
+
@Html.Raw(item.SubTotalExclTax)
+ } + else + { + switch (Model.TaxDisplayType) + { + case TaxDisplayType.ExcludingTax: + { + @Html.Raw(item.SubTotalExclTax) + } + break; + case TaxDisplayType.IncludingTax: + { + @Html.Raw(item.SubTotalInclTax) + } + break; + default: + break; + } + } +
+
+
+ @T("Admin.Orders.Products.Edit.InclTax") +
+
+ +
+
+ @*
@T("Admin.Orders.Products.Edit.ExclTax")
@@ -399,56 +406,59 @@
*@ - -
- + + + - - + + - - + + - -
-
-
- @if (!string.IsNullOrEmpty(Model.CheckoutAttributeInfo) && !Model.IsLoggedInAsVendor) - { -
-
- @Html.Raw(Model.CheckoutAttributeInfo) -
-
- } - @if (!Model.IsLoggedInAsVendor) - { -
-
- -
-
- } + + + } +
+
+
+ @if (!string.IsNullOrEmpty(Model.CheckoutAttributeInfo) && !Model.IsLoggedInAsVendor) + { +
+
+ @Html.Raw(Model.CheckoutAttributeInfo) +
+
+ } + @if (!Model.IsLoggedInAsVendor) + { +
+
+ +
+
+ }
\ No newline at end of file From 4f508c9cab65381fce5d554fa99450536af10fce Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 25 Oct 2025 18:28:13 +0200 Subject: [PATCH 3/3] order fix --- .../Controllers/InnVoiceOrderController.cs | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/InnVoiceOrderController.cs b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/InnVoiceOrderController.cs index 84ad995..9c994a4 100644 --- a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/InnVoiceOrderController.cs +++ b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/InnVoiceOrderController.cs @@ -120,23 +120,41 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers } // Add order items - var orderItems = await _orderService.GetOrderItemsAsync(order.Id); + //var orderItems = await _orderService.GetOrderItemsAsync(order.Id); + var orderItems = await _dbContext.OrderItemDtos.GetAllByOrderId(order.Id, true).ToListAsync(); + Console.WriteLine($"Order Items Count: {orderItems.Count}"); foreach (var item in orderItems) { //var productDTO = await _productService.GetProductByIdAsync(item.ProductId); var product = _dbContext.ProductDtos.GetById(item.ProductId); //string unit = product != null && product.IsMeasurable ? "kg" : "kt"; - - orderRequest.AddItem(new InnVoiceOrderItem + if(item.IsMeasurable) { // in case of measurable products, quantity is in fact weight stored in item.EnteredQuantity + orderRequest.AddItem(new InnVoiceOrderItem + { + TetelNev = product?.Name ?? "Product", + AfaSzoveg = "27%", // Configure VAT rate as needed + Brutto = true, + EgysegAr = item.UnitPriceInclTax, + Mennyiseg = Convert.ToDecimal(item.NetWeight), + MennyisegEgyseg = "kg", + CikkSzam = "" + }); + + } + else { - TetelNev = product?.Name ?? "Product", - AfaSzoveg = "27%", // Configure VAT rate as needed - Brutto = true, - EgysegAr = item.UnitPriceInclTax, - Mennyiseg = item.Quantity, - MennyisegEgyseg = "kt", - CikkSzam = "" - }); + orderRequest.AddItem(new InnVoiceOrderItem + { + TetelNev = product?.Name ?? "Product", + AfaSzoveg = "27%", // Configure VAT rate as needed + Brutto = true, + EgysegAr = item.UnitPriceInclTax, + Mennyiseg = item.Quantity, + MennyisegEgyseg = "kt", + CikkSzam = "" + }); + } + } // Create order via API