Hey,
I 've extended the default PriceAgentItemFactory as the instructions say in Litium Docs but for some reason the PriceAgentScheduler is ignoring my extension and only running the default factory every time it runs. Am I missing something? Do I need to refer my extension of the factory somewhere?
Litium version: 6.2.2
Can you provide any code about your extended factory so it is possible to test?
Here it comes.
public class SamplePriceAgentItemFactory : PriceAgentItemFactory
{
private readonly ModuleCMS _moduleCms;
public SamplePriceAgentItemFactory(IPriceCalculator priceCalculator, IStockStatusCalculator stockStatusCalculator, ICampaignPriceCalculator campaignPriceCalculator, IOrderFactory orderFactory, ModuleCMS moduleCms, LanguageService languageService, UrlService urlService, CategoryService categoryService, CurrencyService currencyService, FieldDefinitionService fieldDefinitionService, Litium.Foundation.Settings.ISettingService settingService)
: base(priceCalculator, stockStatusCalculator, campaignPriceCalculator, orderFactory, moduleCms, languageService, urlService, categoryService, currencyService, fieldDefinitionService, settingService)
{
_moduleCms = moduleCms;
}
public override PriceAgentItemResult Create(PriceAgentItemArgs priceAgentItemArgs)
{
var website = _moduleCms.WebSites.GetWebSite(priceAgentItemArgs.WebSiteSystemId);
var result = base.Create(priceAgentItemArgs);
//custom code
return result;
}
}
Check the output from Litium.IoC.Container.RegistratedComponents
when you are debugging and see that your factory is registered before the default one.
My factory comes after Litium.Web.Products.PriceAgents.PriceAgentItemFactory
in the list of Litium.IoC.Container.RegistratedComponents
.
Try to add the assembly with the add
node in the web.config
regarding to https://docs.litium.com/documentation/get-started/web_config#plugins
1 Like
Adding the assembly in the web.config put my factory before the default in the RegistratedComponents list and it is now triggered. Thanks!
1 Like
While the factory is now triggered successfully I still get zero products on the price agent .axd plugins.
I get this error in the log.