While trying to create new Drupal Commerce product entities with the Inline entity form module I started receiving the following AJAX error:

EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7501 of /home/xxx/websites/xxx/includes/common.inc)

Only local images are allowed.

I also ran into the same error after importing an older dump of the database. In that case I was unable to edit a view. Instead on loading the view settings I got the same error message.

The issue http://drupal.org/node/1277376 suggest that it is a contrib module bug causing this error. In my case the module causing the error seems to be Title. Uninstalling Title and clearing caches makes the error go away.

The reason for the error is quite vague for me so I might be mistaking and Title could not be the culprit at all...

EDIT:

Tried with a clean install. Enabled "Title", "Inline Entity Form". Also had to enable "drupal Commerce" to get a product reference where I could use the "inline entity form". Had exactly the same error. Uninstalling "title" made the error go away.

CommentFileSizeAuthor
bundle.png17.74 KBranx

Comments

garrettc’s picture

To confirm that I'm seeing this too. Using a combination of

  • Drupal 7.14
  • Title 7.x-1.0-alpha2+3-dev
  • Inline Entity Form 7.x-1.0-beta1
  • Commerce 7.x-1.3

when trying to create new commerce products from the display node edit screen.

Disabling Title stops the error happening.

I'm going to try and dig through the module and see what might be tripping the error.

criz’s picture

I can confirm this issue using latest title and inline_entity_form.

estepix’s picture

Same problem here, using:

Drupal 7.14
Title 7.x-1.0-alpha
Inline Entity Form 7.x-1.0-beta1
Commerce 7.x-1.3

dimitriseng’s picture

Same problem here with modules as in #1 , would be great to get it fixed as it prevents new Commerce products to be created using the Inline Entity Form module, thank you.

estepix’s picture

I just enabled krumo backtrace and got a hell of an output, can't make much sense of it right now but I leave it here in case it is of any use:

Hubo un error HTTP AJAX.
Código de Resultado HTTP: 500
A continuación se detalla la información de depuración.
Ruta: /system/ajax
StatusText: error
ResponseText: Notice: Undefined property: stdClass::$language in getLanguage() (line 33 of /var/www/example.com/sites/all/modules/contrib/commerce/modules/product/includes/commerce_product.translation_handler.inc). =>
*/

[...] edited to remove krumo css classes and to give some structure to the code

/**

* Toggle the nodes connected to an HTML element

*

* @param HtmlElement el 

* @return void

*/

krumo.toggle = function(el) {

var ul = el.parentNode.getElementsByTagName('ul');

for (var i=0; i
...
(Array, 16 elements)
15: EntityTranslationCommerceProductHandler->getLanguage()    (Array, 2 elements)
    file (String,103 characters ) sites/all/modules/contrib/commerce/modules/prod...
        sites/all/modules/contrib/commerce/modules/product/includes/commerce_product.translation_handler.inc:33
    args (Array, 0 elements)

14: title_entity_language() (Array, 2 elements)
    file (String, 60 characters ) profiles/multilingual/modules/contrib/title/tit...
        profiles/multilingual/modules/contrib/title/title.module:462
    args (Array, 2 elements)
        0 (String, 16 characters )
            commerce_product
        1 (Object) stdClass
            type (String, 7 characters )
                destino
            product_id (String, 0 characters )
            is_new (Boolean)
                TRUE
            sku (String, 19 characters )
                estambul-001-simple
            revision_id (NULL)
            title (String, 0 characters )
            uid (String, 1 characters )
                1
            status (Integer)
                1
            created (String, 0 characters )
            changed (String, 0 characters )
            commerce_price (Array, 1 element)
                und (Array, 1 element)
                    0 (Array, 3 elements)
                        amount (Integer)
                            4400
                        currency_code (String, 3 characters )
                            EUR
                        data (Array, 1 element)
                            components (Array, 0 elements)
            field_dest_travelprice (Array, 1 element)
                und (Array, 1 element)
                    0 (Array, 3 elements)
                        amount (Integer)
                            47500
                        currency_code (String, 3 characters )
                            EUR
                        data (Array, 1 element)
                            components (Array, 0 elements)
            field_dest_image (Array, 1 element)
                und (Array, 1 element)
                    0 (Array, 2 elements)
                        fid (String, 1 characters )
                            1
                        display (Integer)
                            1
            field_dest_body (Array, 1 element)
                und (Array, 1 element)
                    0 (Array, 3 elements)
                        summary (String, 0 characters )
                        value (String, 23 characters )
                            Cuerpo Estambul: simple
                        format (String, 13 characters )
                            filtered_html
            field_dest_cities (Array, 1 element)
                und (Array, 1 element)
                    0 (Array, 3 elements)
                        summary (String, 0 characters )
                        value (String, 23 characters )
                            Cuerpo Estambul: simple
                        format (String, 13 characters )
                            filtered_html
            field_dest_transport (Array, 1 element)
                und (Array, 1 element)
                    0 (Array, 3 elements)
                        summary (String, 0 characters )
                        value (String, 23 characters )
                            Cuerpo Estambul: simple
                        format (String, 13 characters )
                            filtered_html
            field_dest_curiosities (Array, 1 element)
                und (Array, 1 element)
                    0 (Array, 3 elements)
                        summary (String, 0 characters )
                        value (String, 23 characters )
                            Cuerpo Estambul: simple
                        format (String, 13 characters )
                            filtered_html
            title_field (Array, 1 element)
                und (Array, 1 element)
                    0 (Array, 1 element)
                        value (String, 16 characters )
                            Estambul: simple
13: title_field_attach_submit() (Array, 2 elements)
    file (String, 60 characters ) profiles/multilingual/modules/contrib/title/tit...
        profiles/multilingual/modules/contrib/title/title.module:508
    args (Array, 4 elements)
        0 (String, 16 characters )
            commerce_product
        1 (Object) stdClass
            ∞ (Recursion)
        2 (Array, 40 elements)
            #type (String, 8 characters )
                fieldset
            #title (String, 25 characters )
                Add new product variation
            #parents (Array, 3 elements)
                0 (String, 26 characters )
                    field_destdisp_destination
                1 (String, 3 characters )
                    und
                2 (String, 8 characters )
                    add_form
            #entity (Object) stdClass
                ∞ (Recursion)
            #entity_type (String, 16 characters )
                commerce_product
            #settings (Array, 0 elements)
            actions (Array, 16 elements)
                #type (String, 9 characters )
                    container
                #weight (Integer)
                    100
                ief_add_save (Array, 25 elements)
                    #type (String, 6 characters )
                        submit
                    #value (String, 14 characters )
                        Save variation
                    #name (String, 16 characters )
                        ief-0-add-submit
                    #limit_validation_errors (Array, 1 element)
                        0 (Array, 3 elements)
                            0 (String, 26 characters )
                                field_destdisp_destination
                            1 (String, 3 characters )
                                und
                            2 (String, 8 characters )
                                add_form
                    #submit (Array, 0 elements)
                    #ajax (Array, 5 elements)
                        callback (String, 33 characters )
                            inline_entity_form_widget_refresh
                                |
                                (Callback) inline_entity_form_widget_refresh();
                                wrapper (String, 49 characters )
                                    inline-entity-form-field-destdisp-destination-und
                                event (String, 9 characters )
                                mousedown
                                keypress (Boolean)
                                    TRUE
                                prevent (String, 5 characters )
                                    click
                                #input (Boolean)
                                    TRUE
                                #button_type (String, 6 characters )
                                    submit
                                #executes_submit_callback (Boolean)
                                    TRUE
                                #process (Array, 1 element)
                                    0 (String, 17 characters )
                                        ajax_process_form
                                        | (Callback) ajax_process_form();
                                        #theme_wrappers (Array, 1 element)
                                        0 (String, 6 characters )
                                            button
                                        #defaults_loaded (Boolean)
                                            TRUE
                                        #tree (Boolean)
                                            TRUE
                                        #parents (Array, 5 elements)
                                            0 (String, 26 characters )
                                                field_destdisp_destination
                                            1 (String, 3 characters )
                                                und
                                            2 (String, 8 characters )
                                                add_form
                                            3 (String,  7 characters )
                                                actions
                                            4 (String, 12 characters )
                                                ief_add_save
                                        #array_parents (Array, 5 elements)
                                            0 (String, 26 characters )
                                                field_destdisp_destination
                                            1 (String, 3 characters )
                                                und
                                            2 (String, 8 characters )
                                                add_form
                                            3 (String, 7 characters )
                                                actions
                                            4 (String, 12 characters )
                                                ief_add_save
                                        #weight (Integer)
                                            0
                                        #processed (Boolean)
                                            TRUE
                                        #required (Boolean)
                                            FALSE
                                        #attributes (Array, 0 elements)
                                        #title_display (String, 6 characters )
                                            before
                                        #id (String, 68 characters ) edit-field-destdisp-destination-und-add-form-ac...
                                            edit-field-destdisp-destination-und-add-form-actions-ief-add-save--2
                                        #ajax_processed (Boolean)
                                            TRUE
                                        #attached (Array, 2 elements)
                                            library (Array, 2 elements)
                                                0 (Array, 2 elements)
                                                    0 (String, 6 characters )
                                                        system
                                                        |
                                                        (Callback) system();
                                                    1 (String, 11 characters )
                                                        jquery.form
                                                        1 (Array, 2 elements)
                                                            0 (String, 6 characters )
                                                                system
                                                                |
                                                                (Callback) system();
                                                                1 (String, 11 characters )
                                                                    drupal.ajax
                                                                    js (Array, 1 element)
                                                                        0 (Array, 2 elements)
                                                                            type (String, 7 characters )
                                                                                setting
                                                                            data (Array, 1 element)
                                                                                ajax (Array, 1 element)
                                                                                    edit-field-destdisp-destination-und-add-form-actions-ief-add-save--2 (Array, 7 elements)
                                                                                        callback (String, 33 characters )
                                                                                            inline_entity_form_widget_refresh
                                                                                            |
                                                                                            (Callback) inline_entity_form_widget_refresh();
                                                                                                wrapper (String, 49 characters )
                                                                                                    inline-entity-form-field-destdisp-destination-und
                                                                                                event (String, 9 characters )
                                                                                                    mousedown
                                                                                                keypress (Boolean)
                                                                                                    TRUE
                                                                                                prevent (String, 5 characters )
                                                                                                    click
                                                                                                url (String, 12 characters )
                                                                                                    /system/ajax
                                                                                                submit (Array, 2 elements)
                                                                                                    _triggering_element_name (String, 16 characters )
                                                                                                        ief-0-add-submit
                                                                                                    _triggering_element_value (String, 14 characters )
                                                                                                        Save variation
                                                                                                #sorted (Boolean)
                                                                                                    TRUE
                                                                                                #validated (Boolean)
                                                                                                    TRUE
                                                                                                #theme_wrappers (Array, 1 element)
                                                                                                    0 (String, 9 characters )
                                                                                                        container
                                                                                                #process (Array, 1 element)
                                                                                                    0 (String, 22 characters )
                                                                                                        form_process_container
                                                                                                        |
                                                                                                        (Callback) form_process_container();
                                                                                                            #defaults_loaded (Boolean)
                                                                                                                TRUE
                                                                                                            #tree (Boolean)
                                                                                                                TRUE
                                                                                                            #parents (Array, 4 elements)
                                                                                                                0 (String, 26 characters )
                                                                                                                    field_destdisp_destination
                                                                                                                1
estepix’s picture

The error shown in my previous comment:

ResponseText: Notice: Undefined property: stdClass::$language in getLanguage() (line 33 of /var/www/example.com/sites/all/modules/contrib/commerce/modules/product/includes/commerce_product.translation_handler.inc). =>

Seems to come from:
title.module line 462
using: Title 7.x-1.0-alpha

/**
 * Provide the original entity language.
 *
 * If a language property is defined for the current entity we synchronize the
 * field value using the entity language, otherwise we fall back to
 * LANGUAGE_NONE.
 *
 * @param $entity_type
 * @param $entity
 *
 * @return
 *   A language code
 */
function title_entity_language($entity_type, $entity) {
  if (module_exists('entity_translation')) {
    $handler = entity_translation_get_handler($entity_type, $entity);
    $langcode = $handler->getLanguage();
  }
  else {
    // If a language property is defined for the current entity we synchronize
    // the field value using the entity language, otherwise we fall back to
    // LANGUAGE_NONE.
    try {
      $langcode = entity_metadata_wrapper($entity_type, $entity)->language->value();
    }
    catch (EntityMetadataWrapperException $e) {}
  }
  return !empty($langcode) ? $langcode : LANGUAGE_NONE;
}

line 462:

$langcode = $handler->getLanguage();

Doesn't retrieve the language code and throws the error shown above. However this error doesn't seem to be fatal, so the code keeps running.

Line 473:
return !empty($langcode) ? $langcode : LANGUAGE_NONE;
Returns either a retrieved language code or none, represented in Drupal as "und" (undefined).

Just to give it a try, since line 462 will always return "und" as the product variation hasn't been created yet, I have changed this line to:

$langcode = 'und';

Which throws a new error:

Hubo un error HTTP AJAX.
Código de Resultado HTTP: 500
A continuación se detalla la información de depuración.
Ruta: /system/ajax
StatusText: error
ResponseText: Notice: Undefined index: title in inline_entity_form_commerce_product_form_submit() (line 280 of /var/www/example.com/sites/all/modules/contrib/inline_entity_form/includes/commerce_product.type.inc). =>
*/

This error comes from Inline Entity Form and it seems that this module does not take into account the modifications the Title module implements in the title field to work its magic.

If we check line 280 in sites/all/modules/contrib/inline_entity_form/includes/commerce_product.type.inc

  if (isset($form['#settings']['autogenerate_title']) && $form['#settings']['autogenerate_title'] == FALSE) {
    $product->title = $product_values['title'];
  }
  else {
    // Generate the product title. Take the parent entity title as the base.
    $product->title = $form_state['values']['title'];
    $attributes = _inline_entity_form_commerce_product_attributes($product->type);
    if (!empty($attributes)) {
      $wrapper = entity_metadata_wrapper('commerce_product', $product);
      foreach ($attributes as $field_name => $attribute) {
        $attribute_values[] = $wrapper->{$field_name}->label();
      }
      $product->title .= ' (' . implode(', ', $attribute_values) . ')';
    }
  }

It checks whether the title exists or it must be autogenerated with the form values, however it assumes a default title ($form_state['values']['title'];) is in use but does not take into consideration an altered title which behaves more like a field: $form_state['values']['title_field']['und'][0]['value'];

Now if we change line 280 with:

    if (isset($form_state['values']['title_field']['und'][0]['value'])) {
        $product->title = $form_state['values']['title_field']['und'][0]['value'];
    }
    else {
        $product->title = $form_state['values']['title'];
    }

And try to save the product variation again, we get yet another error:

Hubo un error HTTP AJAX.
Código de Resultado HTTP: 500
A continuación se detalla la información de depuración.
Ruta: /system/ajax
StatusText: error
ResponseText: Notice: Undefined index: path in path_form_element_validate() (line 155 of /var/www/example.com/modules/path/path.module). =>

And this is as far as I can go for I had to change code from the Drupal core.
I have been checking what the undefined index: path should look like and it seems to be an array along the lines of:

path
	'alias'(string) -> empty or with a value
	'language' (string) -> und
	'pathautho' (integer) -> 1
estepix’s picture

According to this post:
http://drupal.org/node/1277376#comment-5010896

These errors are normal behaviour since Drupal Core 7.8 when the error validation became more strict. However there must be a way to fix Title and Inline Entity Form to work together and pass this new validation standard.

dreizwo’s picture

I got the same error but I think this is not a title bug.
The CommerceProductEntityController should create a default property for language
@see commerce_product.controller.inc

public function create(array $values = array()) {
    $values += array(
      'product_id' => '',
      'is_new' => TRUE,
      'sku' => '',
      'revision_id' => NULL,
      'title' => '',
      'uid' => '',
      'status' => 1,
      'language' => LANGUAGE_NONE, // or use global $language->language
      'created' => '',
      'changed' => '',
    );
    return parent::create($values);
  }

additional the property should be defined in commerce_product.info.inc

...
$properties['language'] = array(
        'label' => t("Language"),
        'description' => t("The language the node is written in."),
        'setter callback' => 'entity_metadata_verbatim_set',
        'options list' => 'entity_metadata_language_list',
        'schema field' => 'language',
        'setter permission' => 'administer ams_property entities',
    );
....

@see http://drupal.org/node/1021466 for further information

This should provide default setter and getter methods through entity_metadata_wrapper for the language column.

ymakux’s picture

faced the same trouble

My error is a bit different:

Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7562 .....

ymakux’s picture

A weird problem. Title+Inline Entity Form used in Commerce Kickstart 2 and seems work fine. I took Title 7.x-1.0-alpha4+6-dev from the Commerce Kickstart - nothing has changed. Also I tried to disable the Inline Entity Form - error remains

chromix’s picture

I'm seeing the same error as ymakux, but only when Title is enabled. Stranger still, this happens only on the edit form for Basic Page, which coincidentally doesn't have Title enabled, but DOES include Taxonomy reference fields.

plach’s picture

Status: Active » Postponed (maintainer needs more info)

I think this might be related to #1851118: Incorrect ET Handler set in node/add form when inserting new taxonomy term. Please let me know whether the patch over there fixes this issue.

jpsolero’s picture

If using module term_reference_tree also related to:

http://drupal.org/node/1595358#comment-6905240

Patch in #9 solved my problem.

ymakux’s picture

I think this might be related to #1851118: Incorrect ET Handler set in node/add form when inserting new taxonomy term

@plach: latest dev (2013-Jan-04 ) of Entity Translation which contains that patch didn't solve my problem

ymakux’s picture

solved!
My own module caused that error :) the "vocabulary_machine_name" property was missed in term object

plach’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Since this was originally about IEF integration and that should be solved now on the IEF side, I'll close this. AAMOF other apparently unrelated bug reports (although the error is the same) have been posted here, which is making this issue hard to follow. Please open new ones if you can track down your problem and find that Title is responsible for it.

plach’s picture

Issue summary: View changes

Tested with clean install

mattew’s picture

Version: 7.x-1.x-dev » 7.x-1.0-alpha7
Priority: Normal » Major
Issue summary: View changes
Status: Closed (works as designed) » Needs work

I encounter the same issue.
As you could have test it on a fresh install and successfully reproduce the bug, maybe it's time to re-open this issue and try to fix it...?

Title module usage is mandatory for a multi-lingual website with ET, this error is Major for users who would like to use Title with Inline Entity Form.

N.B.: I get the error even if the title is not "replaced" by the translatable field_title for a content type inserted using IEF. And most of my content types that I would like to use with IEF do not use ET at all, but I need Title module and ET for other content types.