Developer forum

Forum » Development » Getting the product attributes in a specifik language

Getting the product attributes in a specifik language


Reply

Hi Im trying to create some xml output with my own module.

 

And I want to know how to get the language-specific text of a Product.

 

 foreach (Product product in group.Products)
{

     XmlElement headerNode = productXML.CreateElement("Header");   

 

     //here I need to get the name in the specific language
     headerNode.InnerText = product.Name;

             
     productNode.AppendChild(headerNode);

}

 

Is this approach totally wrong?

 

- Sune


Replies

 
Reply
sune@fonqi.dk wrote:

Hi Im trying to create some xml output with my own module.

 

And I want to know how to get the language-specific text of a Product.

 

 foreach (Product product in group.Products)
{

     XmlElement headerNode = productXML.CreateElement("Header");   

 

     //here I need to get the name in the specific language
     headerNode.InnerText = product.Name;

             
     productNode.AppendChild(headerNode);

}

 

Is this approach totally wrong?

 

- Sune


 

The API always gets language localized objects in the current context language. A way to bend this is to set the context language to the preferred language and then get the objects (remember to set the context language back to what is was before returning from your method)

The context language can be set in the read/write properties eCommerce.Common.Context.Language and eCommerce.Common.Context.LanguageID

 

You must be logged in to post in the forum