PHP Класс Sonata\ProductBundle\Twig\Extension\ProductExtension

Автор: Sylvain Deloux ([email protected])
Наследование: extends Twig_Extension
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$basketElementClass string
$formFactory Symfony\Component\Form\FormFactoryInterface
$productPool Sonata\Component\Product\Pool

Открытые методы

Метод Описание
__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.

Описание методов

__construct() публичный Метод

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() публичный Метод

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
Результат Sonata\Component\Product\ProductInterface

getCheapestEnabledVariationPrice() публичный Метод

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
Результат Sonata\Component\Product\ProductInterface

getFormAddBasket() публичный Метод

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
Результат Symfony\Component\Form\FormView

getFunctions() публичный Метод

public getFunctions ( ) : array
Результат array

getName() публичный Метод

public getName ( )

getProductPrice() публичный Метод

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?
Результат float

getProductProvider() публичный Метод

Return the Provider of the given Product.
public getProductProvider ( Sonata\Component\Product\ProductInterface $product ) : Sonata\Component\Product\ProductProviderInterface
$product Sonata\Component\Product\ProductInterface
Результат Sonata\Component\Product\ProductProviderInterface

getProductStock() публичный Метод

Return the available stock of the product.
public getProductStock ( Sonata\Component\Product\ProductInterface $product ) : integer
$product Sonata\Component\Product\ProductInterface A product instance
Результат integer

hasEnabledVariations() публичный Метод

Check if the product has enabled variations.
public hasEnabledVariations ( Sonata\Component\Product\ProductInterface $product ) : boolean
$product Sonata\Component\Product\ProductInterface
Результат boolean

hasVariations() публичный Метод

Check if the product has variations.
public hasVariations ( Sonata\Component\Product\ProductInterface $product ) : boolean
$product Sonata\Component\Product\ProductInterface
Результат boolean

Описание свойств

$basketElementClass защищенное свойство

protected string $basketElementClass
Результат string

$formFactory защищенное свойство

protected FormFactoryInterface,Symfony\Component\Form $formFactory
Результат Symfony\Component\Form\FormFactoryInterface

$productPool защищенное свойство

protected Pool,Sonata\Component\Product $productPool
Результат Sonata\Component\Product\Pool