What is the best way to get the current website and currency without access to CurrentPageDefinition or CurrentPage ?
Litium version: 5.6.2
What is the best way to get the current website and currency without access to CurrentPageDefinition or CurrentPage ?
Litium version: 5.6.2
In what context do you want to get that information?
Im calling a static method in my productscontroller from a partial view that should collect some products based on its category and i want to use the method “_productItemViewModelBuilder.Build”
What i did i injected ICartService into the products controller since i can get the currency and website from there, however i don’t know if that is the best approach.
Can you pass the values from your partial view?
The only thing i have access to in that partial view is an object of type ProductItemViewModel and from what I can see it doesnt hold on anything related to what Im looking for. (and yes, i know it holds a ref. to Currency but i need WebsiteId as well)
Both ProductItemViewModel
and ProductItemViewModelBuilder
are part of the accelerator that you can modify the source code for to add the website id.
@stefan.gross did the answer resolve your issue or is this still an open question?
I dont think your answer is suitable for the question i answered. I totally forgot that I could use CurrentState, and maybe that is the best approach ?
CurrentState or modify the classes in my previous answer to pass the values you need in ProductItemViewModel