ZenMagick 0.9.6


org.zenmagick.model.catalog.ZMProduct

Class ZMProduct

ZMObject
|
+--ZMProduct

public class ZMProduct
extends ZMObject

A product.

Author:
DerManoMann
Version:
$Id: ZMProduct.php 2195 2009-05-01 10:18:51Z dermanomann $

Fields inherited from org.zenmagick.ZMObject
properties_
Constructor Summary

ZMProduct(int id, string name, string description)

Create new product.

Method Summary
array

getAdditionalImages()

Get additional product images.

array

getAttributes(int languageId)

Get the product attributes.

float

getAverageRating()

Get the average rating.

string

getDateAdded()

Get the date the product was added.

string

getDateAvailable()

Get the available date.

ZMCategory

getDefaultCategory()

Get the default category.

string

getDefaultImage()

Get the product default image.

string

getDescription()

Get the description.

int

getDiscountType()

Get the discount type.

int

getDiscountTypeFrom()

Get the discount type from.

int

getId()

Get the product id.

image

getImage()

Get the product image.

ZMImageInfo

getImageInfo()

Get the product image info.

ZMManufacturer

getManufacturer()

Get the manufacturer.

int

getManufacturerId()

Get the manufacturer id.

int

getMasterCategoryId()

Get the master category id.

int

getMaxOrderQty()

Get the max quantity per order.

int

getMinOrderQty()

Get the min quantity per order.

string

getModel()

Get the model.

string

getName()

Get the product name.

ZMOffers

getOffers()

Get the product offers.

float

getPrice()

Get the calculated product price.

float

getPriceSorter()

Get the product price sorter.

float

getProductPrice()

Get the product price.

int

getQtyBoxStatus()

Get the quantity box status.

float

getQtyOrderUnits()

Get the quantity units.

int

getQuantity()

Get the quantity.

int

getReviewCount()

Get the number of reviews for this product.

int

getSortOrder()

Get the srt order.

float

getSpecialPrice()

Get the product special price.

boolean

getStatus()

Get the product status.

int

getTaxClassId()

Get the tax class id.

ZMTaxRate

getTaxRate()

Get the tax rate.

mixed

getTypeSetting(string field)

Get the product type config values for this product.

string

getUrl()

Get the product url.

float

getWeight()

Get the product weight.

boolean

hasAttributes()

Check if this product has attributes or not.

boolean

hasReviews()

Checks if reviews exist for this product.

boolean

isAlwaysFreeShipping()

Checks if the product is always free shipping

boolean

isAttributePrice()

Checks if the price is affected by attribute prices.

boolean

isCall()

Checks if the user needs to call for this product.

boolean

isFree()

Checks if the product is free.

boolean

isPricedByAttributes()

Check if the product is priced by attributes.

boolean

isQtyMixed()

Checks if the product quantity is calculated across product variations or not.

boolean

isSoldOut()

Checks if the product is sold out.

boolean

isVirtual()

Checks if the product is virtual.

void

setAlwaysFreeShipping(boolean b)

Configure if the product is always free shipping

void

setCall(boolean value)

Sets the flag to indicate that the user needs to call for this product.

void

setDefaultImage(string image)

Set the product default image.

void

setDescription(string description)

Set the description.

void

setDiscountType(int type)

Set the discount type.

void

setDiscountTypeFrom(mixed typeFrom, int The)

Set the discount type from.

void

setFree(boolean value)

Set the product is free flag.

void

setId(int id)

Set the product id.

void

setImage(string image)

Set the product image.

void

setManufacturerId(int manufacturerId)

Set the manufacturer id.

void

setMasterCategoryId(int categoryId)

Set the master category id.

void

setModel(string model)

Set the model.

void

setName(string name)

Set the product name.

void

setPricedByAttributes(boolean value)

Set the priced by attributes flag.

void

setProductPrice(float productPrice)

Set the product price.

void

setQtyOrderUnits(float value)

Set the quantity units.

void

setQuantity(int quantity)

Set the quantity.

void

setSortOrder(int sortOrder)

Set the sort order.

void

setSpecialPrice(float specialPrice)

Set the product special price.

void

setStatus(boolean status)

Set the product status.

void

setTaxClassId(int taxClassId)

Set the tax class id.

void

setUrl(string url)

Set the product url.

void

setVirtual(boolean value)

Set the product is virtual flag.

void

setWeight(float weight)

Set the product weight.

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

Constructor Detail

ZMProduct

public ZMProduct(int id, string name, string description)

Create new product.

Parameters:
id - The product id.
name - The product name.
description - The product description.

Method Detail

getAdditionalImages

public array getAdditionalImages()

Get additional product images.

Returns:
List of optional ZMImageInfo instances.

getAttributes

public array getAttributes(int languageId)

Get the product attributes.

Parameters:
languageId - The languageId; default is null for session language.
Returns:
A list of {@link org.zenmagick.model.catalog.ZMAttribute ZMAttribute} instances.

getAverageRating

public float getAverageRating()

Get the average rating.

Convenience method for ZMReviews::instance()->getAverageRatingForProductId($product->getId()).

Returns:
The average rating.

getDateAdded

public string getDateAdded()

Get the date the product was added.

Returns:
The product added date.

getDateAvailable

public string getDateAvailable()

Get the available date.

Returns:
The available date.

getDefaultCategory

public ZMCategory getDefaultCategory()

Get the default category.

This will return either the master category or the first mapped category for this product.

Returns:
The default category.

getDefaultImage

public string getDefaultImage()

Get the product default image.

Returns:
The default image.

getDescription

public string getDescription()

Get the description.

Returns:
The product description.

getDiscountType

public int getDiscountType()

Get the discount type.

Legal values:

Returns:
The discount type.

getDiscountTypeFrom

public int getDiscountTypeFrom()

Get the discount type from.

Legal values:

Returns:
The discount type from.

getId

public int getId()

Get the product id.

Returns:
The product id.

getImage

public image getImage()

Get the product image.

Returns:
The product image.

getImageInfo

public ZMImageInfo getImageInfo()

Get the product image info.

Returns:
The product image info.

getManufacturer

public ZMManufacturer getManufacturer()

Get the manufacturer.

Returns:
The manufacturer.

getManufacturerId

public int getManufacturerId()

Get the manufacturer id.

Returns:
The manufacturer id.

getMasterCategoryId

public int getMasterCategoryId()

Get the master category id.

Returns:
The master category id.

getMaxOrderQty

public int getMaxOrderQty()

Get the max quantity per order.

Returns:
The max quantity per order.

getMinOrderQty

public int getMinOrderQty()

Get the min quantity per order.

Returns:
The min quantity per order.

getModel

public string getModel()

Get the model.

Returns:
The model.

getName

public string getName()

Get the product name.

Returns:
The product name.

getOffers

public ZMOffers getOffers()

Get the product offers.

Returns:
The offers (if any), for this product.

getPrice

public float getPrice()

Get the calculated product price.

This is the same as getOffers->getCalculatedPrice(). This also means this method will always include TAX.

Returns:
The product price.

getPriceSorter

public float getPriceSorter()

Get the product price sorter.

Returns:
The price sorter.

getProductPrice

public float getProductPrice()

Get the product price.

Returns:
The product price.

getQtyBoxStatus

public int getQtyBoxStatus()

Get the quantity box status.

Returns:
The quantity box status.

getQtyOrderUnits

public float getQtyOrderUnits()

Get the quantity units.

Returns:
The quantity units.

getQuantity

public int getQuantity()

Get the quantity.

Returns:
The quantity.

getReviewCount

public int getReviewCount()

Get the number of reviews for this product.

Returns:
The number of reviews.

getSortOrder

public int getSortOrder()

Get the srt order.

Returns:
The sort order.

getSpecialPrice

public float getSpecialPrice()

Get the product special price.

Returns:
The product special price.

getStatus

public boolean getStatus()

Get the product status.

Returns:
The product status.

getTaxClassId

public int getTaxClassId()

Get the tax class id.

Returns:
The tax class id.

getTaxRate

public ZMTaxRate getTaxRate()

Get the tax rate.

Returns:
The tax rate.

getTypeSetting

public mixed getTypeSetting(string field)

Get the product type config values for this product.

This corresponds to the 'Catalog' -> 'Product Type' settings in the admin interface.

Parameters:
field - The field name.
Returns:
The setting value.

getUrl

public string getUrl()

Get the product url.

Returns:
The product url.

getWeight

public float getWeight()

Get the product weight.

Returns:
The weight.

hasAttributes

public boolean hasAttributes()

Check if this product has attributes or not.

Returns:
true if there are attributes (values) available, * false if not.

hasReviews

public boolean hasReviews()

Checks if reviews exist for this product.

Returns:
true if reviews exist, false if not.

isAlwaysFreeShipping

public boolean isAlwaysFreeShipping()

Checks if the product is always free shipping

Returns:
true if the product is free shipping, false if not.

isAttributePrice

public boolean isAttributePrice()

Checks if the price is affected by attribute prices.

Returns:
true if the price is affected by attributes, false if not.
Deprecated:
use ZMOffers::isAttributePrice() instead

isCall

public boolean isCall()

Checks if the user needs to call for this product.

Returns:
true if the user must call, false if not.

isFree

public boolean isFree()

Checks if the product is free.

Returns:
true if the product is free, false if not.

isPricedByAttributes

public boolean isPricedByAttributes()

Check if the product is priced by attributes.

Returns:
true if priced by attributes.

isQtyMixed

public boolean isQtyMixed()

Checks if the product quantity is calculated across product variations or not.

Returns:
true if the quantity is calculated across variations, false if not.

isSoldOut

public boolean isSoldOut()

Checks if the product is sold out.

Returns:
true if the product is sold out, false if not.

isVirtual

public boolean isVirtual()

Checks if the product is virtual.

Returns:
true if the product is virtual, false if not.

setAlwaysFreeShipping

public void setAlwaysFreeShipping(boolean b)

Configure if the product is always free shipping

Parameters:
b - true if the product is free shipping, false if not.

setCall

public void setCall(boolean value)

Sets the flag to indicate that the user needs to call for this product.

Parameters:
value - true if the user must call, false if not.

setDefaultImage

public void setDefaultImage(string image)

Set the product default image.

Parameters:
image - The default image.

setDescription

public void setDescription(string description)

Set the description.

Parameters:
description - The product description.

setDiscountType

public void setDiscountType(int type)

Set the discount type.

Parameters:
type - The discount type.

setDiscountTypeFrom

public void setDiscountTypeFrom(mixed typeFrom, int The)

Set the discount type from.

Parameters:
The - discount type from.

setFree

public void setFree(boolean value)

Set the product is free flag.

Parameters:
value - true if the product is free, false if not.

setId

public void setId(int id)

Set the product id.

Parameters:
id - The product id.

setImage

public void setImage(string image)

Set the product image.

Parameters:
image - The product image.

setManufacturerId

public void setManufacturerId(int manufacturerId)

Set the manufacturer id.

Parameters:
manufacturerId - The manufacturer id.

setMasterCategoryId

public void setMasterCategoryId(int categoryId)

Set the master category id.

Parameters:
categoryId - The master category id.

setModel

public void setModel(string model)

Set the model.

Parameters:
model - The model.

setName

public void setName(string name)

Set the product name.

Parameters:
name - The product name.

setPricedByAttributes

public void setPricedByAttributes(boolean value)

Set the priced by attributes flag.

Parameters:
value - The new value.

setProductPrice

public void setProductPrice(float productPrice)

Set the product price.

Parameters:
productPrice - The product price.

setQtyOrderUnits

public void setQtyOrderUnits(float value)

Set the quantity units.

Parameters:
value - The quantity units value.

setQuantity

public void setQuantity(int quantity)

Set the quantity.

Parameters:
quantity - The quantity.

setSortOrder

public void setSortOrder(int sortOrder)

Set the sort order.

Parameters:
sortOrder - The sort order.

setSpecialPrice

public void setSpecialPrice(float specialPrice)

Set the product special price.

Parameters:
specialPrice - The product special price.

setStatus

public void setStatus(boolean status)

Set the product status.

Parameters:
status - The product status.

setTaxClassId

public void setTaxClassId(int taxClassId)

Set the tax class id.

Parameters:
taxClassId - The tax class id.

setUrl

public void setUrl(string url)

Set the product url.

Parameters:
url - The product url.

setVirtual

public void setVirtual(boolean value)

Set the product is virtual flag.

Parameters:
value - true if the product is virtual, false if not.

setWeight

public void setWeight(float weight)

Set the product weight.

Parameters:
weight - The weight.

ZenMagick 0.9.6