This commit is contained in:
Adam 2025-08-31 02:19:10 +02:00
parent 566ff1ea5f
commit 7d82c86261
2 changed files with 9 additions and 4 deletions

View File

@ -39,6 +39,8 @@ public class PluginNopStartup : INopStartup
//register services and interfaces //register services and interfaces
//services.AddScoped<CustomModelFactory, ICustomerModelFactory>(); //services.AddScoped<CustomModelFactory, ICustomerModelFactory>();
services.AddScoped<IPriceCalculationService, CustomPriceCalculationService>(); services.AddScoped<IPriceCalculationService, CustomPriceCalculationService>();
services.AddScoped<PriceCalculationService, CustomPriceCalculationService>();
services.AddScoped<IOrderMeasurementService, OrderMeasurementService>();
services.AddScoped<PendingMeasurementCheckoutFilter>(); services.AddScoped<PendingMeasurementCheckoutFilter>();
services.AddControllersWithViews(options => services.AddControllersWithViews(options =>
{ {
@ -71,5 +73,5 @@ public class PluginNopStartup : INopStartup
/// <summary> /// <summary>
/// Gets order of this startup configuration implementation /// Gets order of this startup configuration implementation
/// </summary> /// </summary>
public int Order => 100; public int Order => 4000;
} }

View File

@ -19,6 +19,7 @@ public class CustomPriceCalculationService : PriceCalculationService
{ {
private readonly IRepository<Product> _productRepository; private readonly IRepository<Product> _productRepository;
private readonly IProductAttributeService _productAttributeService; private readonly IProductAttributeService _productAttributeService;
private readonly ISpecificationAttributeService _specificationAttributeService;
private readonly ILocalizationService _localizationService; private readonly ILocalizationService _localizationService;
private readonly IProductService _productService; private readonly IProductService _productService;
@ -32,6 +33,7 @@ public class CustomPriceCalculationService : PriceCalculationService
IManufacturerService manufacturerService, IManufacturerService manufacturerService,
IProductAttributeParser productAttributeParser, IProductAttributeParser productAttributeParser,
IProductAttributeService productAttributeService, IProductAttributeService productAttributeService,
ISpecificationAttributeService specificationAttributeService,
IProductService productService, IProductService productService,
ICustomerService customerService, ICustomerService customerService,
IDiscountService discountService, IDiscountService discountService,
@ -47,6 +49,7 @@ public class CustomPriceCalculationService : PriceCalculationService
_productRepository = productRepository; _productRepository = productRepository;
// assign all base deps to local private vars if needed // assign all base deps to local private vars if needed
_productAttributeService = productAttributeService; _productAttributeService = productAttributeService;
_specificationAttributeService = specificationAttributeService;
_localizationService = localizationService; _localizationService = localizationService;
_productService = productService; _productService = productService;
} }
@ -59,7 +62,7 @@ public class CustomPriceCalculationService : PriceCalculationService
int quantity = 1, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null) 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 //Product Attributes
foreach (var pam in productAttributeMappings) 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);
} }