To render the customerPrice
(instance of PriceField
) of the ProductNode
, you might use the Twig function ses_render_field()
within the template MyTestBundle::product.html.twig.
{{ ses_render_field(catalogElement, 'customerPrice') }}
Following optional render parameters are available for a PriceField
:
Parameter | Description | Options | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
outputPrice | Enables actions on the output of the price value |
| |||||||||||||||||||||
vatLabel | Enables actions on the optional VAT label |
| |||||||||||||||||||||
schema | enables to ouput schema infos | If set then a schema itemprop="price" will be used: <span itemprop="price" content="1865.00">1.865,00 €</span> |
Following example would output the value of property "priceExclVat
" (property: "priceExclVat
") from the price field in German (locale: "de
") standard format with enforced used of the Euro sign (currency: "EUR
"). The CSS class "price_med
" is set to the price <p>
tag. Furthermore a VAT label is shown below the price (show: true
) with defined text "Excluding VAT
" and CSS classes "price_info
" and "smaller
" to the VAT <p>
tag.
{{ ses_render_field( catalogElement, 'customerPrice', { 'outputPrice': {'property': 'priceExclVat', 'cssClass': 'price_med', 'currency': 'EUR', 'locale': 'de'}, 'vatLabel': {'show': true, 'cssClass': 'price_info smaller', 'text': 'Excluding VAT'|trans} } ) }}