Developer forum

Forum » Development » Invoking Price provider without a Product object

Invoking Price provider without a Product object

Martin Nielsen
Reply
Hi DW,

Is it possible to call the priceproviders without havin a Product object?

I have a custom list of products, fetched via LINQ, and i'd like to make sure that i show the right price when render them to the frontend.

Regards
 Martin


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Martin

I'm not sure I understand your problem fully. As I understand it, you fetch a collection of products from some source and you want to find a price for them? If so and you have a Price Provider assembly in your bin folder, then the Price Provider is invoked automatically when then products are rendered.

Like I said. I probably didn't quite get the question, so please ask again :)

- Jeppe

 
Martin Nielsen
Reply

Hi Jeppe,

I found a workaround for my problem, but i think i could use an aswer for this anyway.

Basicly i want to somehow call the PriceProvider with as few informations as possible.
I don't have a Dynamicweb Product object, i only have a raw LINQ object.

If i want the correct price for that object, how could i do that?

Regards
 Martin

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Basically the Price Provider is not a something meant to be called manually. The idea is, that the Price Provider is invoked automatically when the Product.Price property is called so the correct price is available (FindPrice and PreparePrices functions on Price Provider).

If you need to query prices manually, eg. by only having the product ID or some other uniquely defining info, then you need to create a public method on the Price Provider that you can call.

Hope this answers your question. Otherwise let me know :)


- Jeppe

 

You must be logged in to post in the forum