Notice: Undefined index: und in include()

Hello, recently purchased this theme, after adding product display content, it kept throwing this error:

  • Notice: Undefined index: und in include() (line 94 of PATH-TO-THEME/themes/jollyness/templates/node/node--product_display--teaser.tpl.php).
  • Warning: Invalid argument supplied for foreach() in include() (line 96 of PATH-TO-THEME/themes/jollyness/templates/node/node--product_display--teaser.tpl.php).

Happens only if Related Items block is enabled and if choose only node teaser, if choose other display type then it works fine, just without the special effect, but hoping the devloper can provide some suggestion,

Thesite has "cart" disabled as it will be serving as catalog site only, not for retailing,

Thanks,

I guess the taxonomy, Charastics, has to have any selected... otherwise it will throw error...

Hello leon85321,

Just open file node--product_display--teaser.tpl.php and add wrapper if condition:

            if (!empty($node->field_characteristics)) {
              // Fix the error Undefine index "en" in multi-language
              if (isset($node->field_characteristics[$node->language])) {
                  $characters = $node->field_characteristics[$node->language];
              } else {
                  $characters = $node->field_characteristics['und'];
              }
              foreach ($characters as $key => $value) {
                  $term = taxonomy_term_load($value['tid']);
                  $name = $term->name;
                  print '<span class="onsale">'.$name.'</span>';
              }
            }
            ?>

Thank you.