0

I have a question. I am using commerce kickstart and i want to display field group under the pictures and text. Now in node--product--type.tpl.php are the attributes for rendering.

The code I am using is the following.

     <div class="container-24 grid-8 prefix-1">
    <div<?php print $content_attributes; ?>>
      <?php
        // We hide the comments and links now so that we can render them later.
        hide($content['comments']);
        hide($content['links']);
        print render($content);
      ?>
    </div>
  </div>
  <div class="container-24 grid-24 clearfix">
   <div<?php print $content_attributes; ?>>
      <?php
        // We hide the comments and links now so that we can render them later.
       print render($content['comments']);
      ?>
  </div>

How can I put field group (I have created 3 tabs) in <div class="container-24 grid-24 clearfix">?

I don't know how to find print render($content['???']); where ???? stands for the attribute.

1

You can group fields using field group module.

Field Group Module

These are the steps on how to use field group module.

  1. Download the module at https://drupal.org/project/field_group
  2. Enable the module
  3. Go to the manage display settings, where you want to add your field group
  4. At the bottom of the page you will see add new group fill up the field and label of the field group; after that you can now drag and drop the field inside the field group that you created
| improve this answer | |
  • @Chevap please do not chameleon. Are you 100% sure your edit only clarifies and does not change the question's meaning? – Mołot May 19 '14 at 7:20
  • @ Mołot The problem is i didn't know how to ask the question in the first place. But in my poste above ---EDIT---- i said My question is how can i put group field (i have created 3 tabs) in <div class="container-24 grid-24 clearfix"> . So i didn't ask using what module can i display grouped fields because i told that i have group fields (i have created 3 tabs). I belive that implies that i have group field module and have created 3 tabs with that have xzy number of fields attached to them. My question is the rendering . How can i put group field in <div class="container-24 grid-24 clearfix">. – 2thecore May 19 '14 at 15:46
  • I am sorry if i wasn't clear bu i never said i needed a module for grouping fields , etc. And please don't call me a chameleon :) ... I have writen a lot of my modules but never used them like this so i have no experiances with theming and rendering. I have tried to hide other content attributes but that does not do nothing. I used hide($content['sku']); . I can show only SKU using print render($content['SKU']);. So how can i show only group field. – 2thecore May 19 '14 at 17:13
0

Ok, In the 'node--product--type.tpl.php' file.

I got it working by the principle of hide in the first container and render where you want it. For me (using commerce kickstart 2)it looks like this:

<div class="container-24 grid-10 prefix-2 clearfix">
 <?php 
print render($content['title_field']);

print render($content['product:field_images']); ?>
  </div>


  <div class="container-24 grid-11 prefix-1">

 <div<?php print $content_attributes; ?>>
      <?php
    // We hide the comments and links now so that we can render them later.

hide ($content['group_koffie']);

hide($content['comments']);
        hide($content['links']);
        print render($content);
      ?>
    </div>
  </div>
  <div class="container-24 grid-22 prefix-1 clearfix">


    <?php
print render($content['group_koffie']);

print render($content['comments']);

    ?>

An extra thing to be aware of is that (again in my case) you have to name the field ($content['group_koffie']) when it is a display-field. (or ($content['field_regio']) if it is not a group but a single field)

When it is a product-item/ variation-field you name the field ($content['product:field_images']) Took me a long stare to find that.

| improve this answer | |

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.