The sequel to my Ubercart i18n adventures

It has been a while since I last wrote about Ubercart, but I'm still working on some multi-lingual stores for clients. I have opted for disabling the stock Catalog module and using Views instead since Views is so much more flexible and easier to theme. I have a very simple setup; some terms in a vocabulary that is localized per-term, and then a custom View that takes a term name as an argument and returns nodes belonging to that term and displays them in a nicely themed grid.

Recently, I ran into an irritating issue where the View would return results from the wrong language if two languages had the same term name. After hours of investigating (and learning all about how to implement View handlers and plugins), it seems that the stock taxonomy term argument validator for Views cannot differentiate between terms of the same name in different languages. So if multiple languages contain the term "Stewart Adam" for example, the view will just returns nodes for whichever term (and therefore language) comes first in the database query. To be fair, the i18n module adds the "language" column to the term_data table so it's not really View's fault... Nonetheless, I was surprised that the i18n module had not already corrected this issue.

I've just reported Drupal issue #832100, Taxonomy term argument validator should not validate terms defined in other languages that includes a fix to the problem by limiting query for term names to terms within the active language. It's not the greatest way to go about solving it since it essentially just copies the original validator and makes two tiny modifications in the SQL query, but it's better then modifying the View module directly.

Rating: 

Comments

Thanks for this wonderful article. Can i post your article in my blog with a link to this article original in exchange? Plz confirm . Thanks one more time.

Hi clealayjorres,

I do not mind if you would like to post about this code/tutorial on your blog, but I would appreciate it if you could reference my work (list my name & link to this page). If you'd like you may reply with the URL to your post :)

Regards,
Stewart

Hi Firewing1,
Many thanks for the great posts you wrote and put online. I used them extensivly.
Put quite a lot of it, and some more into a new module http://drupal.org/project/uc_i18n
Hope to get some comments or support from you so we can finally solve the whole Ubercart translation thing.

Many thanks
Mark

Hi Mark,

That is awesome! I took a look at some of the code today and saw that you've already started tackling many of the things I had on my todo list.

Until Drupal Commerce for 7.x comes out I will be sticking with Ubercart 2.x on Drupal 6 so I will be testing and adding functionality to the i18n code for a little while... Would you be interested having me become a co-maintainer for the module?

Regards,
Stewart

Hi Stewart,

Perfect! Just added you as a co-maintainer. Will write some problems in the issue queue fir things needing fixes for a stable release. Just got found that making nice pdf quotations for my site (Views PDF) took a bigger effort then expected and was planning on doing those later.

Not sure yet what I will do after I finish the 6.x upgrade of the site. One thing I currently like about Ubercart and dislike on commerce is the whole attribute handling. My products are customizable and so each product can have easily 20 or 30 different versions, or SKU's. Commerce so far wants me to create them one-by-one as complete products...

I will be off for the weekend, so have a nice time playing with the module!

regards
Mark