PHP Interface Sonata\Component\Basket\BasketInterface

Afficher le fichier Open project: sonata-project/ecommerce Interface Usage Examples

Méthodes publiques

Méthode Description
addBasketElement ( Sonata\Component\Basket\BasketElementInterface $basketElement ) Add a basket element into the current basket.
buildPrices ( ) Compute the price of the basket.
clean ( ) remove basket element market as deleted.
countBasketElements ( ) : integer count number of element in the basket.
getBasketElements ( ) : Sonata\Component\Basket\BasketElementInterface[] return BasketElements.
getBillingAddress ( ) : Sonata\Component\Customer\AddressInterface
getBillingAddressId ( ) : integer
getCurrency ( ) : Sonata\Component\Currency\CurrencyInterface
getCustomer ( )
getCustomerId ( ) : integer
getDeliveryAddress ( ) : Sonata\Component\Customer\AddressInterface
getDeliveryAddressId ( ) : integer
getDeliveryMethod ( ) : Sonata\Component\Delivery\ServiceDeliveryInterface
getDeliveryMethodCode ( ) : string
getDeliveryPrice ( boolean $vat = false ) : float return the Delivery price.
getDeliveryVat ( ) : float returns the Delivery VAT rate.
getElement ( Sonata\Component\Product\ProductInterface $product ) : Sonata\Component\Basket\BasketElementInterface return the BasketElement depends on the $product or the position from the element stacks.
getLocale ( ) : string
getPaymentMethod ( ) : Sonata\Component\Payment\PaymentInterface
getPaymentMethodCode ( ) : string
getPositions ( ) : array
getProductPool ( ) : Pool
getSerializationFields ( ) : array Retrieves fields and associated values use for serialization Used by serialize method.
getTotal ( boolean $vat = false, boolean $recurrentOnly = null ) : float return the total of the basket if $vat = true, return price with vat if $recurrent_only = true, return price for recurrent product only if $recurrent_only = false, return price for non recurrent product only.
getUnserializationFields ( ) : array Retrieves fields for deserialization Used by unserialize method.
getVatAmount ( ) : float Returns the VAT of the current basket.
getVatAmounts ( ) : array Returns an array with all VAT amounts of the current basket.
hasBasketElements ( ) : boolean return true if the basket has some elements .
hasProduct ( Sonata\Component\Product\ProductInterface $product ) : boolean check if the basket contains $product.
hasRecurrentPayment ( ) : boolean return true if the basket has a least one recurrent product (subscription).
isAddable ( Sonata\Component\Product\ProductInterface $product ) : boolean Check if the product can be added to the basket.
isEmpty ( ) : boolean test is the basket has elements.
isValid ( boolean $elementsOnly = false ) : boolean Check is the basket is valid : elements, Payment and Delivery information.
removeBasketElement ( Sonata\Component\Basket\BasketElementInterface $element ) : Sonata\Component\Basket\BasketElementInterface delete an element from the basket depend on the $element. Element can be a product or a basket element.
removeElement ( Sonata\Component\Basket\BasketElementInterface $element ) : Sonata\Component\Basket\BasketElementInterface delete an element from the basket depend on the $element. Element can be a product or a basket element.
removeElements ( array $elementsToRemove ) deletes several elements from the basket.
reset ( boolean $full = true ) reset basket.
setBasketElements ( array $elements ) Warning : this method should be only used by the validation framework.
setBillingAddress ( Sonata\Component\Customer\AddressInterface $address = null ) set the Payment address.
setBillingAddressId ( integer $billingAddressId )
setCurrency ( Sonata\Component\Currency\CurrencyInterface $currency )
setCustomer ( Sonata\Component\Customer\CustomerInterface $customer = null )
setCustomerId ( integer $customerId )
setDeliveryAddress ( Sonata\Component\Customer\AddressInterface $address = null ) set the Delivery address.
setDeliveryAddressId ( integer $deliveryAddressId )
setDeliveryMethod ( Sonata\Component\Delivery\ServiceDeliveryInterface $method = null ) set the Delivery method.
setLocale ( string $locale )
setPaymentMethod ( Sonata\Component\Payment\PaymentInterface $method = null ) set Payment method.
setPaymentMethodCode ( string $paymentMethodCode )
setProductPool ( Pool $pool )

Method Details

addBasketElement() public méthode

Add a basket element into the current basket.
public addBasketElement ( Sonata\Component\Basket\BasketElementInterface $basketElement )
$basketElement Sonata\Component\Basket\BasketElementInterface

buildPrices() public méthode

Compute the price of the basket.
public buildPrices ( )

clean() public méthode

remove basket element market as deleted.
public clean ( )

countBasketElements() public méthode

count number of element in the basket.
public countBasketElements ( ) : integer
Résultat integer

getBasketElements() public méthode

return BasketElements.
public getBasketElements ( ) : Sonata\Component\Basket\BasketElementInterface[]
Résultat Sonata\Component\Basket\BasketElementInterface[]

getBillingAddress() public méthode

public getBillingAddress ( ) : Sonata\Component\Customer\AddressInterface
Résultat Sonata\Component\Customer\AddressInterface

getBillingAddressId() public méthode

public getBillingAddressId ( ) : integer
Résultat integer

getCurrency() public méthode

public getCurrency ( ) : Sonata\Component\Currency\CurrencyInterface
Résultat Sonata\Component\Currency\CurrencyInterface

getCustomer() public méthode

public getCustomer ( )

getCustomerId() public méthode

public getCustomerId ( ) : integer
Résultat integer

getDeliveryAddress() public méthode

public getDeliveryAddress ( ) : Sonata\Component\Customer\AddressInterface
Résultat Sonata\Component\Customer\AddressInterface

getDeliveryAddressId() public méthode

public getDeliveryAddressId ( ) : integer
Résultat integer

getDeliveryMethod() public méthode

public getDeliveryMethod ( ) : Sonata\Component\Delivery\ServiceDeliveryInterface
Résultat Sonata\Component\Delivery\ServiceDeliveryInterface

getDeliveryMethodCode() public méthode

public getDeliveryMethodCode ( ) : string
Résultat string

getDeliveryPrice() public méthode

return the Delivery price.
public getDeliveryPrice ( boolean $vat = false ) : float
$vat boolean
Résultat float

getDeliveryVat() public méthode

returns the Delivery VAT rate.
public getDeliveryVat ( ) : float
Résultat float

getElement() public méthode

return the BasketElement depends on the $product or the position from the element stacks.
public getElement ( Sonata\Component\Product\ProductInterface $product ) : Sonata\Component\Basket\BasketElementInterface
$product Sonata\Component\Product\ProductInterface
Résultat Sonata\Component\Basket\BasketElementInterface

getLocale() public méthode

public getLocale ( ) : string
Résultat string

getPaymentMethod() public méthode

public getPaymentMethod ( ) : Sonata\Component\Payment\PaymentInterface
Résultat Sonata\Component\Payment\PaymentInterface

getPaymentMethodCode() public méthode

public getPaymentMethodCode ( ) : string
Résultat string

getPositions() public méthode

public getPositions ( ) : array
Résultat array

getProductPool() public méthode

public getProductPool ( ) : Pool
Résultat Sonata\Component\Product\Pool

getSerializationFields() public méthode

Retrieves fields and associated values use for serialization Used by serialize method.
public getSerializationFields ( ) : array
Résultat array

getTotal() public méthode

return the total of the basket if $vat = true, return price with vat if $recurrent_only = true, return price for recurrent product only if $recurrent_only = false, return price for non recurrent product only.
public getTotal ( boolean $vat = false, boolean $recurrentOnly = null ) : float
$vat boolean Returns price including VAT?
$recurrentOnly boolean Is recurrent only?
Résultat float

getUnserializationFields() public méthode

Retrieves fields for deserialization Used by unserialize method.
public getUnserializationFields ( ) : array
Résultat array

getVatAmount() public méthode

Returns the VAT of the current basket.
public getVatAmount ( ) : float
Résultat float

getVatAmounts() public méthode

Returns an array with all VAT amounts of the current basket.
public getVatAmounts ( ) : array
Résultat array

hasBasketElements() public méthode

..
public hasBasketElements ( ) : boolean
Résultat boolean

hasProduct() public méthode

check if the basket contains $product.
public hasProduct ( Sonata\Component\Product\ProductInterface $product ) : boolean
$product Sonata\Component\Product\ProductInterface
Résultat boolean

hasRecurrentPayment() public méthode

@return bool
public hasRecurrentPayment ( ) : boolean
Résultat boolean

isAddable() public méthode

Check if the product can be added to the basket.
public isAddable ( Sonata\Component\Product\ProductInterface $product ) : boolean
$product Sonata\Component\Product\ProductInterface
Résultat boolean

isEmpty() public méthode

test is the basket has elements.
public isEmpty ( ) : boolean
Résultat boolean

isValid() public méthode

if $element_only is set to true, only elements are checked
public isValid ( boolean $elementsOnly = false ) : boolean
$elementsOnly boolean
Résultat boolean

removeBasketElement() public méthode

delete an element from the basket depend on the $element. Element can be a product or a basket element.
public removeBasketElement ( Sonata\Component\Basket\BasketElementInterface $element ) : Sonata\Component\Basket\BasketElementInterface
$element Sonata\Component\Basket\BasketElementInterface
Résultat Sonata\Component\Basket\BasketElementInterface

removeElement() public méthode

delete an element from the basket depend on the $element. Element can be a product or a basket element.
Deprecation: Use RemoveBasketElement instead
public removeElement ( Sonata\Component\Basket\BasketElementInterface $element ) : Sonata\Component\Basket\BasketElementInterface
$element Sonata\Component\Basket\BasketElementInterface
Résultat Sonata\Component\Basket\BasketElementInterface

removeElements() public méthode

deletes several elements from the basket.
public removeElements ( array $elementsToRemove )
$elementsToRemove array

reset() public méthode

reset basket.
public reset ( boolean $full = true )
$full boolean

setBasketElements() public méthode

Warning : this method should be only used by the validation framework.
public setBasketElements ( array $elements )
$elements array

setBillingAddress() public méthode

set the Payment address.
public setBillingAddress ( Sonata\Component\Customer\AddressInterface $address = null )
$address Sonata\Component\Customer\AddressInterface

setBillingAddressId() public méthode

public setBillingAddressId ( integer $billingAddressId )
$billingAddressId integer

setCurrency() public méthode

public setCurrency ( Sonata\Component\Currency\CurrencyInterface $currency )
$currency Sonata\Component\Currency\CurrencyInterface

setCustomer() public méthode

public setCustomer ( Sonata\Component\Customer\CustomerInterface $customer = null )
$customer Sonata\Component\Customer\CustomerInterface

setCustomerId() public méthode

public setCustomerId ( integer $customerId )
$customerId integer

setDeliveryAddress() public méthode

set the Delivery address.
public setDeliveryAddress ( Sonata\Component\Customer\AddressInterface $address = null )
$address Sonata\Component\Customer\AddressInterface

setDeliveryAddressId() public méthode

public setDeliveryAddressId ( integer $deliveryAddressId )
$deliveryAddressId integer

setDeliveryMethod() public méthode

set the Delivery method.
public setDeliveryMethod ( Sonata\Component\Delivery\ServiceDeliveryInterface $method = null )
$method Sonata\Component\Delivery\ServiceDeliveryInterface

setLocale() public méthode

public setLocale ( string $locale )
$locale string

setPaymentMethod() public méthode

set Payment method.
public setPaymentMethod ( Sonata\Component\Payment\PaymentInterface $method = null )
$method Sonata\Component\Payment\PaymentInterface

setPaymentMethodCode() public méthode

public setPaymentMethodCode ( string $paymentMethodCode )
$paymentMethodCode string

setProductPool() public méthode

public setProductPool ( Pool $pool )
$pool Sonata\Component\Product\Pool