2

I am using the Drupal Commerce module and I want to print the physical dimension fields(machine name: field_width) value on product detail page.

How can I print physical dimension fields value in node--product.tpl.php file?

My file code is like so:

<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?>"
<?php print $attributes; ?> >

<?php print $user_picture; ?>

<?php print render($title_prefix); ?>
<?php if (!$page): ?>
<h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
<?php endif; ?>
<?php print render($title_suffix); ?>

<?php if ($display_submitted): ?>
<span class="submitted"><?php print $submitted ?></span>
<?php endif; ?>

<div class="content clearfix"<?php print $content_attributes; ?>>



<div class="c-i-rgt">


<div class="zomer_img">
<?php
if ($view_mode == 'teaser')
else
print render($content['field_image1']); 
print render($content['field_width']);
print render($content['product:commerce_price']);
?>
</div><div class="clear"></div></div></div>
0

Have you set the field to be displayed under display settings for the content type?

Drupal display settings

Above is how the Field UI looks, maybe your product dimension field is hidden?

There is a guide here, on how to customize the Drupal commerce product display.

If you want to print the field in node--product.tpl.php you should first drag it so it is visible in the field UI.

Then you need to add render($content['product:field_width']);

  • thanks for reply but i want this thing by writing code in node--product.tpl.php. Can you tell me how we can access these fields using codes... – jyoti Aug 2 '13 at 7:18
  • ya sure..just 1 mnt.. – jyoti Aug 2 '13 at 7:39
  • Ya i added this in my file but it is not show anything.. – jyoti Aug 2 '13 at 7:46
  • type of field_width is a physical dimension.. and it is a field of product type content in drupal commerce .. – jyoti Aug 2 '13 at 7:48
  • yes field is in UI first ..yes this field have value.. width, height, lenght & unit.. – jyoti Aug 2 '13 at 7:49

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.