Hi,

First of all, thanks for this great module. I have been looking for an easy solution like this for ages.

I have added the translations for both attributes and options but when viewing the products in the alternative language the values still appear in the original language (English).

Have I missed something? Is there something else that has to be done?

Thanks

Comments

splash112’s picture

Hi gkom,

Strange, it should work like that.
Could you check your the weight assigned to the modules? It should be higher then uc_attribute

gkom’s picture

I haven't manually changed the weights and they are already as you suggested:
uc_attribute weight = 0
uc_i18n = 2

I checked the values saved in the database and they seem fine for both 'uc_i18n_attributes' and 'uc_i18n_options'.
I specifically checked the "oid" and "language" values and they are correct.

Also, the other functions that 'translate' the cart and the checkout are working nicely.

Any ideas?

splash112’s picture

Do you have some other modules that manipulate attributes?
Maybe make the module weight of uc_i18n a little higher?

Thanks
Mark

stewart.adam’s picture

StatusFileSize
new491 bytes

I was bumping into this too, issue is that hook_nodeapi() overwrites $node->attributes with the new data but doesn't return anything. From the hook_nodeapi() documentation:

The "load" operation should return an array containing pairs of fields => values to be merged into the node object.

So the data returned by uc_attributes take precedence over ours. Attached patch should resolve the issue.

splash112’s picture

Hi Stewart,

Strange this happens. As you found uc_i18n indeed overwrites the attributes, displaying them in the correct language. This is what the module is doing flawless on my site for the past half year or so...

My best bet still is that another module is reloading the attributes again. Which modules are you both using?

stewart.adam’s picture

You're right, I just tested this on a local installation with a stock install of Ubercart and it does work. I believe that we should be returning the translated attributes anyways (as the implementation of hook_nodeapi() does in uc_attribute.module) but I'll try to look into this to see what module is resetting the attributes. I tried enabling a few common modules (uc_addresses, uc_product_minmax, uc_option_image, uc_node_checkout, uc_ajax_cart, uc_aac, uc_recurring, uc_recurring_product) and they didn't trigger the issue so it perhaps it's a theme? The site I was experiencing this on was using an AdaptiveTheme-based theme, if I recall correctly.

splash112’s picture

A theme shouldn't do anything, if I understand the basic Drupal logic a little.
Could be easily tested though, maybe try and see what happens (just enable the garland theme for yourself on that site.

Or just check the systems table and see which Ubercart modules have a weight of 2 and higher.

Thx
Mark

stewart.adam’s picture

I checked which modules have a weight of 2 or higher on my test site and on the site I'm experiencing the issue on, here are the results:

Test site:

+------------------+--------+
| name             | weight |
+------------------+--------+
| fieldgroup       |      9 |
| constant_contact |     99 |
| devel            |     88 |
| token            |     10 |
| uc_aac           |     10 |
| uc_i18n          |      2 |
| uc_node_checkout |    100 |
+------------------+--------+

Problematic site:

+---------------------+--------+
| name                | weight |
+---------------------+--------+
| tagging             |     10 | 
| fieldgroup          |      9 | 
| i18n                |     10 | 
| i18nstrings         |     10 | 
| i18nsync            |    100 | 
| i18ntaxonomy        |      5 | 
| nodewords           |     10 | 
| nodewords_basic     |     12 | 
| token               |     10 | 
| uc_googleanalytics  |   1000 | 
| uc_taxes            |     10 | 
| views               |     10 | 
| vertical_tabs       |    300 | 
| icl_content         |    100 | 
| icl_translate       |    200 | 
| uc_aac              |     10 | 
| uc_i18n             |      2 | 
| features            |     20 | 
| book_helper         |     10 | 
| rules               |     20 | 
+---------------------+--------+

gkom, do you have any modules from the second list installed on your site too? You can generate this list by running this query:

SELECT * FROM dbprefix_system WHERE weight >= 2;

Replace dbprefix_ with your actual database prefix (or omit it if you don't have one).

splash112’s picture

So far found a problem with the default language name and description not being saved to the right place in the DB. So you can edit all you want on the translate pages, but it won't change anything.

Just for the default language though....

splash112’s picture

Might want to try and raise the weight of uc_i18n somewhat to like 12 or something and see what happens. Quick and easy test to check on uc_aac and _uc_taxes.

splash112’s picture

Their might be a solution in #1228110: Localization on the product page. Could anyone with this problem try that?

caw67’s picture

Assigned: Unassigned » caw67
Category: support » bug

Sorry, module weight doesnt work...