I just tried to install Kickstart with the ability to translate the interface. But now example order messages are empty!

Empty messages

I think it comes from commerce_backoffice_oder.message.inc - there the field ist language neutral, but when I install message module localized the message text field get's available for translation and needs a language!

When I want to setup the messages manually (Edit message types), also the Display name field is empty!

It can be simply fixed by adding for both fields a "en"-Value in code ...

Comments

daniel kulbe’s picture

When I provide extra languages in code the message text won't display until I save it using the UI.

Then the order edit form only shows the active language in message_text field when I saved the message type in all available languages.

It seems like Message::getText() is not language sensitive.

Order statuses should be saved language neutral for messages!

bojanz’s picture

Assigned: Unassigned » theo_
theo_’s picture

Assigned: theo_ » vasike
brephraim’s picture

In addition, I cannot save the field language. After installation of other languages than default (in my case, English), it defaults to the first language in alphabetical order (in my case, Arabic). If I change it back to English, enter message text, and save, the changes do not get committed and the next time I go back and edit, the fields are blank and the field language is back to Arabic.

However, if I change it back to English, my message text is still there. But I save again, and then check once more and it's back to Arabic and blank.

Hope that makes sense.

vasike’s picture

Status: Active » Needs review

there's a commit that should fix Message types localization: https://code.drupalcommerce.org/#/c/417/

bojanz’s picture

Shouldn't Field API fallback to the LANGUAGE_NONE value when we request "en"? Why doesn't it? Is there a bug in Message (MessageType::getText())?
And if this is needed, then we shouldn't need to add both LANGUAGE_NONE and "en", we could just do one of those, based on whether localization is on (using field_available_languages() to get the right key? or something else?)

vasike’s picture

@bojanz: i'm not sure i understand what you're saying.
What i did was just to rebuilt the message types definition in the same way that are manually built for export/import operations.
It will use LANGUAGE_NONE for non localized drupal OR each enabled languages for localized ones.
So both LANGUAGE_NONE and "en" shouldn't exist.

amitaibu’s picture

> Shouldn't Field API fallback to the LANGUAGE_NONE value when we request "en"?

AFAIK entity metadata wrapper, doesn't fallback to LANGUAGE_NONE if you explicitly ask for a language. This is actually a problem in fieldAPI -- if you enable locale, translatable fields are missing their values.

@bojanz, I think a proper solution, at least for message is to add a button on the settings page to auto-sync messages from Language none to the default message -- what do you think?

finnhappy’s picture

Thank you for pointing me to this topic, Bojanz.

Unfortunately the fix doesnt work for me. Maybe I didnt discovered anything new, but if I disable Locale module then I get the description text and order confirmation e-mail is wokirng OK. But if I enable it and use 2 languages (and doesnt matter if I use english or not) it is not sending the confirmation and also the description text is missing.

Any solution much appreciated.

vasike’s picture

@finnhappy: could you try to clear caches after "locale" changes.
what about forcing a "revert" for the Message types (admin/structure/messages)?
just save a Message type and then revert it (rebuilds the message type).

finnhappy’s picture

Hi vasike,
thank you...I looked there and I have it empty for my language, but in Commerce Order: order confirmation I have the code of the e-mail with the default langauge in the drop-down menu. It is not sending it anyway - just the blank e-mail.

lsolesen’s picture

@vasike: I tried your trick, but it did not work. I've attached a couple of screenshots showing what happens for me.

vasike’s picture

Status: Needs review » Needs work

tried with a cherry-pick of the commit. installation won't work.
change status

electricdot’s picture

Note: apply the patch in #14 does this:

The Subject is no longer blank. But, the body is still blank.

(Tested in a fresh Kickstarter2 rc1 installation with demo store and localization, but before any other language has been set up.)

willieseabrook’s picture

I am using commerce backoffice in a custom install, and the patch at #1782134: Translatable fields: Not overriding language-none values with empty default-language values fixed the disappearing message body problem for me.

vasike’s picture

First test : Entity API patch
indeed it seems that the Entity API patch helps.
BUT i still noticed some issues:
1. the "Commerce Order: order confirmation" won't work. this has a different Message type category
2. It works only on a fresh install, so if i already have installed, i can't get the texts.
3. Tried with Reset, once no values, i also can't get back.
actually, now. i can't get it work at all anymore.

Second test: Message dev version which includes the patch above
Page "Copy messages text fields : admin/config/system/message/text-copy
(Copy messages text fields from one language to others)
partially worked with this error message
An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?render=overlay&id=6&op=do StatusText: Service unavailable (with message) ResponseText: PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'message_text_subject_value' at row 1: INSERT INTO {field_data_message_text_subject} (entity_type, entity_id, revision_id, bundle, delta, language, message_text_subject_value, message_text_subject_format) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7), (:db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14, :db_insert_placeholder_15); Array ( [:db_insert_placeholder_0] => message_type [:db_insert_placeholder_1] => 9 [:db_insert_placeholder_2] => 9 [:db_insert_placeholder_3] => message_type_email [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => en [:db_insert_placeholder_6] => <div class='message-wrapper'> <div class='header'> <div class='logo'><a href="[site:url]">[site:site-logo]</a></div> <div class='thank-you'>Thanks for your order</div> </div> <div class='body'> <p class='detail'> Here are the details for your order <span class='order'><a href="[message:message-commerce-order:view-url]">#[message:message-commerce-order:order-id]</a></span>, placed on [message:message-commerce-order:created] </p> <div class='view-order-status [message:message-commerce-order:status]'><a href='[message:message-commerce-order:view-url]'>View your order</a></div> <div class='shipping-wrapper'> <div class='ship-to'> <p class='ship-to-title'>Ship to</p> <p class='details'> [message:message-commerce-order:commerce-customer-billing:commerce_customer_address] </p> </div> <div class='ship-method'> <p class='ship-method-title'></p> <p class='express-delivery'></p> <p class='deatils'></p> </div> </div> <div class='order-summary-wrapper'> <p class='items-title'>Items in your order</p> !order-summary </div> <p class='question'><b>Order questions ?</b> <a href="[site:mail]">Contact us</a></p> </div> </div> [:db_insert_placeholder_7] => full_html [:db_insert_placeholder_8] => message_type [:db_insert_placeholder_9] => 9 [:db_insert_placeholder_10] => 9 [:db_insert_placeholder_11] => message_type_email [:db_insert_placeholder_12] => 0 [:db_insert_placeholder_13] => und [:db_insert_placeholder_14] => Order [message:message-commerce-order:order-number] at [site:name] [:db_insert_placeholder_15] => ) in field_sql_storage_field_storage_write() (line 448 of /drupal_path/modules/field/modules/field_sql_storage/field_sql_storage.module).

So it seems something wrong with the "Commerce Order: order confirmation" data or "message_type_email" definition from Message notify module.

Is this "Copy messages text fields from one language to others" Message tool, the right approach in this case?

GeertWil’s picture

Is there any progress on this issue?
I noticed that RC2 still sends empty order confirmation mails to the buyer from a localized shop.

To make localization possible I enabled quite a few modules. To find out what is causing the problem I disabled them one by one. The system started to send mails with content after disabling the very last module in the row: locale.

Reenabling locale results in empty mails again. I think this is quite a major issue.

lsolesen’s picture

@GeertWil It is annoying. However, you can easily just fill in the content of the e-mails yourself. It is just the install that does not add them properly. So make a dummy commerce kickstart install and do a little copy and paste between that and you localized copy. That is what I did.

GeertWil’s picture

@Isolesen. Thanks for the advice. Didn't know it's that simple. I will have a look where I can find those mail contents. This is something I should to do by my own. :)

amitaibu’s picture

The --dev version of Message allows you to copy messages from LANGUAGE_NONE to your language, via the admin-settings page.

vasike’s picture

Project: Commerce Kickstart » Commerce Backoffice
Version: 7.x-2.x-dev » 7.x-1.x-dev

i think now this issue it belongs to "Commerce Backoffice".

vasike’s picture

Status: Needs work » Needs review
StatusFileSize
new4.59 KB

here is a patch that uses hook_default_message_type_alter() to get the LANGUAGE_NONE values for the other languages in multilingual sites.

hook_module_implements_alter() is also used to put the "commerce_backoffice_order_default_message_type_alter" at the end of the execution list (needed because of the Kickstart alter : "commerce_kickstart_order_default_message_type_alter").

For the "Commerce Order: order confirmation" message type, we need the patch from #1851652-1: Commerce Order: order confirmation, needs rework - "Message type email" category from Message notify deprecated.

vasike’s picture

Status: Needs review » Fixed

the patch was included in the new Commerce Message module as part of the Commerce backoffice issue : #1812290-18: Message integration should be moved to own module

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.