ZenMagick 0.9.6


org.zenmagick.service.ZMShoppingCarts

Class ZMShoppingCarts

ZMObject
|
+--ZMShoppingCarts

public class ZMShoppingCarts
extends ZMObject

Shopping cart service.

NOTE1: This is work in progress (as are ZMShoppingCart and ZMShoppingCartItem). Eventually I also hope to work around the fact that basket attributes and items are associated by the customers_id rather than the basket id. Right now it is not possible to have more than one cart per customer (if possible, this could be used as wishlist storage by adding a type...)

NOTE2: This service does not use the session to cache any values. Two more queries compared to much more complex code do currently not seem worth the effort.

Author:
DerManoMann
Version:
$Id: ZMShoppingCarts.php 2211 2009-05-07 05:13:40Z dermanomann $

Fields inherited from org.zenmagick.ZMObject
properties_
Constructor Summary

ZMShoppingCarts()

Create new instance.

Method Summary
protected float

calculateAttributePrice(ZMShoppingCartItem item)

Calculate the attribute price for the given item.

protected float

calculateOneTimeCharge(ZMShoppingCartItem item)

Calculate optional one time charges.

protected float

calculateProductPrice(ZMShoppingCartItem item)

Calculate the product price for the given item.

void

clearCart(ZMShoppingCart cart)

Clear a cart.

static void

instance()

Get instance.

ZMShoppingCart

loadCartForAccountId(int accountId)

Load and populate a cart.

void

saveCart(ZMShoppingCart cart)

Save the cart content.

Methods inherited from org.zenmagick.ZMObject
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Constructor Detail

ZMShoppingCarts

public ZMShoppingCarts()

Create new instance. /


Method Detail

calculateAttributePrice

protected float calculateAttributePrice(ZMShoppingCartItem item)

Calculate the attribute price for the given item.

Parameters:
item - The item.
Returns:
The attribute price.

calculateOneTimeCharge

protected float calculateOneTimeCharge(ZMShoppingCartItem item)

Calculate optional one time charges.

Parameters:
item - The item.
Returns:
The amount.

calculateProductPrice

protected float calculateProductPrice(ZMShoppingCartItem item)

Calculate the product price for the given item.

Parameters:
item - The item.
Returns:
The product price (excl. attribute pricing).

clearCart

public void clearCart(ZMShoppingCart cart)

Clear a cart.

This will remove all database entries and session data.

Parameters:
cart - The cart to save.

instance

public static void instance()

Get instance. /


loadCartForAccountId

public ZMShoppingCart loadCartForAccountId(int accountId)

Load and populate a cart.

Parameters:
accountId - The owner's account id.
Returns:
The cart.

saveCart

public void saveCart(ZMShoppingCart cart)

Save the cart content.

Parameters:
cart - The cart to save.

ZenMagick 0.9.6