ZenMagick 0.9.6


org.zenmagick.misc.ZMCheckoutHelper

Class ZMCheckoutHelper

ZMObject
|
+--ZMCheckoutHelper

public class ZMCheckoutHelper
extends ZMObject

Checkout helper.

Author:
DerManoMann
Version:
$Id: ZMCheckoutHelper.php 2197 2009-05-04 03:44:37Z dermanomann $

Field Summary
final mixed

CART_PRODUCT_QUANTITY

final mixed

CART_PRODUCT_STATUS

final mixed

CART_PRODUCT_UNITS

Fields inherited from org.zenmagick.ZMObject
properties_
Constructor Summary

ZMCheckoutHelper(ZMShoppingCart cart)

Create new instance.

Method Summary
array

checkCartStatus()

Check whether the cart is ready for checkout or not.

boolean

checkStock(boolean messages)

Check stock.

int

freeProductsCount()

Checks for free products in the cart.

int

freeShippingCount()

Checks for free shipping.

boolean

isGVOnly()

Checks if there are only gift vouchers in the cart.

boolean

isVirtual()

Check for virtual cart.

boolean

readyForCheckout()

Check whether the cart is ready for checkout or not.

string

validateCheckout(boolean messages)

Validate the current checkout request.

int

virtualProductsCount()

Checks for virtual products in the cart.

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

Field Detail

CART_PRODUCT_QUANTITY

public final mixed CART_PRODUCT_QUANTITY = 'quantity'

CART_PRODUCT_STATUS

public final mixed CART_PRODUCT_STATUS = 'status'

CART_PRODUCT_UNITS

public final mixed CART_PRODUCT_UNITS = 'units'

Constructor Detail

ZMCheckoutHelper

public ZMCheckoutHelper(ZMShoppingCart cart)

Create new instance.

Parameters:
cart - The cart.

Method Detail

checkCartStatus

public array checkCartStatus()

Check whether the cart is ready for checkout or not.

Possible return values:

Returns:
A map of errorCode -> item pairs.

checkStock

public boolean checkStock(boolean messages)

Check stock.

Parameters:
messages - Optional flag to enable/hide messages related to stock checking; default is true.
Returns:
true if the stock check was sucessful (or disabled).

freeProductsCount

public int freeProductsCount()

Checks for free products in the cart.

Returns:
The number of free products in the cart.

freeShippingCount

public int freeShippingCount()

Checks for free shipping.

Returns:
The number of free shipping products in the cart.

isGVOnly

public boolean isGVOnly()

Checks if there are only gift vouchers in the cart.

Returns:
true if only vouchers are in the cart.

isVirtual

public boolean isVirtual()

Check for virtual cart.

NOTE: In contrast to Zen Cart, we treat the always free shipping product attribute as boolean. That means currently there is no support for the special case where virtual products do require a shipping address.

Returns:
true if the cart is purely virtual.

readyForCheckout

public boolean readyForCheckout()

Check whether the cart is ready for checkout or not.

NOTE: The main difference to the Zen Cart implementation of this method is that no error messages are generated. This is left to the controller to handle.

Returns:
true if the cart is ready or checkout, false if not.

validateCheckout

public string validateCheckout(boolean messages)

Validate the current checkout request.

Parameters:
messages - Optional flag to enable/hide messages related to validation issues; default is true.
Returns:
Either a viewId, which would indicate an error/issue, or null * if everything is ok.

virtualProductsCount

public int virtualProductsCount()

Checks for virtual products in the cart.

Returns:
The number of virtual products in the cart.

ZenMagick 0.9.6