I have created a custom node.tpl.php file for the product_display content type. I have everything worked out except I have no ideal how to isolate the "add to cart" button, actually the "add to cart" form, and render it within the template wherever I need it.
3 Answers
The product reference itself renders as the button. In your product display content type, make sure the product reference has the "Add to Cart form" format, then render it thus:
<?php print render($content['field_product']); ?>
-
I have seen this solution many many times, but mine just wont show anything, not even an error message and the format is set to "add to cart".– J-FizDec 16, 2011 at 20:51
-
2I got I!... I was trying to do all this in teaser mode so I had to modify the teaser display, thanks.– J-FizDec 16, 2011 at 21:17
For future reference, you can add the "Add to Cart" button to your D7 taxonomy or front page view by visiting Structure -> Content Types -> [Product Type] / Manage Display -> Teaser.
To add the "Add to cart" button, go to the manage display of the product reference field and set "Add to Cart form" in Format column.