0

I am using commerce in my drupal site, but the node title is not there. Debugging it in the page.tpl.php returns an empty string ''. I know you can enable the title in the display settings of the content type and product variation, but this is rather a field within the node article, that has no influence of the title not being shown within the page template.

Obviously, the title is being set to '' somehow, but I cant figure out where this happens or, even more importantly, how to change this with my custom module.

Any help is greatly appreciated.

1 Answer 1

0

I found out that within the commerce_kickstart_product_ui_preprocess_page function the node title of product nodes is being set to '', for what reason ever. I wrote a custom module with weight higher than 50 and re-enabled the title:

function mymodule_preprocess_page(&$vars) {
  // make the title display available again
  $product_display_types = commerce_product_reference_node_types();
  if (isset($vars['node']->type) && isset($product_display_types[$vars['node']->type])) {
    $vars['title'] = $vars['node']->title;
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.