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
//services.AddScoped<CustomModelFactory, ICustomerModelFactory>();
services.AddScoped<IPriceCalculationService, CustomPriceCalculationService>();
services.AddScoped<PriceCalculationService, CustomPriceCalculationService>();
services.AddScoped<IOrderMeasurementService, OrderMeasurementService>();
services.AddScoped<PendingMeasurementCheckoutFilter>();
services.AddControllersWithViews(options =>
{
@ -71,5 +73,5 @@ public class PluginNopStartup : INopStartup
/// <summary>
/// Gets order of this startup configuration implementation
/// </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 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);
}