Extending PriceAgentItemFactory not working

Hello! I’m having trouble extending the default Implementation of the PriceAgentItemFactory. I’ve followed the guide on https://docs.litium.com/documentation/litium-documentation/products/price-agents and tried to solve my problem according to this post https://forum.litium.com/t/extended-price-agent-item-factory-not-triggering/628/4

When I run Litium.IoC.Container.RegistratedComponents during debug mode there’s is no result of any PriceAgentItemFactory of any sort.

I’ve also created a new PriceAgent by extending iPriceAgent and that works (but with PriceAgentItemResult without the adjustments i’m trying to accomplish)

So when in debugmode I’m setting a breakpoint but the code never runs.

namespace Litium.ProductFeed.ProductFeedPriceAgent
{
    class ProductFeedPriceAgentItemFactory : PriceAgentItemFactory
    {
        private readonly LanguageService _languageService;
        public ProductFeedPriceAgentItemFactory(IPriceCalculator priceCalculator, 
            IStockStatusCalculator stockStatusCalculator, 
            ICampaignPriceCalculator campaignPriceCalculator, 
            IOrderFactory orderFactory, 
            LanguageService languageService, 
            UrlService urlService, CategoryService categoryService, 
            CurrencyService currencyService, 
            FieldDefinitionService fieldDefinitionService, 
            ISettingService settingService, 
            WebsiteService websiteService, 
            CountryService countryService, 
            ChannelService channelService, 
            DomainNameService domainNameService) :
            base(priceCalculator,  stockStatusCalculator, campaignPriceCalculator, orderFactory, languageService, urlService, categoryService, currencyService, fieldDefinitionService, settingService, websiteService, countryService, channelService, domainNameService)
        { _languageService = languageService; }
        public override PriceAgentItemResult Create(PriceAgentItemArgs priceAgentItemArgs)
        {
            var result = base.CreatePriceAgentItemResult(priceAgentItemArgs);

            return result;
        }
    }
}

Litium version: 7.2.2

What namespace are you importing the PriceAgentItemFactory from? Also check the registered components for Litium.Web.Products.PriceAgents.IPriceAgentItemFactory.

It seems like I solved it somehow, think I messed up the namespace for the project. But I also think I misinterpreted the flow for the PriceAgent because when I typed the URL with the ?Refresh=true the breakpoints got hit in debugmode. So I assuming Litium is doing some magic behind the scenes and “indexing” the products with my added dictionary properties?

But my problem now is I don’t get any result from any PriceAgent. And when running url with ?Refresh=true It takes forever. The site contains 16963 BasePorducts and 34730 variants so my guess this is the culprit for the long run time for refreshing price agents (running local instance with IIS)?

Last run took 30ish minutes but I dont get any results from the price agents so I’m trying ?Refresh=true once again.

I think this line,
var result = base.CreatePriceAgentItemResult(priceAgentItemArgs);
should be
var result = base.Create(priceAgentItemArgs);

Aaaaah I forgot that part… I tried a few things in desperation and forgot that I changed that one haha. But now it seems to work! Thank you!

1 Like

Litium have a scheduled job define in web.config, that will recreate the price-agent feed every night and cache the result. The refresh=true parameters can bypass the cache (and it will also update the cache). The parameter can be used during development/debugging but should not be on the link that is sent to the price agent companies.

On the channel it also exists a settings to enable the price feed so can always be good to check that the settings is true.

So for testing you can update the time when the scheduled task should execute and then after that have pass; and you can see in the log of the processing, you can browse the site url without the refresh-parameter.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.