class Cart extends Base

Class Cart

Properties

static string $pimcoreClass Pimcore Object Class.

Methods

static  string
getPimcoreObjectClass()

get Pimcore implementation class.

from Base
static  Base
create()

Create new instance of Pimcore Object.

from Base
static  int
classId()

returns the class ID of the current object class.

from Base
static  Listing
getList( array $config = array())

No description

from Base
static  Data[]
getMandatoryFields()

No description

from Base
static 
validate($data)

No description

from Base
static  mixed|null
__callStatic($method, $arguments)

No description

from Base
array
toArray()

Object to Array.

from Base
string
getCacheKey()

No description

AdminStyle
getElementAdminStyle()

Admin Element Style.

from Base
save()

No description

from Base
Note
createNote($type)

Create a note for this object.

from Base
AbstractObject
getVariantMaster()

Return Topmost Master if Object is Variant

from Base
bool
isAllowedForShop( Shop $shop)

No description

from Base
bool|string
getUrl($language, $params = array(), $route, bool $reset = false, Shop $shop = null)

No description

from Base
static  array
getAll()

Get all existing Carts.

static  Cart
prepare( bool $persist = false)

Prepare a Cart.

bool
hasPhysicalItems()

Check if Cart has any physical items.

int
getDiscount( boolean $withTax = true)

calculates discount for the cart.

float
getDiscountPercentage()

calculates discount percentage for cart

number
getDiscountTax()

calculates the discount tax

float
getSubtotal( bool $useTaxes = true)

calculates the subtotal for the cart.

float
getSubtotalTax()

calculates the subtotal tax for the cart.

array
getTaxes($applyDiscountToTaxValues = true)

Returns array with key=>value for tax and value.

null|Carrier
getShippingProvider()

get shipping carrier for cart (if non selected, get cheapest).

float
getShippingCostsForCarrier( Carrier $carrier, bool $useTax = true)

get Shipping costs for specific carrier.

bool
isFreeShipping()

Check if this cart is free shipping

float
getShipping($useTax = true)

calculates shipping costs for the cart.

int
getShippingTaxRate()

get shipping tax rate.

float
getShippingTax()

calculates shipping tax for the cart.

getPaymentProvider()

Get Payment Provider.

float
getPaymentFee($withTax = true)

Calculate the payment fee.

float
getPaymentFeeTaxRate()

get payment fee tax rate.

float
getPaymentFeeTax()

Calculate the payment fee tax.

float
getTotalTax()

get all taxes.

float
getTotal( boolean $withTax = true)

calculates the total of the cart.

float
getTotalWithoutDiscount( bool $withTax = true)

calculates the total without discount

int
getTotalWeight()

calculates the total weight of the cart.

bool
findItemForProduct( Product $product)

finds the CartItem for a Product.

bool|Item
updateQuantity( Product $product, int $amount, bool|false $increaseAmount = false, bool|true $autoAddPriceRule = true)

Changes the quantity of a Product in the Cart.

bool|Item
addItem( Product $product, int $amount = 1)

Adds a new item to the cart.

removeItem( Item $item)

Removes a item from the cart.

bool|Item
modifyItem( Item $item, $amount)

Modifies the quantity of a CartItem.

checkCarrierValid()

Check if carrier is still valid

bool
removePriceRule( PriceRule $priceRule)

Removes an existing PriceRule from the cart.

addPriceRule( PriceRule $priceRule, string $voucherCode)

Adds a new PriceRule to the Cart.

Item[]
getPriceRules()

No description

setPriceRules( Item[] $priceRules)

No description

Address|bool
getCustomerShippingAddress()

Returns Customers shipping address.

Address|bool
getCustomerBillingAddress()

Returns Customers billing address.

bool|Address
getCustomerAddressForTaxation()

get customers taxation address.

createOrder( Payment $paymentModule = null, $language = null)

Creates order for cart

copyAddress( Order $order, Address $address = null, string $type = 'shipping')

Copy Address to order

static 
maintenance()

maintenance job.

addOrderToCart( Order $order, bool $removeExistingItems = false)

Adds existing order to cart (re-ordering)

bool
isActiveCart()

Check if Cart is active session cart

__sleep()

No description

mixed
convertToCurrency($price)

Convert Value to Carts - Currency

string
getName()

No description

setName( string $name)

No description

getCurrency()

No description

setCurrency( Currency $currency)

No description

boolean
getFreeShipping()

No description

setFreeShipping( boolean $freeShipping)

No description

Item[]
getItems()

No description

setItems( Item[] $items)

No description

Carrier|null
getCarrier()

No description

setCarrier( Carrier $carrier)

No description

PriceRule|null
getPriceRule()

No description

setPriceRule( PriceRule $priceRule)

No description

Fieldcollection|null
getPriceRuleFieldCollection()

No description

setPriceRuleFieldCollection( Fieldcollection $priceRules)

No description

Order|null
getOrder()

No description

setOrder( Order $order)

No description

string
getPaymentModule()

No description

setPaymentModule( string $paymentModule)

No description

getShop()

No description

setShop( Shop $shop)

No description

User|null
getUser()

No description

setUser( User $user)

No description

mixed
getShippingAddress()

No description

setShippingAddress( mixed $shippingAddress)

No description

mixed
getBillingAddress()

No description

setBillingAddress( mixed $billingAddress)

No description

Details

in Base at line line 50
static string getPimcoreObjectClass()

get Pimcore implementation class.

Return Value

string

Exceptions

Exception

in Base at line line 68
static Base create()

Create new instance of Pimcore Object.

Return Value

Base

Exceptions

Exception

in Base at line line 84
static int classId()

returns the class ID of the current object class.

Return Value

int

in Base at line line 98
static Listing getList( array $config = array())

Parameters

array $config

Return Value

Listing

Exceptions

Exception

in Base at line line 131
static Data[] getMandatoryFields()

Return Value

Data[]

Exceptions

Exception

in Base at line line 156
static validate($data)

Parameters

$data

Exceptions

ValidationException

in Base at line line 173
static mixed|null __callStatic($method, $arguments)

Parameters

$method
$arguments

Return Value

mixed|null

Exceptions

Exception

in Base at line line 194
array toArray()

Object to Array.

Return Value

array

at line line 1067
string getCacheKey()

Return Value

string

in Base at line line 224
AdminStyle getElementAdminStyle()

Admin Element Style.

Return Value

AdminStyle

in Base at line line 247
Base save()

Return Value

Base

Exceptions

Exception
Exception
ValidationException

in Base at line line 267
Note createNote($type)

Create a note for this object.

Parameters

$type string

Return Value

Note $note

in Base at line line 289
AbstractObject getVariantMaster()

Return Topmost Master if Object is Variant

Return Value

AbstractObject

in Base at line line 304
bool isAllowedForShop( Shop $shop)

Parameters

Shop $shop

Return Value

bool

in Base at line line 323
bool|string getUrl($language, $params = array(), $route, bool $reset = false, Shop $shop = null)

Parameters

$language
$params
$route
bool $reset
Shop $shop

Return Value

bool|string

at line line 74
static array getAll()

Get all existing Carts.

Return Value

array Cart

at line line 90
static Cart prepare( bool $persist = false)

Prepare a Cart.

Parameters

bool $persist

Return Value

Cart

Exceptions

Exception

at line line 110
bool hasPhysicalItems()

Check if Cart has any physical items.

Return Value

bool

at line line 128
int getDiscount( boolean $withTax = true)

calculates discount for the cart.

Parameters

boolean $withTax

Return Value

int

at line line 151
float getDiscountPercentage()

calculates discount percentage for cart

Return Value

float

at line line 164
number getDiscountTax()

calculates the discount tax

Return Value

number

at line line 176
float getSubtotal( bool $useTaxes = true)

calculates the subtotal for the cart.

Parameters

bool $useTaxes use taxes

Return Value

float

at line line 196
float getSubtotalTax()

calculates the subtotal tax for the cart.

Return Value

float

at line line 211
array getTaxes($applyDiscountToTaxValues = true)

Returns array with key=>value for tax and value.

Parameters

$applyDiscountToTaxValues

Return Value

array

at line line 274
null|Carrier getShippingProvider()

get shipping carrier for cart (if non selected, get cheapest).

Return Value

null|Carrier

Exceptions

ObjectUnsupportedException

at line line 304
float getShippingCostsForCarrier( Carrier $carrier, bool $useTax = true)

get Shipping costs for specific carrier.

Parameters

Carrier $carrier
bool $useTax

Return Value

float

at line line 335
bool isFreeShipping()

Check if this cart is free shipping

Return Value

bool

at line line 361
float getShipping($useTax = true)

calculates shipping costs for the cart.

Parameters

$useTax boolean include taxes

Return Value

float

at line line 385
int getShippingTaxRate()

get shipping tax rate.

Return Value

int

at line line 401
float getShippingTax()

calculates shipping tax for the cart.

Return Value

float

at line line 417
Payment getPaymentProvider()

Get Payment Provider.

Return Value

Payment

at line line 431
float getPaymentFee($withTax = true)

Calculate the payment fee.

Parameters

$withTax boolean use taxes

Return Value

float

at line line 447
float getPaymentFeeTaxRate()

get payment fee tax rate.

Return Value

float

at line line 463
float getPaymentFeeTax()

Calculate the payment fee tax.

Return Value

float

at line line 479
float getTotalTax()

get all taxes.

Return Value

float

at line line 494
float getTotal( boolean $withTax = true)

calculates the total of the cart.

Parameters

boolean $withTax get price with tax or without

Return Value

float

at line line 508
float getTotalWithoutDiscount( bool $withTax = true)

calculates the total without discount

Parameters

bool $withTax

Return Value

float

at line line 522
int getTotalWeight()

calculates the total weight of the cart.

Return Value

int

at line line 542
bool findItemForProduct( Product $product)

finds the CartItem for a Product.

Parameters

Product $product

Return Value

bool

Exceptions

Exception

at line line 569
bool|Item updateQuantity( Product $product, int $amount, bool|false $increaseAmount = false, bool|true $autoAddPriceRule = true)

Changes the quantity of a Product in the Cart.

Parameters

Product $product
int $amount
bool|false $increaseAmount
bool|true $autoAddPriceRule

Return Value

bool|Item

Exceptions

Exception

at line line 638
bool|Item addItem( Product $product, int $amount = 1)

Adds a new item to the cart.

Parameters

Product $product
int $amount

Return Value

bool|Item

Exceptions

Exception

at line line 650
removeItem( Item $item)

Removes a item from the cart.

Parameters

Item $item

at line line 669
bool|Item modifyItem( Item $item, $amount)

Modifies the quantity of a CartItem.

Parameters

Item $item
$amount

Return Value

bool|Item

Exceptions

Exception

at line line 677
checkCarrierValid()

Check if carrier is still valid

at line line 704
bool removePriceRule( PriceRule $priceRule)

Removes an existing PriceRule from the cart.

Parameters

PriceRule $priceRule

Return Value

bool

Exceptions

Exception

at line line 732
addPriceRule( PriceRule $priceRule, string $voucherCode)

Adds a new PriceRule to the Cart.

Parameters

PriceRule $priceRule
string $voucherCode Voucher Token

Exceptions

Exception

at line line 770
Item[] getPriceRules()

Return Value

Item[]

at line line 794
setPriceRules( Item[] $priceRules)

Parameters

Item[] $priceRules

at line line 807
Address|bool getCustomerShippingAddress()

Returns Customers shipping address.

Return Value

Address|bool

at line line 821
Address|bool getCustomerBillingAddress()

Returns Customers billing address.

Return Value

Address|bool

at line line 835
bool|Address getCustomerAddressForTaxation()

get customers taxation address.

Return Value

bool|Address

at line line 860
Order createOrder( Payment $paymentModule = null, $language = null)

Creates order for cart

Parameters

Payment $paymentModule
$language

Return Value

Order

Exceptions

Exception

at line line 959
Address copyAddress( Order $order, Address $address = null, string $type = 'shipping')

Copy Address to order

Parameters

Order $order
Address $address
string $type

Return Value

Address

at line line 975
static maintenance()

maintenance job.

at line line 1033
addOrderToCart( Order $order, bool $removeExistingItems = false)

Adds existing order to cart (re-ordering)

Parameters

Order $order
bool $removeExistingItems

at line line 1053
bool isActiveCart()

Check if Cart is active session cart

Return Value

bool

at line line 1083
__sleep()

at line line 1105
mixed convertToCurrency($price)

Convert Value to Carts - Currency

Parameters

$price

Return Value

mixed

at line line 1116
string getName()

Return Value

string

Exceptions

ObjectUnsupportedException

at line line 1126
setName( string $name)

Parameters

string $name

Exceptions

ObjectUnsupportedException

at line line 1136
Currency getCurrency()

Return Value

Currency

Exceptions

ObjectUnsupportedException

at line line 1146
setCurrency( Currency $currency)

Parameters

Currency $currency

Exceptions

ObjectUnsupportedException

at line line 1156
boolean getFreeShipping()

Return Value

boolean

Exceptions

ObjectUnsupportedException

at line line 1166
setFreeShipping( boolean $freeShipping)

Parameters

boolean $freeShipping

Exceptions

ObjectUnsupportedException

at line line 1176
Item[] getItems()

Return Value

Item[]

Exceptions

ObjectUnsupportedException

at line line 1186
setItems( Item[] $items)

Parameters

Item[] $items

Exceptions

ObjectUnsupportedException

at line line 1196
Carrier|null getCarrier()

Return Value

Carrier|null

Exceptions

ObjectUnsupportedException

at line line 1206
setCarrier( Carrier $carrier)

Parameters

Carrier $carrier

Exceptions

ObjectUnsupportedException

at line line 1216
PriceRule|null getPriceRule()

Return Value

PriceRule|null

Exceptions

ObjectUnsupportedException

at line line 1226
setPriceRule( PriceRule $priceRule)

Parameters

PriceRule $priceRule

Exceptions

ObjectUnsupportedException

at line line 1236
Fieldcollection|null getPriceRuleFieldCollection()

Return Value

Fieldcollection|null

Exceptions

ObjectUnsupportedException

at line line 1246
setPriceRuleFieldCollection( Fieldcollection $priceRules)

Parameters

Fieldcollection $priceRules

Exceptions

ObjectUnsupportedException

at line line 1256
Order|null getOrder()

Return Value

Order|null

Exceptions

ObjectUnsupportedException

at line line 1266
setOrder( Order $order)

Parameters

Order $order

Exceptions

ObjectUnsupportedException

at line line 1276
string getPaymentModule()

Return Value

string

Exceptions

ObjectUnsupportedException

at line line 1286
setPaymentModule( string $paymentModule)

Parameters

string $paymentModule

Exceptions

ObjectUnsupportedException

at line line 1296
Shop getShop()

Return Value

Shop

Exceptions

ObjectUnsupportedException

at line line 1306
setShop( Shop $shop)

Parameters

Shop $shop

Exceptions

ObjectUnsupportedException

at line line 1316
User|null getUser()

Return Value

User|null

Exceptions

ObjectUnsupportedException

at line line 1326
setUser( User $user)

Parameters

User $user

Exceptions

ObjectUnsupportedException

at line line 1336
mixed getShippingAddress()

Return Value

mixed

Exceptions

ObjectUnsupportedException

at line line 1346
setShippingAddress( mixed $shippingAddress)

Parameters

mixed $shippingAddress

Exceptions

ObjectUnsupportedException

at line line 1356
mixed getBillingAddress()

Return Value

mixed

Exceptions

ObjectUnsupportedException

at line line 1366
setBillingAddress( mixed $billingAddress)

Parameters

mixed $billingAddress

Exceptions

ObjectUnsupportedException