I have recently installed IEF to streamline the input of products.

If I try to edit any products I create using IEF they show no product variations on the edit page. The product variations do display correctly on normal product display pages so they seem to have been created well enough for that code. But even if I try to edit the problem product node using the autocomplete widget, it does not show the related product entity either.

I have tested entering a single product node plus entity using the standard autocomplete method, and using IEF to compare. Then checked the records in the database to see if I could see any differences. The tables I compared were 'node', 'field_data_field_product', and 'commerce_product'.

The only differences I can see between the two products created by the two methods are the language settings.
This is a table of the language settings on both sets of records.

Method of entry Node field_product commerce_product
Autocomplete en en und
IEF en und null

I tried changing both language settings on the IEF created records to the same as autocomplete, cleared the cache, and the variations now appear.

I'm assuming this is a bug related to my language settings. Can anyone tell me where the language settings come from, and what might be causing the problem.

Thanks
Peter

Comments

bojanz’s picture

bojanz’s picture

Title: "No product variations have been created" message on editing products created with Inline Entity Form. » Pass correct langcode to field_attach_form, newly created entities.
Status: Active » Fixed

Retitling to better illustrate the problem here.

Two problems here:
1) Some IEF controllers (for example, the node one) don't pass the correct langcode to field_attach_form (LANGUAGE_NONE is hardcoded), so existing entities might have values saved under the wrong langcode.
2) Newly created entities (from inside IEF, by clicking "Add new") don't have the langcode of the parent entity set. They should.

Introduced a dependency on Drupal 7.15 (because we need entity_language) and pushed a fix:
http://drupalcode.org/project/inline_entity_form.git/commitdiff/ab48e21?...

Status: Fixed » Closed (fixed)

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

jwjoshuawalker’s picture

Status: Closed (fixed) » Needs work

Using latest 1.x-dev.

This only works after the parent node is saved with a language selection.

The first time around, if you choose a language for the parent node (children nodes in inline entity form don't have language option), it will save with all children nodes set to LANGUAGE NEUTRAL.

Go back and edit that same node, the entityreference (IEF) fields will show empty, although on the content admin form you can see IEF nodes were created, and when viewing the node you will see the IEF nodes.

Any fields (IEF nodes) you add after the parent has been created with a language chosen, will have properly have the language set.

bojanz’s picture

Status: Needs work » Closed (fixed)

Further work is being done in #2028711: Field language is not correctly set on new nodes. Please test the patch there.