ZenMagick 0.9.8


org.zenmagick.store.model.checkout.ZMShoppingCartItem
\store\model\checkout\ZMShoppingCartItem.php at line 38

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
Version:
$Id: ZMShoppingCartItem.php 2694 2009-12-03 22:32:18Z dermanomann $
Todo:
remove deprecated code and zenItem references

Fields inherited from org.zenmagick.core.ZMObject
properties_
Constructor Summary

ZMShoppingCartItem(array zenItem)

Create new shopping cart item

Method Summary
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
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Constructor Detail

\store\model\checkout\ZMShoppingCartItem.php at line 51

ZMShoppingCartItem

public ZMShoppingCartItem(array zenItem)

Create new shopping cart item

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

Method Detail

\store\model\checkout\ZMShoppingCartItem.php at line 303

getAttributes

public array getAttributes()

Get selected attributes for this cart item.

Returns:
List of product attributes.

\store\model\checkout\ZMShoppingCartItem.php at line 158

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.

\store\model\checkout\ZMShoppingCartItem.php at line 77

getImage

public void getImage()

\store\model\checkout\ZMShoppingCartItem.php at line 79

getImageInfo

public void getImageInfo()

\store\model\checkout\ZMShoppingCartItem.php at line 247

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.

\store\model\checkout\ZMShoppingCartItem.php at line 228

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

\store\model\checkout\ZMShoppingCartItem.php at line 75

getName

public void getName()

\store\model\checkout\ZMShoppingCartItem.php at line 276

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.

\store\model\checkout\ZMShoppingCartItem.php at line 207

getProduct

public ZMProduct getProduct()

Get the product this item is associated with.

Returns:
The product.

\store\model\checkout\ZMShoppingCartItem.php at line 180

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.

\store\model\checkout\ZMShoppingCartItem.php at line 81

getQty

public void getQty()

\store\model\checkout\ZMShoppingCartItem.php at line 189

getQuantity

public int getQuantity()

Get the number of items in the cart.

Returns:
The cart quantity.

\store\model\checkout\ZMShoppingCartItem.php at line 83

getTaxClassId

public void getTaxClassId()

\store\model\checkout\ZMShoppingCartItem.php at line 147

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.

\store\model\checkout\ZMShoppingCartItem.php at line 217

hasAttributes

public boolean hasAttributes()

Check if this cart item has attributes or not.

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

\store\model\checkout\ZMShoppingCartItem.php at line 265

hasOneTimeCharge

public boolean hasOneTimeCharge()

Check if this item has a one time charge attached.

Returns:
true if a one time charge is set.

\store\model\checkout\ZMShoppingCartItem.php at line 237

isStockAvailable

public boolean isStockAvailable()

Check stock availability for the current quantity.

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

\store\model\checkout\ZMShoppingCartItem.php at line 294

setAttributes

public void setAttributes(array attributes)

Set selected attributes for this cart item.

Parameters:
attributes - List of product attributes.

\store\model\checkout\ZMShoppingCartItem.php at line 167

setId

public void setId(string id)

Set the cart item id.

Parameters:
id - The product/sku id.

\store\model\checkout\ZMShoppingCartItem.php at line 256

setItemPrice

public void setItemPrice(float itemPrice)

Set the item price.

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

\store\model\checkout\ZMShoppingCartItem.php at line 285

setOneTimeCharge

public void setOneTimeCharge(float amount)

Set optional one time charges for this item.

Parameters:
amount - The amount.

\store\model\checkout\ZMShoppingCartItem.php at line 198

setQuantity

public void setQuantity(int quantity)

Set the quantity for this item.

Parameters:
quantity - The cart quantity.

ZenMagick 0.9.8