Skip to content

PriceField

PriceField is the representative implementation of AbstractField for a Price.

A new PriceField can be created using the following data:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
use Silversolutions\Bundle\EshopBundle\Content\Fields\PriceField;
use Siso\Bundle\PriceBundle\Model\Price;

// Usage: 
$price = new Price(
    array(
        'price' => 99.99,
        'isVatPrice' => true,
        'vatCode' => 19.0,
        'currency' => 'EUR',
        'source' => 'ERP',
    )
);
$priceField = new PriceField(array('price' => $price));

Rendering

See Rendering for prices to see the possibilities of outputting a PriceField using the ses_render_field() function.

You can also render a priceField with a Twig function ses_render_price():

Twig function Parameters Usage
ses_render_field() $catalogElement
string $fieldIdentifier
array $params
Renders FieldInterface $fields from $catalogElement, like TextBlockField, ImageField, PriceField.
ses_render_price() $catalogElement
PriceField $priceField
array $params
Renders only PriceField $price.
Read the Docs