good morning everybody,

recently i had the problem to translate the upgrades & addons products via i18n.
It turned out, that ALL translated ubercart products are displayed in the Upgrade/Addon form at "booking_upgrades/*".
So the task was to filter the displayed products by the user language.

Here is my solution:
In hotel_addons_upgrades.module replace at line 88
$results = db_query('SELECT * FROM {hotel_booking_upgrades} ORDER BY daystay, model');
with this

if (function_exists('i18n_get_lang')) {
  $actlang = i18n_get_lang(); //get current language
  }
$results = db_query('SELECT * FROM {hotel_booking_upgrades} 
  INNER JOIN uc_products ON hotel_booking_upgrades.model = uc_products.model
  INNER JOIN node ON uc_products.nid = node.nid
  WHERE language = "' .$actlang. '"
  ORDER BY daystay, hotel_booking_upgrades.model');

This worked for me - or is there a better solution?

Regards
abc123_hh

Comments

larowlan’s picture

Hi
That's a fine solution, can you please upload a patch and I'll commit it.
If you could use $active_language instead of $actlang it would be more consistent with Drupal coding standards.

Thanks
Lee