ZenMagick 0.9.10


zenmagick.store.shared.model.checkout\ZMShoppingCartItem
model\checkout\ZMShoppingCartItem.php at line 37

Class ZMShoppingCartItem

ZMObject
└─ZMShoppingCartItem

public class ZMShoppingCartItem
extends ZMObject

A single shopping cart item.

This class can either be populated using the c'tor argument (zen-cart cart info) or implicit as done by the shopping cart service (ZMShoppingCart)

Author:
DerManoMann
Todo:
remove deprecated code and zenItem references

Fields inherited from org.zenmagick.core\ZMObject
properties_
Method Summary
void

__construct(array zenItem)

Create new shopping cart item

array

getAttributes()

Get selected attributes for this cart item.

string

getId()

Get the cart item id (the sku).

void

getImage()

void

getImageInfo()

float

getItemPrice(boolean tax)

Get the item price.

float

getItemTotal(boolean tax)

Get the item/line total.

void

getName()

float

getOneTimeCharge(boolean tax)

Get optional one time charges for this item.

ZMProduct

getProduct()

Get the product this item is associated with.

int

getProductId()

Get the plain product id of this item.

void

getQty()

int

getQuantity()

Get the number of items in the cart.

void

getTaxClassId()

ZMTaxRate

getTaxRate(ZMAddress address)

Get the tax rate for this item.

boolean

hasAttributes()

Check if this cart item has attributes or not.

boolean

hasOneTimeCharge()

Check if this item has a one time charge attached.

boolean

isStockAvailable()

Check stock availability for the current quantity.

void

setAttributes(array attributes)

Set selected attributes for this cart item.

void

setId(string id)

Set the cart item id.

void

setItemPrice(float itemPrice)

Set the item price.

void

setOneTimeCharge(float amount)

Set optional one time charges for this item.

void

setQuantity(int quantity)

Set the quantity for this item.

Methods inherited from org.zenmagick.core\ZMObject
__construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton

Method Detail

model\checkout\ZMShoppingCartItem.php at line 50

__construct

public void __construct(array zenItem)

Create new shopping cart item

Parameters:
zenItem - The zen-cart shopping item infos.

model\checkout\ZMShoppingCartItem.php at line 302

getAttributes

public array getAttributes()

Get selected attributes for this cart item.

Returns:
List of product attributes.

model\checkout\ZMShoppingCartItem.php at line 157

getId

public string getId()

Get the cart item id (the sku).

This will differ from the product id if attributes are attached to the cart item.

Returns:
The product/sku id.

model\checkout\ZMShoppingCartItem.php at line 76

getImage

public void getImage()

model\checkout\ZMShoppingCartItem.php at line 78

getImageInfo

public void getImageInfo()

model\checkout\ZMShoppingCartItem.php at line 246

getItemPrice

public float getItemPrice(boolean tax)

Get the item price.

Parameters:
tax - Optional flag to include/exlcude tax; default is true to include tax.
Returns:
The price for a single item.

model\checkout\ZMShoppingCartItem.php at line 227

getItemTotal

public float getItemTotal(boolean tax)

Get the item/line total.

Parameters:
tax - Optional flag to include/exlcude tax; default is true to include tax.
Returns:
The price for a single item.
Todo:
include onetime charge

model\checkout\ZMShoppingCartItem.php at line 74

getName

public void getName()

model\checkout\ZMShoppingCartItem.php at line 275

getOneTimeCharge

public float getOneTimeCharge(boolean tax)

Get optional one time charges for this item.

Parameters:
tax - Optional flag to include/exlcude tax; default is true to include tax.
Returns:
The amount.

model\checkout\ZMShoppingCartItem.php at line 206

getProduct

public ZMProduct getProduct()

Get the product this item is associated with.

Returns:
The product.

model\checkout\ZMShoppingCartItem.php at line 179

getProductId

public int getProductId()

Get the plain product id of this item.

For items without attributes this is going to be the same as getId(). If attributes are present, to use the store address.l return something like a skuId while this method will always return the plain product id without any attribute hash.

Returns:
The product id.

model\checkout\ZMShoppingCartItem.php at line 80

getQty

public void getQty()

model\checkout\ZMShoppingCartItem.php at line 188

getQuantity

public int getQuantity()

Get the number of items in the cart.

Returns:
The cart quantity.

model\checkout\ZMShoppingCartItem.php at line 82

getTaxClassId

public void getTaxClassId()

model\checkout\ZMShoppingCartItem.php at line 146

getTaxRate

public ZMTaxRate getTaxRate(ZMAddress address)

Get the tax rate for this item.

Parameters:
address - Optional shipping address; default is null to use the store address.
Returns:
The tax rate or null.

model\checkout\ZMShoppingCartItem.php at line 216

hasAttributes

public boolean hasAttributes()

Check if this cart item has attributes or not.

Returns:
true if there are attributes (values) available, false if not.

model\checkout\ZMShoppingCartItem.php at line 264

hasOneTimeCharge

public boolean hasOneTimeCharge()

Check if this item has a one time charge attached.

Returns:
true if a one time charge is set.

model\checkout\ZMShoppingCartItem.php at line 236

isStockAvailable

public boolean isStockAvailable()

Check stock availability for the current quantity.

Returns:
true if sufficient stock is available, false if not.

model\checkout\ZMShoppingCartItem.php at line 293

setAttributes

public void setAttributes(array attributes)

Set selected attributes for this cart item.

Parameters:
attributes - List of product attributes.

model\checkout\ZMShoppingCartItem.php at line 166

setId

public void setId(string id)

Set the cart item id.

Parameters:
id - The product/sku id.

model\checkout\ZMShoppingCartItem.php at line 255

setItemPrice

public void setItemPrice(float itemPrice)

Set the item price.

Parameters:
itemPrice - The price for a single item (excl. tax).

model\checkout\ZMShoppingCartItem.php at line 284

setOneTimeCharge

public void setOneTimeCharge(float amount)

Set optional one time charges for this item.

Parameters:
amount - The amount.

model\checkout\ZMShoppingCartItem.php at line 197

setQuantity

public void setQuantity(int quantity)

Set the quantity for this item.

Parameters:
quantity - The cart quantity.

ZenMagick 0.9.10