I installed the Commerce Price Savings Formatter module. Can you explain me how to display the price in a file node--scs.tpl.php? it is for a newsletter.

When I put

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

It displays the full price with the original price, percent discount and the reduced price.

I want to display each item in the "td" separate. I tried

<? php print render($content['product: commerce_price: Trade-price-savings-formatter-savings']); ?>

But it does not work.

thank you in advance


Calling render($content[...]); renders the field—but you need to change how the field is being rendered. To do this, you'll need to modify it's display widget.

Go to Admin→Store→Configuration→Product types→Product type→Manage Display. Then, on the price field, change the the formatter (the first arrow):

Field formatter listing from the Product type display management screen

This can be further configured by clicking on the gear icon (right arrow) to get access to more configuration.

If this still does not suffice, try these:

  1. Add a HOOK_commerce_price_savings_formatter_formatter to your theme to override the theme provided by the module.
  2. Create a new formatter (the price saving formatter modules can be used as an example) and then use that formatter to display your prices.
  • thank you for your quick response, but I'm not expert :) I want to create a newletters with "simplenews" and "simplenews SCS" So I create my template with the inline style. Here are my files: template.php pastebin.com/Qxaz6QHZ simplenews-newsletter-body.tpl.php pastebin.com/5uv2rH1B node - scs.tpl.php pastebin.com/SkrCsMsW see line 31 of node - scs.tpl.php – user59029 Mar 15 '16 at 15:59
  • drupal.org/project/commerce_price_savings_formatter now displays the price and promotion on a line, I am able to display separately by adding two additional td line 31. A first td with the original price, a dexième td with the calculated price and a third td with the discount percentage to be customized each cell. – user59029 Mar 15 '16 at 16:00

protected by Community Mar 15 '16 at 14:47

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?