ZenMagick 0.9.10


zenmagick.store.shared.services.catalog.associations\ZMProductAssociations
services\catalog\associations\ZMProductAssociations.php at line 33

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

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

__construct()

Create new instance.

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, mixed type)

Register an association handler.

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

Method Detail

services\catalog\associations\ZMProductAssociations.php at line 40

__construct

public void __construct()

Create new instance.


services\catalog\associations\ZMProductAssociations.php at line 110

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.

services\catalog\associations\ZMProductAssociations.php at line 100

getHandlerTypes

public array getHandlerTypes()

Get all handler types.

Returns:
A list of all registered handler types.

services\catalog\associations\ZMProductAssociations.php at line 153

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.

services\catalog\associations\ZMProductAssociations.php at line 132

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 an empty array.
all - Optional flag to load all configured products, regardless of start/end date, etc; default is false.
Returns:
A list of ZMProductAssociation instances.

services\catalog\associations\ZMProductAssociations.php at line 191

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.

services\catalog\associations\ZMProductAssociations.php at line 62

instance

public static void instance()

Get instance.


services\catalog\associations\ZMProductAssociations.php at line 79

registerHandler

public void registerHandler(mixed handler, mixed 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 or list thereof; default is null.

ZenMagick 0.9.10