From 7d82c8626164391a2fd6d22705d4135fdfa08c5f Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 31 Aug 2025 02:19:10 +0200 Subject: [PATCH] fixx --- .../Infrastructure/PluginNopStartup.cs | 4 +++- .../Services/CustomPriceCalculationService.cs | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs b/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs index 480d90d..7ba15f2 100644 --- a/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs +++ b/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs @@ -39,6 +39,8 @@ public class PluginNopStartup : INopStartup //register services and interfaces //services.AddScoped(); services.AddScoped(); + services.AddScoped(); + services.AddScoped(); services.AddScoped(); services.AddControllersWithViews(options => { @@ -71,5 +73,5 @@ public class PluginNopStartup : INopStartup /// /// Gets order of this startup configuration implementation /// - public int Order => 100; + public int Order => 4000; } \ No newline at end of file diff --git a/Nop.Plugin.Misc.AIPlugin/Services/CustomPriceCalculationService.cs b/Nop.Plugin.Misc.AIPlugin/Services/CustomPriceCalculationService.cs index 0e203a4..ec1d388 100644 --- a/Nop.Plugin.Misc.AIPlugin/Services/CustomPriceCalculationService.cs +++ b/Nop.Plugin.Misc.AIPlugin/Services/CustomPriceCalculationService.cs @@ -19,6 +19,7 @@ public class CustomPriceCalculationService : PriceCalculationService { private readonly IRepository _productRepository; private readonly IProductAttributeService _productAttributeService; + private readonly ISpecificationAttributeService _specificationAttributeService; private readonly ILocalizationService _localizationService; private readonly IProductService _productService; @@ -32,7 +33,8 @@ public class CustomPriceCalculationService : PriceCalculationService IManufacturerService manufacturerService, IProductAttributeParser productAttributeParser, IProductAttributeService productAttributeService, - IProductService productService, + ISpecificationAttributeService specificationAttributeService, + IProductService productService, ICustomerService customerService, IDiscountService discountService, IDiscountPluginManager discountPluginManager, @@ -47,6 +49,7 @@ public class CustomPriceCalculationService : PriceCalculationService _productRepository = productRepository; // assign all base deps to local private vars if needed _productAttributeService = productAttributeService; + _specificationAttributeService = specificationAttributeService; _localizationService = localizationService; _productService = productService; } @@ -59,7 +62,7 @@ public class CustomPriceCalculationService : PriceCalculationService int quantity = 1, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null) { - var productAttributeMappings = await _productAttributeService.GetProductAttributeMappingsByProductIdAsync(product.Id); + var productAttributeMappings = await _productAttributeService.GetAllProductAttributesAsync(product.Id); //Product Attributes foreach (var pam in productAttributeMappings) { @@ -74,7 +77,7 @@ public class CustomPriceCalculationService : PriceCalculationService } } - return await base.GetFinalPriceAsync(product, customer, store, 0, additionalCharge, includeDiscounts, quantity, rentalStartDate, rentalEndDate); + return await base.GetFinalPriceAsync(product, customer, store, overriddenProductPrice, additionalCharge, includeDiscounts, quantity, rentalStartDate, rentalEndDate); }