diff --git a/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs b/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs
index 7ba15f2..13d60df 100644
--- a/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs
+++ b/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs
@@ -73,5 +73,5 @@ public class PluginNopStartup : INopStartup
///
/// Gets order of this startup configuration implementation
///
- public int Order => 4000;
+ public int Order => 100;
}
\ 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 ec1d388..55d55ec 100644
--- a/Nop.Plugin.Misc.AIPlugin/Services/CustomPriceCalculationService.cs
+++ b/Nop.Plugin.Misc.AIPlugin/Services/CustomPriceCalculationService.cs
@@ -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());
}
- }
+
}
return await base.GetFinalPriceAsync(product, customer, store, overriddenProductPrice, additionalCharge, includeDiscounts, quantity, rentalStartDate, rentalEndDate);