Render PriceField

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:

ParameterDescriptionOptions
outputPriceEnables actions on the output of the price value
ParameterDescriptionDefault
idOptional string of ID to use for price"" (undefined)
cssClassOptional string of CSS class(es) to use for price"" (undefined)
localeTwo digit locale code (e.g.: "en", "us", "de")"en"
currencyThree digit currency code (e.g.: EUR, GBP, USD)price.currency
propertyProperty of price field used for outputted valueprice.price
rawPrice is outputted without any HTML tags, if truefalse (undefined)
vatLabelEnables actions on the optional VAT label
ParameterDescriptionDefault
idOptional string of ID to use for VAT label"" (undefined)
showVAT label is shown, if truefalse (undefined)
cssClassOptional string of CSS class(es) to use for VAT label"" (undefined)
textOverride of the outputted text

Default text depending on price.isVatPrice ("Including VAT" or "Excluding VAT")

rawVAT label is outputted without any HTML tags, if truefalse (undefined)
schemaenables to ouput schema infos

If set then a schema

itemprop="price" 

will be used:

<span itemprop="price" content="1865.00">1.865,00&nbsp;€</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}
    }
)
}}