# Extending PriceAgentItemFactory not working

**URL:** <https://forum.litium.com/t/extending-priceagentitemfactory-not-working/979>\
**Category:** Questions\
**Tags:** litium-7\
**Created:** [July 10, 2019, 8:15am UTC](https://forum.litium.com/t/extending-priceagentitemfactory-not-working/979 "2019-07-10T08:15:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wallroth](https://avatars.discourse-cdn.com/v4/letter/w/e9c0ed/32.png) [@Wallroth](https://forum.litium.com/u/Wallroth)\
**Post date:** [July 10, 2019, 8:15am UTC](https://forum.litium.com/t/extending-priceagentitemfactory-not-working/979/1 "2019-07-10T08:15:07Z")

</div>

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](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](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

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [July 10, 2019, 10:43am UTC](https://forum.litium.com/t/extending-priceagentitemfactory-not-working/979/2 "2019-07-10T10:43:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wallroth](https://avatars.discourse-cdn.com/v4/letter/w/e9c0ed/32.png) [@Wallroth](https://forum.litium.com/u/Wallroth)\
**Post date:** [July 10, 2019, 11:15am UTC](https://forum.litium.com/t/extending-priceagentitemfactory-not-working/979/3 "2019-07-10T11:15:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)\
**Post date:** [July 10, 2019, 11:27am UTC](https://forum.litium.com/t/extending-priceagentitemfactory-not-working/979/4 "2019-07-10T11:27:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wallroth](https://avatars.discourse-cdn.com/v4/letter/w/e9c0ed/32.png) [@Wallroth](https://forum.litium.com/u/Wallroth)\
**Post date:** [July 10, 2019, 11:57am UTC](https://forum.litium.com/t/extending-priceagentitemfactory-not-working/979/5 "2019-07-10T11:57:19Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [July 10, 2019, 12:11pm UTC](https://forum.litium.com/t/extending-priceagentitemfactory-not-working/979/6 "2019-07-10T12:11:29Z")

</div>

> [@Wallroth](#):
>
> Last run took 30ish minutes but I dont get any results from the price agents so I’m trying ?Refresh=true once again.

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [August 7, 2019, 12:11pm UTC](https://forum.litium.com/t/extending-priceagentitemfactory-not-working/979/7 "2019-08-07T12:11:29Z")

</div>

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