You need to access the language specific objects to get the display name. Basically each product has an number of these attached, one for each enabled language, which hold display name, description, and any multilingual properties you've defined via the product definition.
You can do the following to get at it:
var product = Product.All().First(); // get some product
string displayName = product.GetDescription("en-us").DisplayName;
How to get Product DisplayName with razor?
Hi,
I've started to play around using razor-macros with ucommerce as demoed in this blogpost: http://www.publicvoid.dk/BuildingWebshopsWithUmbracoRazorAndTheUCommerceEcommerceFrameworkOhMy.aspx
But, How do I get a Prodocts DisplayName-property?
Hi Magnus,
You need to access the language specific objects to get the display name. Basically each product has an number of these attached, one for each enabled language, which hold display name, description, and any multilingual properties you've defined via the product definition.
You can do the following to get at it:
Great! Thanks // Magnus
if you want the current language, I do this:
CurrentCulture uses the language set up with "Manage Hostnames" in umbraco, most likely you want this in multi language site
DefaultCulture uses the control panel setting, so this is more correct then the browsersetting
Hi Soren,
When i tried your code,it gives an error saying that "The name 'Product' does not exist in the current context". How can i solve this ?
regards
Rainson
I didn't include the using statement.
You want to add this (for Razor):
Hope this helps.
is working on a reply...