Developer forum

Forum » Development » Save product in alternative language

Save product in alternative language


Reply
Hi,

I was experiencing some odd behavior when saving producs in multiple languages through a custom module using the API. I couldn't understand why my LANG1 were overwritten by LANG5 data until finally my trust in the stability of the API ran out, and decided to do some exploring with Reflector.

After seing what goes on in SaveAndConfirm, it's suddenly clear why they were overwritten. It doesn't matter if I explicitly instantiate products with LANG5 and set LanguageID = "LANG5", Dynamicweb eCommerce will always retreive the record with the current context language and overwrite data of that record with data from the language version you're currently working on through the API.

string str = ("SELECT * FROM EcomProducts WHERE ProductID = '" + ProductID + "'") + " AND ProductLanguageID = '" + Context.LanguageID + "' ";

Nice one... I hacked my way around it by toggling Context.LanguageID when I need to save alternative versions.

Any chances of fixing that? We had a similar problem with PropertyFields a while back http://engage.dynamicweb.dk/Forum-5.aspx?action=ShowThread&ThreadID=2155.

BR.
Lars

Replies

 
Nicolai Høeg Pedersen
Reply
Yes - you are right.

Just added an overload for save that also takes a languageid as the third parameter.

Out with next hotfix.
 
Reply
Beautiful, thanks.

BR.
Lars

 

You must be logged in to post in the forum