No replies
firewing1's picture
Joined: 07/07/2009
Juice: 126
Was this information Helpful?


I'm trying to create a fully multi-lingual store, and there's one issue that I'm stuck on: I can't seem to find a way (hook or function) to modify the cart when a user adds an item... I'm trying to do this because if a user creates a product, translates it, then a user on the site is able to add the same product twice in their cart - once for each language. If you want to reproduce this, translate a product and add it to the cart in any given language. Switch to any other language, and now add the translated version of the same product. You'll see the product listed twice, instead of the Qty going up by one. More details are in the comments section of this blog post:

Essentially, what I think is going on is that as soon as the site has translations of products, a product's $nid is no longer unique. Due to translations, each product can have any number of $nid values but a product will always keep the same $tnid, no matter the language... So I'm looking for a way to change the $nid when adding a product to that product's $tnid. From there, hook_cart_item() can load the translations for $tnid, match that with the current language and display the cart products localized in the current language.

I'm just missing that key function or hook which allows my to store $tnid in the cart instead of $nid. Any help is much appreciated!