ZenMagick 0.9.8


org.zenmagick.store.utils.ZMCheckoutHelper
\store\utils\ZMCheckoutHelper.php at line 34

Class ZMCheckoutHelper

ZMObject
└─ZMCheckoutHelper

public class ZMCheckoutHelper
extends ZMObject

Checkout helper.

Author:
DerManoMann
Version:
$Id: ZMCheckoutHelper.php 2730 2009-12-14 20:50:44Z dermanomann $

Field Summary
final str

CART_PRODUCT_QUANTITY

final str

CART_PRODUCT_STATUS

final str

CART_PRODUCT_UNITS

Fields inherited from org.zenmagick.core.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.core.ZMObject
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Field Detail

\store\utils\ZMCheckoutHelper.php at line 36

CART_PRODUCT_QUANTITY

public final str CART_PRODUCT_QUANTITY = 'quantity'

\store\utils\ZMCheckoutHelper.php at line 35

CART_PRODUCT_STATUS

public final str CART_PRODUCT_STATUS = 'status'

\store\utils\ZMCheckoutHelper.php at line 37

CART_PRODUCT_UNITS

public final str CART_PRODUCT_UNITS = 'units'

Constructor Detail

\store\utils\ZMCheckoutHelper.php at line 46

ZMCheckoutHelper

public ZMCheckoutHelper(ZMShoppingCart cart)

Create new instance.

Parameters:
cart - The cart.

Method Detail

\store\utils\ZMCheckoutHelper.php at line 162

checkCartStatus

public array checkCartStatus()

Check whether the cart is ready for checkout or not.

Possible return values:

Returns:
A map of errorCode -> item pairs.

\store\utils\ZMCheckoutHelper.php at line 226

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

\store\utils\ZMCheckoutHelper.php at line 80

freeProductsCount

public int freeProductsCount()

Checks for free products in the cart.

Returns:
The number of free products in the cart.

\store\utils\ZMCheckoutHelper.php at line 114

freeShippingCount

public int freeShippingCount()

Checks for free shipping.

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

\store\utils\ZMCheckoutHelper.php at line 64

isGVOnly

public boolean isGVOnly()

Checks if there are only gift vouchers in the cart.

Returns:
true if only vouchers are in the cart.

\store\utils\ZMCheckoutHelper.php at line 135

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.

\store\utils\ZMCheckoutHelper.php at line 216

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.

\store\utils\ZMCheckoutHelper.php at line 250

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.

\store\utils\ZMCheckoutHelper.php at line 97

virtualProductsCount

public int virtualProductsCount()

Checks for virtual products in the cart.

Returns:
The number of virtual products in the cart.

ZenMagick 0.9.8