Method | Description | |
---|---|---|
basketAddProduct ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Product\ProductInterface $product, Sonata\Component\Basket\BasketElementInterface $newBasketElement ) | return true if the basket element is still valid. | |
basketMergeProduct ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Product\ProductInterface $product, Sonata\Component\Basket\BasketElementInterface $newBasketElement ) | Merge a product with another when the product is already present into the basket. | |
buildBasketElement ( Sonata\Component\Basket\BasketElementInterface $basketElement, Sonata\Component\Product\ProductInterface $product = null, array $options = [] ) | ||
buildCreateForm ( Sonata\AdminBundle\Form\FormMapper $formMapper ) | ||
buildEditForm ( Sonata\AdminBundle\Form\FormMapper $formMapper, boolean $isVariation = false ) | ||
buildForm ( Symfony\Component\Form\FormBuilderInterface $builder, array $options, boolean $isVariation = false ) | Build form by adding provider fields. | |
calculatePrice ( Sonata\Component\Product\ProductInterface $product, Sonata\Component\Currency\CurrencyInterface $currency, boolean $vat = false, integer $quantity = 1 ) : float | Calculate the product price depending on the currency. | |
configureShowFields ( Sonata\AdminBundle\Show\ShowMapper $showMapper ) | ||
createBasketElement ( Sonata\Component\Product\ProductInterface $product = null, array $options = [] ) : Sonata\Component\Basket\BasketElementInterface | ||
createVariation ( Sonata\Component\Product\ProductInterface $product, boolean $copyDependencies = true ) : Sonata\Component\Product\ProductInterface | Creates a variation from a given Product and its dependencies. | |
defineAddBasketForm ( Sonata\Component\Product\ProductInterface $product, |
||
defineBasketElementForm ( Sonata\Component\Basket\BasketElementInterface $basketElement, |
||
getBaseControllerName ( ) : string | ||
getBasketElementManager ( ) : Sonata\Component\Basket\BasketElementManagerInterface | ||
getCheapestEnabledVariation ( Sonata\Component\Product\ProductInterface $product ) : null | Sonata\Component\Product\ProductInterface | Fetch the cheapest variation if provided/existing. | |
getEnabledVariations ( Sonata\Component\Product\ProductInterface $product ) : |
Return the list of enabled product variations. | |
getFilters ( ) : mixed | Gets the fields on which the product might be filtered in the catalog view. | |
getProductCategoryManager ( ) : Sonata\Component\Product\ProductCategoryManagerInterface | ||
getProductCollectionManager ( ) : Sonata\Component\Product\ProductCollectionManagerInterface | ||
getStockAvailable ( Sonata\Component\Product\ProductInterface $product ) : integer | return the stock available for the current product. | |
getVariatedProperties ( Sonata\Component\Product\ProductInterface $product, array $fields = [] ) : array | Gets the properties values of $product amongst variation fields or $fields if set. | |
getVariation ( Sonata\Component\Product\ProductInterface $product, array $choices = [] ) | Gets the variation matching $choices from master product $product. | |
getVariationsChoices ( Sonata\Component\Product\ProductInterface $product, array $fields = [] ) : array | Gets the possible values for $fields (or variation fields if not set). | |
hasEnabledVariations ( Sonata\Component\Product\ProductInterface $product ) : boolean | Return true if Product has enabled variation(s). | |
hasVariations ( Sonata\Component\Product\ProductInterface $product ) : boolean | Check if the product has variations. | |
isAddableToBasket ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Product\ProductInterface $product, array $options = [] ) : boolean | Return true if the product can be added to the provided basket. | |
isValidBasketElement ( Sonata\Component\Basket\BasketElementInterface $basketElement ) : boolean | ||
setBasketElementManager ( Sonata\Component\Basket\BasketElementManagerInterface $basketElementManager ) | ||
setProductCategoryManager ( Sonata\Component\Product\ProductCategoryManagerInterface $productCategoryManager ) | ||
setProductCollectionManager ( Sonata\Component\Product\ProductCollectionManagerInterface $productCollectionManager ) | ||
synchronizeVariations ( Sonata\Component\Product\ProductInterface $product, |
Synchronizes all parent Product data to its variations (or a single one if $targetVariation is specified). | |
synchronizeVariationsCategories ( Sonata\Component\Product\ProductInterface $product, |
Synchronizes parent Product categories to its variations (or a single one if $targetVariation is specified). | |
synchronizeVariationsCollections ( Sonata\Component\Product\ProductInterface $product, |
Synchronizes parent Product collections to its variations (or a single one if $targetVariation is specified). | |
synchronizeVariationsDeliveries ( Sonata\Component\Product\ProductInterface $product, |
Synchronizes parent Product deliveries to its variations (or a single one if $targetVariation is specified). | |
synchronizeVariationsPackages ( Sonata\Component\Product\ProductInterface $product, |
Synchronizes parent Product packages to its variations (or a single one if $targetVariation is specified). | |
synchronizeVariationsProduct ( Sonata\Component\Product\ProductInterface $product, |
Synchronizes parent Product data to its variations (or a single one if $targetVariation is specified). | |
updateComputationPricesFields ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Basket\BasketElementInterface $basketElement, Sonata\Component\Product\ProductInterface $product ) | Updates basket element different prices computation fields values. | |
updateStock ( Sonata\Component\Product\ProductInterface | integer $product, Sonata\Component\Product\ProductManagerInterface $productManager, integer $diff ) | Update the stock value of a given Product id. | |
validateFormBasketElement ( Sonata\CoreBundle\Validator\ErrorElement $errorElement, Sonata\Component\Basket\BasketElementInterface $basketElement, Sonata\Component\Basket\BasketInterface $basket ) | return an array of errors if any, you can also manipulate the basketElement if require please not you always work with a clone version of the basketElement. |
public basketAddProduct ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Product\ProductInterface $product, Sonata\Component\Basket\BasketElementInterface $newBasketElement ) | ||
$basket | Sonata\Component\Basket\BasketInterface | |
$product | Sonata\Component\Product\ProductInterface | |
$newBasketElement | Sonata\Component\Basket\BasketElementInterface |
public basketMergeProduct ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Product\ProductInterface $product, Sonata\Component\Basket\BasketElementInterface $newBasketElement ) | ||
$basket | Sonata\Component\Basket\BasketInterface | |
$product | Sonata\Component\Product\ProductInterface | |
$newBasketElement | Sonata\Component\Basket\BasketElementInterface |
public buildBasketElement ( Sonata\Component\Basket\BasketElementInterface $basketElement, Sonata\Component\Product\ProductInterface $product = null, array $options = [] ) | ||
$basketElement | Sonata\Component\Basket\BasketElementInterface | |
$product | Sonata\Component\Product\ProductInterface | |
$options | array |
public buildCreateForm ( Sonata\AdminBundle\Form\FormMapper $formMapper ) | ||
$formMapper | Sonata\AdminBundle\Form\FormMapper |
public buildEditForm ( Sonata\AdminBundle\Form\FormMapper $formMapper, boolean $isVariation = false ) | ||
$formMapper | Sonata\AdminBundle\Form\FormMapper | |
$isVariation | boolean |
public calculatePrice ( Sonata\Component\Product\ProductInterface $product, Sonata\Component\Currency\CurrencyInterface $currency, boolean $vat = false, integer $quantity = 1 ) : float | ||
$product | Sonata\Component\Product\ProductInterface | A product instance |
$currency | Sonata\Component\Currency\CurrencyInterface | A currency instance |
$vat | boolean | Returns price including VAT? |
$quantity | integer | Defaults to one |
return | float |
public configureShowFields ( Sonata\AdminBundle\Show\ShowMapper $showMapper ) | ||
$showMapper | Sonata\AdminBundle\Show\ShowMapper |
public createBasketElement ( Sonata\Component\Product\ProductInterface $product = null, array $options = [] ) : Sonata\Component\Basket\BasketElementInterface | ||
$product | Sonata\Component\Product\ProductInterface | |
$options | array | |
return | Sonata\Component\Basket\BasketElementInterface |
public createVariation ( Sonata\Component\Product\ProductInterface $product, boolean $copyDependencies = true ) : Sonata\Component\Product\ProductInterface | ||
$product | Sonata\Component\Product\ProductInterface | Product to duplicate |
$copyDependencies | boolean | If false, duplicates only Product (without dependencies) |
return | Sonata\Component\Product\ProductInterface |
public defineAddBasketForm ( Sonata\Component\Product\ProductInterface $product, |
||
$product | Sonata\Component\Product\ProductInterface | A Sonata product instance |
$formBuilder | Symfony form builder | |
$showQuantity | boolean | Specifies if quantity field will be displayed (default true) |
$options | array | An options array |
public defineBasketElementForm ( Sonata\Component\Basket\BasketElementInterface $basketElement, |
||
$basketElement | Sonata\Component\Basket\BasketElementInterface | |
$formBuilder | ||
$options | array |
public getBasketElementManager ( ) : Sonata\Component\Basket\BasketElementManagerInterface | ||
return | Sonata\Component\Basket\BasketElementManagerInterface |
public getCheapestEnabledVariation ( Sonata\Component\Product\ProductInterface $product ) : null | Sonata\Component\Product\ProductInterface | ||
$product | Sonata\Component\Product\ProductInterface | |
return | null | Sonata\Component\Product\ProductInterface |
public getEnabledVariations ( Sonata\Component\Product\ProductInterface $product ) : |
||
$product | Sonata\Component\Product\ProductInterface | |
return |
public getFilters ( ) : mixed | ||
return | mixed |
public getProductCategoryManager ( ) : Sonata\Component\Product\ProductCategoryManagerInterface | ||
return | Sonata\Component\Product\ProductCategoryManagerInterface |
public getProductCollectionManager ( ) : Sonata\Component\Product\ProductCollectionManagerInterface | ||
return | Sonata\Component\Product\ProductCollectionManagerInterface |
public getStockAvailable ( Sonata\Component\Product\ProductInterface $product ) : integer | ||
$product | Sonata\Component\Product\ProductInterface | |
return | integer | the stock available |
public getVariatedProperties ( Sonata\Component\Product\ProductInterface $product, array $fields = [] ) : array | ||
$product | Sonata\Component\Product\ProductInterface | |
$fields | array | |
return | array |
public getVariation ( Sonata\Component\Product\ProductInterface $product, array $choices = [] ) | ||
$product | Sonata\Component\Product\ProductInterface | |
$choices | array |
public getVariationsChoices ( Sonata\Component\Product\ProductInterface $product, array $fields = [] ) : array | ||
$product | Sonata\Component\Product\ProductInterface | |
$fields | array | |
return | array |
public hasEnabledVariations ( Sonata\Component\Product\ProductInterface $product ) : boolean | ||
$product | Sonata\Component\Product\ProductInterface | |
return | boolean |
public hasVariations ( Sonata\Component\Product\ProductInterface $product ) : boolean | ||
$product | Sonata\Component\Product\ProductInterface | |
return | boolean |
public isAddableToBasket ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Product\ProductInterface $product, array $options = [] ) : boolean | ||
$basket | Sonata\Component\Basket\BasketInterface | |
$product | Sonata\Component\Product\ProductInterface | |
$options | array | |
return | boolean |
public isValidBasketElement ( Sonata\Component\Basket\BasketElementInterface $basketElement ) : boolean | ||
$basketElement | Sonata\Component\Basket\BasketElementInterface | |
return | boolean | true if the basket element is still valid |
public setBasketElementManager ( Sonata\Component\Basket\BasketElementManagerInterface $basketElementManager ) | ||
$basketElementManager | Sonata\Component\Basket\BasketElementManagerInterface |
public setProductCategoryManager ( Sonata\Component\Product\ProductCategoryManagerInterface $productCategoryManager ) | ||
$productCategoryManager | Sonata\Component\Product\ProductCategoryManagerInterface |
public setProductCollectionManager ( Sonata\Component\Product\ProductCollectionManagerInterface $productCollectionManager ) | ||
$productCollectionManager | Sonata\Component\Product\ProductCollectionManagerInterface |
public synchronizeVariations ( Sonata\Component\Product\ProductInterface $product, |
||
$product | Sonata\Component\Product\ProductInterface | Parent Product |
$variations | Optional target variations to synchronize |
public synchronizeVariationsCategories ( Sonata\Component\Product\ProductInterface $product, |
||
$product | Sonata\Component\Product\ProductInterface | Parent Product |
$variations | Optional target variations to synchronize |
public synchronizeVariationsCollections ( Sonata\Component\Product\ProductInterface $product, |
||
$product | Sonata\Component\Product\ProductInterface | Parent Product |
$variations | Optional target variations to synchronize |
public synchronizeVariationsDeliveries ( Sonata\Component\Product\ProductInterface $product, |
||
$product | Sonata\Component\Product\ProductInterface | Parent Product |
$variations | Optional target variations to synchronize |
public synchronizeVariationsPackages ( Sonata\Component\Product\ProductInterface $product, |
||
$product | Sonata\Component\Product\ProductInterface | Parent Product |
$variations | Optional target variations to synchronize |
public synchronizeVariationsProduct ( Sonata\Component\Product\ProductInterface $product, |
||
$product | Sonata\Component\Product\ProductInterface | Parent Product |
$variations | Optional target variations to synchronize |
public updateComputationPricesFields ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Basket\BasketElementInterface $basketElement, Sonata\Component\Product\ProductInterface $product ) | ||
$basket | Sonata\Component\Basket\BasketInterface | A basket instance |
$basketElement | Sonata\Component\Basket\BasketElementInterface | A basket element instance |
$product | Sonata\Component\Product\ProductInterface | A product instance |
public updateStock ( Sonata\Component\Product\ProductInterface | integer $product, Sonata\Component\Product\ProductManagerInterface $productManager, integer $diff ) | ||
$product | Sonata\Component\Product\ProductInterface | integer | |
$productManager | Sonata\Component\Product\ProductManagerInterface | |
$diff | integer |
public validateFormBasketElement ( Sonata\CoreBundle\Validator\ErrorElement $errorElement, Sonata\Component\Basket\BasketElementInterface $basketElement, Sonata\Component\Basket\BasketInterface $basket ) | ||
$errorElement | Sonata\CoreBundle\Validator\ErrorElement | |
$basketElement | Sonata\Component\Basket\BasketElementInterface | |
$basket | Sonata\Component\Basket\BasketInterface |