PHP Class Sonata\ProductBundle\Twig\Extension\ProductExtension

Author: Sylvain Deloux ([email protected])
Inheritance: extends Twig_Extension
Afficher le fichier Open project: sonata-project/ecommerce

Protected Properties

Свойство Type Description
$basketElementClass string
$formFactory Symfony\Component\Form\FormFactoryInterface
$productPool Sonata\Component\Product\Pool

Méthodes publiques

Méthode Description
__construct ( Pool $productPool, Symfony\Component\Form\FormFactoryInterface $formFactory, string $basketElementClass ) Constructor.
getCheapestEnabledVariation ( Sonata\Component\Product\ProductInterface $product ) : Sonata\Component\Product\ProductInterface Return the cheapest variation of the product (or itself if none).
getCheapestEnabledVariationPrice ( Sonata\Component\Product\ProductInterface $product ) : Sonata\Component\Product\ProductInterface Return the cheapest variation price of the product (or itself if none).
getFormAddBasket ( Sonata\Component\Product\ProductInterface $product ) : Symfony\Component\Form\FormView Returns a "add to basket" form for a specified product.
getFunctions ( ) : array
getName ( )
getProductPrice ( Sonata\Component\Product\ProductInterface $product, Sonata\Component\Currency\CurrencyInterface $currency, boolean $vat = false ) : float Return the calculated price of the product.
getProductProvider ( Sonata\Component\Product\ProductInterface $product ) : Sonata\Component\Product\ProductProviderInterface Return the Provider of the given Product.
getProductStock ( Sonata\Component\Product\ProductInterface $product ) : integer Return the available stock of the product.
hasEnabledVariations ( Sonata\Component\Product\ProductInterface $product ) : boolean Check if the product has enabled variations.
hasVariations ( Sonata\Component\Product\ProductInterface $product ) : boolean Check if the product has variations.

Method Details

__construct() public méthode

Constructor.
public __construct ( Pool $productPool, Symfony\Component\Form\FormFactoryInterface $formFactory, string $basketElementClass )
$productPool Sonata\Component\Product\Pool Sonata product pool
$formFactory Symfony\Component\Form\FormFactoryInterface Symfony form factory
$basketElementClass string Sonata basket element class name

getCheapestEnabledVariation() public méthode

Return the cheapest variation of the product (or itself if none).
public getCheapestEnabledVariation ( Sonata\Component\Product\ProductInterface $product ) : Sonata\Component\Product\ProductInterface
$product Sonata\Component\Product\ProductInterface
Résultat Sonata\Component\Product\ProductInterface

getCheapestEnabledVariationPrice() public méthode

Return the cheapest variation price of the product (or itself if none).
public getCheapestEnabledVariationPrice ( Sonata\Component\Product\ProductInterface $product ) : Sonata\Component\Product\ProductInterface
$product Sonata\Component\Product\ProductInterface
Résultat Sonata\Component\Product\ProductInterface

getFormAddBasket() public méthode

Returns a "add to basket" form for a specified product.
public getFormAddBasket ( Sonata\Component\Product\ProductInterface $product ) : Symfony\Component\Form\FormView
$product Sonata\Component\Product\ProductInterface A product instance
Résultat Symfony\Component\Form\FormView

getFunctions() public méthode

public getFunctions ( ) : array
Résultat array

getName() public méthode

public getName ( )

getProductPrice() public méthode

Return the calculated price of the product.
public getProductPrice ( Sonata\Component\Product\ProductInterface $product, Sonata\Component\Currency\CurrencyInterface $currency, boolean $vat = false ) : float
$product Sonata\Component\Product\ProductInterface A product instance
$currency Sonata\Component\Currency\CurrencyInterface A currency instance
$vat boolean Returns price including VAT?
Résultat float

getProductProvider() public méthode

Return the Provider of the given Product.
public getProductProvider ( Sonata\Component\Product\ProductInterface $product ) : Sonata\Component\Product\ProductProviderInterface
$product Sonata\Component\Product\ProductInterface
Résultat Sonata\Component\Product\ProductProviderInterface

getProductStock() public méthode

Return the available stock of the product.
public getProductStock ( Sonata\Component\Product\ProductInterface $product ) : integer
$product Sonata\Component\Product\ProductInterface A product instance
Résultat integer

hasEnabledVariations() public méthode

Check if the product has enabled variations.
public hasEnabledVariations ( Sonata\Component\Product\ProductInterface $product ) : boolean
$product Sonata\Component\Product\ProductInterface
Résultat boolean

hasVariations() public méthode

Check if the product has variations.
public hasVariations ( Sonata\Component\Product\ProductInterface $product ) : boolean
$product Sonata\Component\Product\ProductInterface
Résultat boolean

Property Details

$basketElementClass protected_oe property

protected string $basketElementClass
Résultat string

$formFactory protected_oe property

protected FormFactoryInterface,Symfony\Component\Form $formFactory
Résultat Symfony\Component\Form\FormFactoryInterface

$productPool protected_oe property

protected Pool,Sonata\Component\Product $productPool
Résultat Sonata\Component\Product\Pool