ZenMagick 0.9.6


org.zenmagick.service.ZMCategories

Class ZMCategories

ZMObject
|
+--ZMCategories

public class ZMCategories
extends ZMObject

Category DAO.

Author:
DerManoMann
Version:
$Id: ZMCategories.php 1976 2009-02-19 23:17:07Z dermanomann $

Field Summary
protected mixed

$categories_

Flat list of ZMCategory instances.

Fields inherited from org.zenmagick.ZMObject
properties_
Constructor Summary

ZMCategories()

Create new instance.

Method Summary
protected void

buildTree(int languageId)

Create tree data.

Category

createCategory(ZMCategory category)

Create a new category.

array

getCategories(array ids, int languageId)

Get all categories.

ZMCategory

getCategoryForId(int categoryId, int languageId)

Get a category for the given id.

array

getCategoryTree(int languageId)

This returns, in fact, not a real tree, but a list of all top level categories.

ZMCategory

getDefaultCategoryForProductId(int productId, int languageId)

Get the default category for the given product id.

array

getProductTypeIds(mixed categoryId)

Get the allowed product types (ids) for the given category id.

static void

instance()

Get instance.

protected void

load(int languageId)

Load all categories.

Category

updateCategory(ZMCategory category)

Update an existing category.

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

Field Detail

categories_

protected mixed $categories_

Flat list of ZMCategory instances.

This gets loaded on demand, so subclasses have to ensure this is populated before using it.

/


Constructor Detail

ZMCategories

public ZMCategories()

Create new instance. /


Method Detail

buildTree

protected void buildTree(int languageId)

Create tree data.

Parameters:
languageId - Optional language id; default is null.

createCategory

public Category createCategory(ZMCategory category)

Create a new category.

Parameters:
category - The category.
Returns:
The updated category.

getCategories

public array getCategories(array ids, int languageId)

Get all categories.

Parameters:
ids - Optional list of category ids.
languageId - Optional language id; default is null.
Returns:
A list of ZMCategory instances.

getCategoryForId

public ZMCategory getCategoryForId(int categoryId, int languageId)

Get a category for the given id.

Parameters:
categoryId - The category id.
languageId - Optional language id; default is null.
Returns:
A ZMCategory instance or null.

getCategoryTree

public array getCategoryTree(int languageId)

This returns, in fact, not a real tree, but a list of all top level categories.

Parameters:
languageId - Optional language id; default is null.
Returns:
A list of all top level categories (parentId == 0).

getDefaultCategoryForProductId

public ZMCategory getDefaultCategoryForProductId(int productId, int languageId)

Get the default category for the given product id.

This will return the first mapped category.

Parameters:
productId - The product id.
languageId - Optional language id; default is null.
Returns:
The default category (or null).

getProductTypeIds

public array getProductTypeIds(mixed categoryId)

Get the allowed product types (ids) for the given category id.

Returns:
List of allowed product type ids; an empty list means no restrictions.

instance

public static void instance()

Get instance. /


load

protected void load(int languageId)

Load all categories.

Parameters:
languageId - Optional language id; default is null.

updateCategory

public Category updateCategory(ZMCategory category)

Update an existing category.

Parameters:
category - The category.
Returns:
The updated category.

ZenMagick 0.9.6