i want to show product reference field with both add to cart and render product display format how i will do that?

Any help is appreciable.

I mean when i view a product it will show both add to cart form with all type of product variation.

Thank you all in advance.

1 Answer 1


oh very easy i do it with template just create new template node--product--type--full.tpl.php .

and use this

      // We hide the comments and links now so that we can render them later.

      $options = $node->field_product[$node->language];
      foreach($options as $index => $option){
      $cmp_btn = drupal_get_form('properties_compare_add_form_' . commerce_product_comparison_create_key('commerce_product', $option['entity']), 'commerce_product', $option['entity'], $node->nid);
      $content['field_product'][$index]['commerce_product'][0]['cmp_btn']['#attributes'] = array('class' => array('compare-form' . $option['product_id']));

      print render($content);

i remove the add to cart button in view an set the display to render product

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.