Developer forum

Forum » Development » Access site-level item from Statistics provider

Access site-level item from Statistics provider

Andrey Kozachuk
Reply

Hello,

How can I access website-level item from .Net code of StatisticsProviders?

I found Dynamicweb.Content.Items.ItemManager.Storage.GetById method, but it requires Item id, and I am not sure where to get it, I want to access an item that is attached to current website.


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

If you are in a statistics provider, you are in the backend - and you are not in the context of a website. So you cannot find the ID.

You can find all the website instances in Content.Area.GetAreas() - but which is the current you cannot see - as there is not current website....

Votes for this answer: 1
 
Andrey Kozachuk
Reply

Thanks Nicolai, I need this only for one site, so I can hardcode site name, but probably it is not the best approach.

My task is to storge currency exchange rate that is used in several statistics providers and provide a UI to modify it. I was going to store it in site level-items.

Should I use a custom module with control panel instead?

P. S.

Just found that there is built-in setting for this in eCommerce module :)

 

You must be logged in to post in the forum