Custom calculation works, but SignalR is effective now

This commit is contained in:
Adam 2025-08-31 11:33:03 +02:00
parent 7d82c86261
commit 34455c0de5
2 changed files with 11 additions and 8 deletions

View File

@ -73,5 +73,5 @@ public class PluginNopStartup : INopStartup
/// <summary>
/// Gets order of this startup configuration implementation
/// </summary>
public int Order => 4000;
public int Order => 100;
}

View File

@ -62,19 +62,22 @@ public class CustomPriceCalculationService : PriceCalculationService
int quantity = 1, DateTime? rentalStartDate = null, DateTime? rentalEndDate = null)
{
var productAttributeMappings = await _productAttributeService.GetAllProductAttributesAsync(product.Id);
var productAttributeMappings = await _specificationAttributeService.GetProductSpecificationAttributesAsync(product.Id);
//Product Attributes
foreach (var pam in productAttributeMappings)
{
var attributes = await _productAttributeService.GetProductAttributeValuesAsync(pam.Id);
foreach (var attr in attributes)
{
// you can check for specific attribute by its name or id
if (attr.Name == "NeedsToBeMeasured" && attr.IsPreSelected)
//get option
var attributeOtion = await _specificationAttributeService.GetSpecificationAttributeOptionByIdAsync(pam.SpecificationAttributeOptionId);
//get attribute
var attribute = await _specificationAttributeService.GetSpecificationAttributeByIdAsync(attributeOtion.SpecificationAttributeId);
// you can check for specific attribute by its name or id
if (attribute.Name == "Needs to be measured for price")
{
return (0m, 0m, 0m, new List<Discount>());
}
}
}
return await base.GetFinalPriceAsync(product, customer, store, overriddenProductPrice, additionalCharge, includeDiscounts, quantity, rentalStartDate, rentalEndDate);