ZenMagick 0.9.8


org.zenmagick.store.services.catalog.ZMProducts
\store\services\catalog\ZMProducts.php at line 34

Class ZMProducts

ZMObject
└─ZMProducts
All Implemented Interfaces:
ZMSQLAware

public class ZMProducts
extends ZMObject

Product access.

Author:
DerManoMann
Version:
$Id: ZMProducts.php 2777 2009-12-23 22:04:20Z dermanomann $

Field Summary
final str

IMAGE_LARGE

final str

IMAGE_MEDIUM

final str

IMAGE_SMALL

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

ZMProducts()

Create new instance.

Method Summary
array

getAllProducts(boolean active, int languageId)

Get all products.

protected ZMQueryDetails

getAllProductsQueryDetails(boolean active, int languageId)

Get all products.

array

getBestSellers(int categoryId, int max, int languageId)

Get best seller products.

array

getFeaturedProducts(int categoryId, int max, boolean includeChildren, int languageId)

Get random featured products.

ZMMetaTagDetails

getMetaTagDetailsForId(int productId, int languageId)

Get meta tag details for the given id and language.

array

getNewProducts(int categoryId, int max, int timeLimit, int languageId)

Get random new products.

ZMProduct

getProductForId(int productId, int languageId)

Get a product for the given product id.

ZMProduct

getProductForModel(string model, int languageId)

Get a product for the given model name.

array

getProductIdsForCategoryId(int categoryId, boolean active, boolean includeChildren, int languageId)

Get list of all active product ids for a given category.

boolean

getProductTypeSetting(int productId, string field, mixed keyPprefix, string keySuffix, string fieldPrefix, string fieldSuffix, string keyPrefix)

Test if a given product type option is enabled for a given product.

array

getProductsForCategoryId(int categoryId, boolean active, int languageId)

Get all (active) products for the given category id.

protected array

getProductsForCategoryIdQueryDetails(int categoryId, boolean active, int languageId)

Get all (active) products for the given category id.

ZMProduct

getProductsForIds(array productIds, boolean preserveOrder, int languageId)

Load a list of products.

void

getProductsForManufacturerId(mixed manufacturerId, mixed active, mixed languageId)

array

getProductsForSQL(string sql, int languageId)

Execute the given SQL and return the resulting product.

void

getQueryDetails(mixed method, mixed args)

{@inheritDoc}

array

getSpecials(int max, int languageId)

Get random products marked as specials.

static void

instance()

Get instance.

boolean

isQuantityAvailable(int productId, int quantity)

Check if a certain quantity of a given product is available.

ZMProduct

updateProduct(ZMProduct product)

Update an existing product.

void

updateViewCount(int productId, int languageId)

Update the view count for a product.

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

Field Detail

\store\services\catalog\ZMProducts.php at line 38

IMAGE_LARGE

public final str IMAGE_LARGE = 'large'

\store\services\catalog\ZMProducts.php at line 37

IMAGE_MEDIUM

public final str IMAGE_MEDIUM = 'medium'

\store\services\catalog\ZMProducts.php at line 36

IMAGE_SMALL

public final str IMAGE_SMALL = 'small'

Constructor Detail

\store\services\catalog\ZMProducts.php at line 47

ZMProducts

public ZMProducts()

Create new instance.


Method Detail

\store\services\catalog\ZMProducts.php at line 113

getAllProducts

public array getAllProducts(boolean active, int languageId)

Get all products.

Parameters:
active - If true return only active products; default is true.
languageId - Optional language id; default is null for session language.
Returns:
A list of ZMProduct instances.

\store\services\catalog\ZMProducts.php at line 86

getAllProductsQueryDetails

protected ZMQueryDetails getAllProductsQueryDetails(boolean active, int languageId)

Get all products.

Parameters:
active - If true return only active products; default is true.
languageId - Optional language id; default is null for session language.
Returns:
Query details.

\store\services\catalog\ZMProducts.php at line 415

getBestSellers

public array getBestSellers(int categoryId, int max, int languageId)

Get best seller products.

Parameters:
categoryId - Optional category id to narrow down results; default is null for all.
max - The maximum number of results; default is null to use the setting maxBestSellers.
languageId - Optional language id; default is null for session language.
Returns:
A list of ZMProduct instances.

\store\services\catalog\ZMProducts.php at line 325

getFeaturedProducts

public array getFeaturedProducts(int categoryId, int max, boolean includeChildren, int languageId)

Get random featured products.

Parameters:
categoryId - Optional category id to narrow down results; default is null for all.
max - The maximum number of results; default is 0 for all.
includeChildren - Optional flag to include child categories in the search; default is false.
languageId - Optional language id; default is null for session language.
Returns:
A list of ZMProduct instances.

\store\services\catalog\ZMProducts.php at line 714

getMetaTagDetailsForId

public ZMMetaTagDetails getMetaTagDetailsForId(int productId, int languageId)

Get meta tag details for the given id and language.

Parameters:
productId - The product id.
languageId - Language id.
Returns:
The details or null.

\store\services\catalog\ZMProducts.php at line 363

getNewProducts

public array getNewProducts(int categoryId, int max, int timeLimit, int languageId)

Get random new products.

Parameters:
categoryId - Optional category id to narrow down results; default is null for all.
max - The maximum number of results; default is 0 for all.
timeLimit - Optional time limit in days (or first of month for using 1null to use the setting 'maxNewProducts'.
languageId - Optional language id; default is null for session language.
Returns:
A list of ZMProduct instances.

\store\services\catalog\ZMProducts.php at line 504

getProductForId

public ZMProduct getProductForId(int productId, int languageId)

Get a product for the given product id.

Parameters:
productId - The product id.
languageId - Optional language id; default is null for session language.
Returns:
The product or null.

\store\services\catalog\ZMProducts.php at line 473

getProductForModel

public ZMProduct getProductForModel(string model, int languageId)

Get a product for the given model name.

Parameters:
model - The model name.
languageId - Optional language id; default is null for session language.
Returns:
The product or null.

\store\services\catalog\ZMProducts.php at line 148

getProductIdsForCategoryId

public array getProductIdsForCategoryId(int categoryId, boolean active, boolean includeChildren, int languageId)

Get list of all active product ids for a given category.

This is a faster version of getProductsForCategoryId(int). In addition, this will ignore language preferences.

Parameters:
categoryId - The category id.
active - If true return only active products; default is true.
includeChildren - Optional flag to include subcategories; default is false.
languageId - Optional language id; default is null for session language.
Returns:
A list of product ids.

\store\services\catalog\ZMProducts.php at line 284

getProductTypeSetting

public boolean getProductTypeSetting(int productId, string field, mixed keyPprefix, string keySuffix, string fieldPrefix, string fieldSuffix, string keyPrefix)

Test if a given product type option is enabled for a given product.

Parameters:
productId - The product id.
field - The option name.
keyPrefix - Optional key prefix; default is _INFO.
keySuffix - Optional key suffix; default is SHOW_.
fieldPrefix - Optional field prefix; default is _.
fieldSuffix - Optional field suffix; default is an empty string.
Returns:
true if the specified type option is enabled, false if not.

\store\services\catalog\ZMProducts.php at line 235

getProductsForCategoryId

public array getProductsForCategoryId(int categoryId, boolean active, int languageId)

Get all (active) products for the given category id.

Parameters:
categoryId - The category id.
active - If true return only active products; default is true.
languageId - Optional language id; default is null for session language.
Returns:
A list of ZMProduct instances.

\store\services\catalog\ZMProducts.php at line 205

getProductsForCategoryIdQueryDetails

protected array getProductsForCategoryIdQueryDetails(int categoryId, boolean active, int languageId)

Get all (active) products for the given category id.

Parameters:
categoryId - The category id.
active - If true return only active products; default is true.
languageId - Optional language id; default is null for session language.
Returns:
A list of ZMProduct instances.

\store\services\catalog\ZMProducts.php at line 538

getProductsForIds

public ZMProduct getProductsForIds(array productIds, boolean preserveOrder, int languageId)

Load a list of products.

Parameters:
productIds - A list of (int) product ids.
preserveOrder - Optional flag to return the products in the order of the given id list, rather than using the default product sort order; default is false.
languageId - Optional language id; default is null for session language.
Returns:
The product or null.

\store\services\catalog\ZMProducts.php at line 247

getProductsForManufacturerId

public void getProductsForManufacturerId(mixed manufacturerId, mixed active, mixed languageId)

\store\services\catalog\ZMProducts.php at line 702

getProductsForSQL

public array getProductsForSQL(string sql, int languageId)

Execute the given SQL and return the resulting product.

Parameters:
sql - Some SQL.
languageId - Optional language id; default is null for session language.
Returns:
A list of ZMProduct instances.

\store\services\catalog\ZMProducts.php at line 71

getQueryDetails

public void getQueryDetails(mixed method, mixed args)


\store\services\catalog\ZMProducts.php at line 453

getSpecials

public array getSpecials(int max, int languageId)

Get random products marked as specials.

Parameters:
max - The maximum number of results; default is null to use the setting maxSpecialProducts.
languageId - Optional language id; default is null for session language.
Returns:
A list of ZMProduct instances.

\store\services\catalog\ZMProducts.php at line 63

instance

public static void instance()

Get instance.


\store\services\catalog\ZMProducts.php at line 682

isQuantityAvailable

public boolean isQuantityAvailable(int productId, int quantity)

Check if a certain quantity of a given product is available.

Parameters:
productId - The product id.
quantity - The desired quantity.
Returns:
true if the requested quantity is available, false if not.

\store\services\catalog\ZMProducts.php at line 601

updateProduct

public ZMProduct updateProduct(ZMProduct product)

Update an existing product.

NOTE: Currently only the products table is updated!

Parameters:
product - The product.
Returns:
The updated product.

\store\services\catalog\ZMProducts.php at line 617

updateViewCount

public void updateViewCount(int productId, int languageId)

Update the view count for a product.

Parameters:
productId - The product id.
languageId - Optional language id; default is null for session language.

ZenMagick 0.9.8