Hi,

sorry for the quality of my english, do not hesitate to ask me more precision if it's not clear.

I actualy test UC_Hotel. I made a mini-multilingual web site (english, french, spanish). ( http://lunasol.oboro.koumbit.org/ ).

We can translate a lot of thing in UC_Hotel, but in content type / Hotel_Room_Type , the available date do not syncronise between the 3 translations.

So, if someone translate the text of the room, he will have problem with the available date, spanish can give zero available room, french 2 and english 5.

Just want to let you know this, because it's very important for hotel to have multilingual web site.

For translation I use i18n module, with path prefix with language fallback, Workflow/Multilingual setting configured in the Content Type.

Thanks
Hugo

------

Comments

Hobbes-2’s picture

Found this, maybe it's possible to add an i18n-uc_hotel module in your uc_hotel package.
Translating or internationalizing an Ubercart store: Common problems & solutions : http://www.firewing1.com/node/27

They have wrote custom code to syncronise Ubercard product :

Problem: Ubercart does not synchronize product data across translated nodes (product information needs to be updated for each translation)

As I mentioned in the introduction, this is due to the fact that each translation is in fact a node to itself. Since Drupal assigns each node with content type "product" the standard Ubercart attribute set, each product node must be updated individually. Fortunately, there is a quick and easy was to solve this by creating a custom module:

1. Enable the i18nsync ("Synchronize Translations") module in Administer > Site building > Modules
2. Create a custom module which will hook into i18nsync:
1. Create the folder sites/all/modules/custommod
2. Paste the following into sites/all/modules/custommod/custommod.info:
name = Custom module
description = A custom module which helps with the translation of an Ubercart store
core = 6.x
3. Paste into sites/all/modules/custommod/custommod.module:

            /**
            * Implementation of hook_i18nsync_fields_alter().
            */
            function custommod_i18nsync_fields_alter($fields, $type) {
            if(in_array($type, uc_product_types())) {
            $fields['uc_products']['#title'] = 'Products';
            // These values were found by doing a print_r($node) in node-product.tpl.php
            $fields['uc_products']['#options'] = array (
            'model' => 'SKU',
            'list_price' => 'List Price',
            'cost' => 'Cost',
            'sell_price' => 'Sell Price',
            'weight' => 'Weight',
            'weight_units' => 'Weight Units',
            'length' => 'Length',
            'width' => 'Width',
            'height' => 'Height',
            'length_units' => 'Length Units',
            'pkg_qty' => 'Quantity',
            'default_qty' => 'Default quantity to add to cart'
            );
            }
            }
            

(Thanks to this commenter for the in_array() with uc_product_types() tip)
3. Go to Administer > Site building > Modules and enable "Custom module"
4. Go to Administer > Content management > Content types and edit the "Product" content type
1. Under Workflow Settings > Synchronize translations, select all fields you would like to synchronize. However, do not select the Taxonomy terms option (see below for why)
2. Repeat this step for any other product classes/content types whose product data you want synchronized

That's all! If you edit a node in one language, you should see the updated product data in all other languages as well. The only caveat is that product attributes and product options will still need to be added and updated on each translation.

Thanks to user gupa on Ubercart support forums for posting this fix (see reference 1)

willvincent’s picture

Category: bug » feature
Status: Active » Postponed

That code will not work without significant modification with the hotel module, because there are a LOT of differences between a hotel room type node and a regular product node.. basically the integration with ubercart is just enough to manage the payment details, everything else is completely different.

I've reassigned this to its correct category of feature request, and marked it as postponed. While I understand this is important for internationalization of the module, there are other more pressing issues that must be addressed first.

Hobbes-2’s picture

Ok, thanks! Do not hesitate to contact me if you need me for testing purpose, or any kind of help
And thanks for the good work.

Hobbes-2’s picture

Hi, any news on this one ? I'am just curious.

Can I help ?

larowlan’s picture

Hi
Version 2 of the module (due August) has support for setting availability on the translation master and then this is reflected on the translations - ie the availability is set once.
We will need testers so please check back regularly
Lee

agrivas’s picture

Consider this for your custom module:

/**
  * Implementation of hook_i18nsync_fields_alter().
  */
function custommod_i18nsync_fields_alter($fields, $type) {
  if(in_array($type, uc_product_types())) {
    $fields['uc_products']['#title'] = 'Rooms';
    $fields['uc_products']['#options'] = array (
      'model' => 'model',
      'capacity' => 'capacity',
      'hbrid' => 'hbrid',
      'hbrmid' => 'hbrmid',
      'smoking' => 'smoking',
      'minimum_occupancy' => 'minimum_occupancy',
      'default_available' => 'default_available',
      'from_rate' => 'from_rate',
      'adult_occupancy_modifiers' => 'adult_occupancy_modifiers',
      'child_occupancy_modifiers' => 'child_occupancy_modifiers',
      'occupancy_modifiers' => 'occupancy_modifiers'
    );
  }
}

?>

It did the trick for me.

P.S. This tip is for synchronizing the rest of the fields in version 2 (only availability is being synchronized by default).

larowlan’s picture

Version: 6.x-1.0-beta2 » 6.x-2.x-dev
Assigned: Unassigned » larowlan
Status: Postponed » Active
Issue tags: +Release blocker

Great, thanks for this.
Although it will work best with v2 of the module (where the availability is set at the translation master and used by the translations so the whole thing is kept in sync).
Lee

jackArmistead’s picture

How can I manage to translate the node-page button? the one in the hotel-booking settings? "Text for node page booking form button:"
I'm developing a site in English/Spanish/German and I've translated most of the strings but I can't find this one when searching at "Translate Interface". Please help!

larowlan’s picture

You will need to add this as a multilingual variable, please see http://drupal.org/node/313272 for how to do this, the module doesn't add it for you by default, I'll mark this as a to-do item.

jackArmistead’s picture

Thank you larowlan...

I gave it a try but doesn't work.

I set this variable: hotel_booking_book_room_form_submit

Is it right?

Then I switched language and set the word "Reservar" (in Spanish) for the button... no success.

larowlan’s picture

Hi
The variable name is hotel_booking_book_room_button_text
So in settings.php

$conf['i18n_variables'][] = 'hotel_booking_book_room_button_text';

Then you should be good to go.
You can look in the database table i18n_variables to see if it is there once you've done and saved it.
LR

jackArmistead’s picture

Thanks so much!

Now when I try to edit and Availability Calendar my browser says:

"Firefox has detected that the server is redirecting the request for this address in a way that will never complete".

When I turn back there is a warning:

"This room is part of a translation set, availability can only be set against the translation master, you have been redirected to the translation master to edit the availability".

Well, availability editing worked perfectly, before setting Multilanguage System... I'm blocked again.

larowlan’s picture

Hi
At the start of the form builder function for editing the availability, there is some code that checks for $node->tnid, if this exists it redirects to that node so you only edit availability on the master node. There is something going astray there, can you have a look in the node table in the database to see what the tnid is for the node you are trying to edit the availability for. I think the problem is that $node->tnid and $node->nid might be the same, causing an infinite redirect.
The code will need to be modified to say something like

if ($node->tnid && $node->tnid != $node->nid) {
  //do the redirect

I've not got time today to post a patch but will fix it in dev asap.

wabsta’s picture

Version: 6.x-2.x-dev » 6.x-2.0-beta4

Another thing that needs to be fixed is in the file "hotel_booking.room_type.inc":

--- hotel_booking.room_type.inc.orig	2010-12-15 12:31:17.000000000 +0100
+++ hotel_booking.room_type.inc	2010-12-15 12:33:21.000000000 +0100
@@ -492,6 +492,13 @@
 
   $visitors = $adults + $children;
 
+  if($node->tnid) {
+	  $room_nid = $node->tnid;
+  }
+  else {
+	  $room_nid = $node->nid;
+  }
+  
   $rooms = hotel_booking_get_available_rooms(
     $check_in,
     $check_out,
@@ -499,7 +506,7 @@
     $adults,
     $children,
     $smoking,
-    array($node->nid)
+    array($room_nid)
   );
 
   if (count($rooms) == 0) {

Without this patch, the availability of the translated node is getting checked, instead of the availability of the "master node".

larowlan’s picture

good pickup, thanks

vasrush’s picture

I'm a little confused.

I'm getting the "Firefox has detected that the server is redirecting the request for this address in a way that will never complete" error, but I can't find the "$node->tnid" availability check part to change as told in #13.
Thanks in advance.

EDIT: Found it

It's in line 24 of hotel_booking.calendars.inc