ZenMagick 0.9.8


org.zenmagick.store.services.catalog.associations.ZMProductAssociations
\store\services\catalog\associations\ZMProductAssociations.php at line 37

Class ZMProductAssociations

ZMObject
└─ZMProductAssociations

public class ZMProductAssociations
extends ZMObject

Manage pluggable product associations.

Handler can be explicitely registered using the registerHandler(..) method, or, preferrably via the setting 'defaultProductAssociationHandler' - as comma separated list of class names.

Author:
DerManoMann
Version:
$Id: ZMProductAssociations.php 2694 2009-12-03 22:32:18Z dermanomann $

Fields inherited from org.zenmagick.core.ZMObject
properties_
Constructor Summary

ZMProductAssociations()

Create new instance.

Method Summary
ZMProductAssociationHandler

getHandlerForType(string type)

Get a handler for the given type.

array

getHandlerTypes()

Get all handler types.

array

getProductAssociationsForCategoryId(int categoryId, int type, array args, boolean all)

Get associated products for the given category.

array

getProductAssociationsForProductId(int productId, int type, array args, boolean all)

Get product associations for the given product, type and parameter.

array

getProductAssociationsForShoppingCart(ZMShoppingCart shoppingCart, int type, array args, boolean all)

Get associated products for the given shopping cart.

static void

instance()

Get instance.

void

registerHandler(mixed handler, string type)

Register an association handler.

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

Constructor Detail

\store\services\catalog\associations\ZMProductAssociations.php at line 44

ZMProductAssociations

public ZMProductAssociations()

Create new instance.


Method Detail

\store\services\catalog\associations\ZMProductAssociations.php at line 108

getHandlerForType

public ZMProductAssociationHandler getHandlerForType(string type)

Get a handler for the given type.

Parameters:
type - The association type/name.
Returns:
A handler instance or null.

\store\services\catalog\associations\ZMProductAssociations.php at line 98

getHandlerTypes

public array getHandlerTypes()

Get all handler types.

Returns:
A list of all registered handler types.

\store\services\catalog\associations\ZMProductAssociations.php at line 151

getProductAssociationsForCategoryId

public array getProductAssociationsForCategoryId(int categoryId, int type, array args, boolean all)

Get associated products for the given category.

This is mostly a convenience method to avoid having to iterate over all products in a given category yourself.

This method will also take care of duplicates.

Parameters:
categoryId - The category.
type - The association type.
args - Optional parameter that might be required by the used type; default is null for none.
all - Optional flag to load all configured products, regardless of start/end date, etc; default is false.
Returns:
A list of ZMProductAssociation instances.

\store\services\catalog\associations\ZMProductAssociations.php at line 130

getProductAssociationsForProductId

public array getProductAssociationsForProductId(int productId, int type, array args, boolean all)

Get product associations for the given product, type and parameter.

Parameters:
productId - The source product id.
type - The association type.
args - Optional parameter that might be required by the used type; default is null for none.
all - Optional flag to load all configured products, regardless of start/end date, etc; default is false.
Returns:
A list of ZMProductAssociation instances.

\store\services\catalog\associations\ZMProductAssociations.php at line 189

getProductAssociationsForShoppingCart

public array getProductAssociationsForShoppingCart(ZMShoppingCart shoppingCart, int type, array args, boolean all)

Get associated products for the given shopping cart.

This is mostly a convenience method to avoid having to iterate over all products in the given cart.

This method will also take care of duplicates.

Parameters:
shoppingCart - The shopping cart.
type - The association type.
args - Optional parameter that might be required by the used type; default is null for none.
all - Optional flag to load all configured products, regardless of start/end date, etc; default is false.
Returns:
A list of ZMProductAssociation instances.

\store\services\catalog\associations\ZMProductAssociations.php at line 66

instance

public static void instance()

Get instance.


\store\services\catalog\associations\ZMProductAssociations.php at line 83

registerHandler

public void registerHandler(mixed handler, string type)

Register an association handler.

The optional $type parameter allows to register a handler as string. If omitted, an instance of the handler will be created immediately in order to query the type. This also allows to register the same handler for different types, if required.

Parameters:
handler - This can be either a ZMProductAssociationHandler instance, or a class definition compatible with ZMBeanUtils::getBean(..).
type - Optional association type/name; default is null.

ZenMagick 0.9.8