diff --git a/includes/commerce_product.inline_entity_form.inc b/includes/commerce_product.inline_entity_form.inc index e2a2d6e..6fd1255 100644 --- a/includes/commerce_product.inline_entity_form.inc +++ b/includes/commerce_product.inline_entity_form.inc @@ -378,10 +378,9 @@ class CommerceProductInlineEntityFormController extends EntityInlineEntityFormCo $wrapper = entity_metadata_wrapper('commerce_product', $entity); foreach ($attributes as $field_name => $attribute) { if ($attribute['field']['module'] == 'taxonomy') { - foreach ($entity as $field) { - if (is_array($field) && isset($field['und'][0]['tid'])) { - $attribute_values[] = $field['und'][0]['name']; - } + $field = $entity->{$field_name}; + if (is_array($field) && isset($field[LANGUAGE_NONE][0]['tid'])) { + $attribute_values[] = $field[LANGUAGE_NONE][0]['name']; } } else { @@ -390,7 +389,9 @@ class CommerceProductInlineEntityFormController extends EntityInlineEntityFormCo } } } - $entity->title .= ' (' . implode(', ', $attribute_values) . ')'; + if (!empty($attribute_values)) { + $entity->title .= ' (' . implode(', ', $attribute_values) . ')'; + } } }