Search

Page tree
Skip to end of metadata
Go to start of metadata

PriceField is the representative implementation of AbstractField for a Price.

A new PriceField can be created using the following data:

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

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

It is also possible to render a priceField with a twig function ses_render_price(). The difference see in the table below:

 

Twig functionParamatersUsage
ses_render_field()

$catalogElement

string $fieldIdentifier

array $params

more general -

renders also other FieldInterface $fields from $catalogElement

like TextBlockField, ImageField, PriceField

ses_render_price()

$catalogElement

PriceField $priceField

array $params

renders only PriceField $price

 

  • No labels