ZenMagick 0.9.10


zenmagick.store.sf.utils\ZMCheckoutHelper
utils\ZMCheckoutHelper.php at line 33

Class ZMCheckoutHelper

ZMObject
└─ZMCheckoutHelper

public class ZMCheckoutHelper
extends ZMObject

Checkout helper.

Author:
DerManoMann

Constant Summary
final static str

CART_PRODUCT_QUANTITY

final static str

CART_PRODUCT_STATUS

final static str

CART_PRODUCT_UNITS

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

__construct(ZMShoppingCart shoppingCart)

Create new instance.

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

isFreeShipping()

Check if the given shopping cart qualifies for free shipping (as per free shipping ot).

boolean

isGVOnly()

Checks if there are only gift vouchers in the cart.

boolean

isVirtual()

Check for virtual cart.

void

markCartFreeShipping()

Mark cart as free shipping.

boolean

readyForCheckout()

Check whether the cart is ready for checkout or not.

void

saveHash(ZMRequest request)

Save the cart hash as reference against tampering.

string

validateCheckout(boolean messages)

Validate the current checkout request.

boolean

verifyHash(ZMRequest request)

Validate the cart hash.

int

virtualProductsCount()

Checks for virtual products in the cart.

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

Constant Detail

utils\ZMCheckoutHelper.php at line 35

CART_PRODUCT_QUANTITY

public final static str CART_PRODUCT_QUANTITY = 'quantity'

utils\ZMCheckoutHelper.php at line 34

CART_PRODUCT_STATUS

public final static str CART_PRODUCT_STATUS = 'status'

utils\ZMCheckoutHelper.php at line 36

CART_PRODUCT_UNITS

public final static str CART_PRODUCT_UNITS = 'units'

Method Detail

utils\ZMCheckoutHelper.php at line 45

__construct

public void __construct(ZMShoppingCart shoppingCart)

Create new instance.

Parameters:
shoppingCart - The cart.

utils\ZMCheckoutHelper.php at line 183

checkCartStatus

public array checkCartStatus()

Check whether the cart is ready for checkout or not.

Possible return values:

Returns:
A map of errorCode => item pairs.

utils\ZMCheckoutHelper.php at line 247

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

utils\ZMCheckoutHelper.php at line 112

freeProductsCount

public int freeProductsCount()

Checks for free products in the cart.

Returns:
The number of free products in the cart.

utils\ZMCheckoutHelper.php at line 146

freeShippingCount

public int freeShippingCount()

Checks for free shipping.

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

utils\ZMCheckoutHelper.php at line 63

isFreeShipping

public boolean isFreeShipping()

Check if the given shopping cart qualifies for free shipping (as per free shipping ot).

Returns:
true if the cart qualifies for free shipping.

utils\ZMCheckoutHelper.php at line 96

isGVOnly

public boolean isGVOnly()

Checks if there are only gift vouchers in the cart.

Returns:
true if only vouchers are in the cart.

utils\ZMCheckoutHelper.php at line 167

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.

utils\ZMCheckoutHelper.php at line 317

markCartFreeShipping

public void markCartFreeShipping()

Mark cart as free shipping.


utils\ZMCheckoutHelper.php at line 237

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.

utils\ZMCheckoutHelper.php at line 300

saveHash

public void saveHash(ZMRequest request)

Save the cart hash as reference against tampering.

Parameters:
request - The current request.

utils\ZMCheckoutHelper.php at line 271

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.

utils\ZMCheckoutHelper.php at line 310

verifyHash

public boolean verifyHash(ZMRequest request)

Validate the cart hash.

Parameters:
request - The current request.
Returns:
true if, and only if, the session cart hash and the current hash are the same.

utils\ZMCheckoutHelper.php at line 129

virtualProductsCount

public int virtualProductsCount()

Checks for virtual products in the cart.

Returns:
The number of virtual products in the cart.

ZenMagick 0.9.10