0

Update: After removing fields one by one, I've discovered that the Product reference field caused $title to be empty.

I have several content types which are displaying both the <title> and $title well, but in my "Product Display" content type (of commerce kickstart) I find that the $title header is missing, although the <title> tag is there, i.e. the title bar of my browser is displaying the page title correctly. The contents of <title> and $title are similar. Excep that <title> has the site name added to the end of the node title.

I've viewed page source it shows that h1 isn't printed. I've never written any code to hide any h1 tags. I'm using Display suite on that page and I've disabled it on that content type and it didn't help. I am not using Context on that page. Please advise me on how I should proceed, thanks!

Update: Devel->load shows that the title is set correctly, but when I created a template for that node (page--node--42.tpl.php), and tested if it worked by hiding the header and footer, I added this line of code

<h1 class="page--title title" id="page-title"><?php print $title; ?></h1>

but all I got is am empty $title

Update 2: I've inserted a block using [current-page:title] and it works, however I'd prefer not to stick with this duct-tape solution if possible

0

Check the content types display tab. It may be set to hide the title.

  • Thanks, I have title being displayed in the content field correctly, but I can't get it to display in the header – ashash Jun 27 '14 at 7:44
  • That'll need to be modified inside the page.tpl.php template in your theme. Copy or move the $title variable wherever you want it to display. – Emir Memic Jun 27 '14 at 7:49
  • thanks, I checked to see that my other content types are displaying the title correctly in the header. Just for the sake of testing I added <?php print render($title); ?> and it worked for all the pages but the "product display" content type – ashash Jun 27 '14 at 16:04
  • 1
    The product display content type most likely has it's own .tpl.php page that overrides the default page.tpl.php template. That explains why it works on all other pages but the product display. Another possibility is that the product display is generated by a view using the views module. If we could connect via chat or google it would be easier for us to debug this thing. Look around at the above and see if you can spot anything. – Emir Memic Jun 27 '14 at 16:56
  • Thanks again :) It shouldn't be a template problem since I tried targeting the node with page--node--42.tpl.php and printing $title give me nothing (I did test to make sure the template works by not printing the header). I'm using Display Suite (not views to generate the page) for the Product Display content type but I tested it by turning it off. Of course we could chat, how do you propose we do it? there's not private messaging system that I know of. Thanks a lot for your time :) – ashash Jun 27 '14 at 18:55
0

Product Reference module pulls fields from the product entity to your product display (node), this naming has been simplified in Commerce Kicsktart and you can find the product displays as simply products and your products as product variations, more on this here: product vs product type vs product display in drupal commerce

So in your kickstart installation, the product title is coming from the product entity, if you go to admin/commerce/config/product-variation-types you'll see all your product types and then you can configure your field for each view mode to control the title display.

Hope this is what's troubling you.

  • Thanks. I'm not sure if I read you wrongly but I think you might have misunderstood my problem. I can display title_field and <title>, but my $title is null. The title fields for both product display and variation aren't empty. I've tried hiding and displaying them but it doesn't solve the problem :( – ashash Jun 30 '14 at 10:22
0

After 5 to 6 hours of searching for the answer with Emko, we found that commenting out line 67 to 76 of this module fixed the problem.

profiles\commerce_kickstart\modules\commerce_kickstart\commerce_kickstart_product_ui
\commerce_kickstart_product_ui.module


/**
* Override or insert variables into the page template.
*/
function commerce_kickstart_product_ui_preprocess_page(&$vars) {
$product_display_types = commerce_product_reference_node_types();
if (isset($vars['node']->type) && isset($product_display_types[$vars['node']->type])) {
$vars['title'] = "";
}
} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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