ZenMagick 0.9.10


zenmagick.store.shared.services.checkout\ZMShoppingCarts
services\checkout\ZMShoppingCarts.php at line 40

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

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

__construct()

Create new instance.

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 shoppingCart)

Clear a cart.

static void

instance()

Get instance.

ZMShoppingCart

loadCartForAccountId(int accountId)

Load and populate a cart.

void

saveCart(ZMShoppingCart shoppingCart)

Save the cart content.

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

Method Detail

services\checkout\ZMShoppingCarts.php at line 45

__construct

public void __construct()

Create new instance.


services\checkout\ZMShoppingCarts.php at line 260

calculateAttributePrice

protected float calculateAttributePrice(ZMShoppingCartItem item)

Calculate the attribute price for the given item.

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

services\checkout\ZMShoppingCarts.php at line 299

calculateOneTimeCharge

protected float calculateOneTimeCharge(ZMShoppingCartItem item)

Calculate optional one time charges.

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

services\checkout\ZMShoppingCarts.php at line 216

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).

services\checkout\ZMShoppingCarts.php at line 119

clearCart

public void clearCart(ZMShoppingCart shoppingCart)

Clear a cart.

This will remove all database entries and session data.

Parameters:
shoppingCart - The cart to save.

services\checkout\ZMShoppingCarts.php at line 59

instance

public static void instance()

Get instance.


services\checkout\ZMShoppingCarts.php at line 134

loadCartForAccountId

public ZMShoppingCart loadCartForAccountId(int accountId)

Load and populate a cart.

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

services\checkout\ZMShoppingCarts.php at line 69

saveCart

public void saveCart(ZMShoppingCart shoppingCart)

Save the cart content.

Parameters:
shoppingCart - The cart to save.

ZenMagick 0.9.10