ServiceDecorator for GoogleShoppingPriceAgent

Hello.
When I am trying to decorate GoogleShoppingPriceAgent I get back that there is no registered service in the container with that name. I need to add a custom field, I have added the value to the PriceAgentItem but that doesn’t add it to the output XML from the PriceAgent Render-method. Hence I need/want to decorate the GoogleShoppingPriceAgent and add my value to the XML.

I have solved this by copying the code for GoogleShoppingPriceAgent and register my own agent before the built in one to completely override it. But I dont think it’s a nice solution.

So if anyone have decorated a PriceAgent implementation I would like to know how :slight_smile: (if possible)

Litium version: [7.6.2]

You need to create 2 files/classes in Litium.Accelerator project:

public class PriceAgentItemFactoryImpl : PriceAgentItemFactory

and

[Plugin(“GoogleShopping”)]
public class GoogleShoppingPriceAgent : IPriceAgent

and implement your own logic.
If you need some reference I got these files from Litium V6 that I can send you.

Thanks for the reply Steve.
This is the approach I went for when solving it, but I think it would be nice to just use service decorator on the already implemented GoogleShoppingPriceAgent that comes with the Accelerator.

Seems bloated to like write my own agent to just add one property. But if there is no other way I will go for it

These are not service classes so you can not decorate them.

1 Like

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