ZenMagick 0.9.10


zenmagick.store.shared.services.catalog\ZMProducts
services\catalog\ZMProducts.php at line 33

Class ZMProducts

ZMObject
└─ZMProducts
All Implemented Interfaces:
org.zenmagick.core.services.database\ZMSQLAware

public class ZMProducts
extends ZMObject

Product access.

Author:
DerManoMann

Constant Summary
final static str

IMAGE_LARGE

final static str

IMAGE_MEDIUM

final static str

IMAGE_SMALL

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

__construct()

Create new instance.

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, str 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, bool 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
__construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton

Constant Detail

services\catalog\ZMProducts.php at line 37

IMAGE_LARGE

public final static str IMAGE_LARGE = 'large'

services\catalog\ZMProducts.php at line 36

IMAGE_MEDIUM

public final static str IMAGE_MEDIUM = 'medium'

services\catalog\ZMProducts.php at line 35

IMAGE_SMALL

public final static str IMAGE_SMALL = 'small'

Method Detail

services\catalog\ZMProducts.php at line 46

__construct

public void __construct()

Create new instance.


services\catalog\ZMProducts.php at line 107

getAllProducts

public array getAllProducts(boolean active, int languageId)

Get all products.

Parameters:
active - If true return only active products; default is true.
languageId - Language id.
Returns:
A list of ZMProduct instances.

services\catalog\ZMProducts.php at line 85

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.
Returns:
Query details.

services\catalog\ZMProducts.php at line 402

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.

services\catalog\ZMProducts.php at line 308

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.

services\catalog\ZMProducts.php at line 701

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.

services\catalog\ZMProducts.php at line 346

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.

services\catalog\ZMProducts.php at line 491

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.

services\catalog\ZMProducts.php at line 460

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.

services\catalog\ZMProducts.php at line 137

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.

services\catalog\ZMProducts.php at line 267

getProductTypeSetting

public boolean getProductTypeSetting(int productId, string field, str 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.

services\catalog\ZMProducts.php at line 218

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.

services\catalog\ZMProducts.php at line 193

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 - Language id.
Returns:
A list of ZMProduct instances.

services\catalog\ZMProducts.php at line 525

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.

services\catalog\ZMProducts.php at line 230

getProductsForManufacturerId

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

services\catalog\ZMProducts.php at line 689

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.

services\catalog\ZMProducts.php at line 70

getQueryDetails

public void getQueryDetails(mixed method, mixed args)


services\catalog\ZMProducts.php at line 440

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.

services\catalog\ZMProducts.php at line 62

instance

public static void instance()

Get instance.


services\catalog\ZMProducts.php at line 669

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.

services\catalog\ZMProducts.php at line 588

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.

services\catalog\ZMProducts.php at line 604

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