Custom calculation works, but SignalR is effective now
This commit is contained in:
parent
7d82c86261
commit
34455c0de5
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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)
|
||||
{
|
||||
//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 (attr.Name == "NeedsToBeMeasured" && attr.IsPreSelected)
|
||||
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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue