Discussions

How can I hide a product variation field in the page template?

I have successfully hidden one of the content type fields using the code below:

<?php
        hide
($content['field_desc']);
     
?>

I have then managed to display the above where I want it using the code below:

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

However, I'm now trying to do the same with a field that I created on the product variation manage fields area. I am trying to hide field_specification and display it where I need to, however the field isn't hiding or printing where I want it with similar code to above. I've cleared the caches, I've ensured I'm inside the correct .tpl.php and I have ensured I''ve spelt it correct. My question is, is this something to do with $content as the specification field isn't inside the content type, it's inside the product variation. Why wont any of my Product Variation fields work with the above code but my content type fields will?

Thank you

Posted: Dec 2, 2013

Comments

Carl Bowles on December 6, 2013

To hide and print variation fields the code should be :

<?php
        hide
($content['product:field_spec']);
     
?>

<?php
      
print render ($content['product:field_spec']);
     
?>