ZenMagick 0.9.6


org.zenmagick.model.catalog.ZMAttributeValue

Class ZMAttributeValue

ZMObject
|
+--ZMAttributeValue

public class ZMAttributeValue
extends ZMObject

A single attribute value.

For attributes that accept user input (text/upload), the name will be replaced with the entered data to allow handling all values the same way.

Author:
DerManoMann
Version:
$Id: ZMAttributeValue.php 2211 2009-05-07 05:13:40Z dermanomann $

Fields inherited from org.zenmagick.ZMObject
properties_
Constructor Summary

ZMAttributeValue(mixed id, mixed name)

Create new instance.

Method Summary
ZMAttribute

getAttribute()

Get the parent attribute.

protected float

getFinalOneTimePriceForQty(int quantity)

Get the final one time attribute price.

protected float

getFinalPriceForQty(int quantity)

Get the final attribute price without discount.

int

getId()

Get the attribute value id.

string

getImage()

Get the attribute value image (if any).

string

getName()

Get the attribute value name.

double

getOneTimePrice(boolean tax)

Get the final one time price.

double

getPrice(boolean tax, int quantity)

Get the final (and discounted) value price.

protected float

getPriceFactorCharge(float price, float discountPrice, float priceFactor, int priceFactorOffset)

Get the price factor charge.

string

getPricePrefix()

Get the price prefix.

protected float

getQtyPrice(string qtyPrices, int quantity)

Get one time charge (if any) for the given range and quantity.

int

getSortOrder()

Get the attribute value sort order.

ZMTaxRate

getTaxRate()

Get the tax rate.

double

getValuePrice(boolean tax)

Get the value price.

double

getWeight()

Get the attribute weight.

string

getWeightPrefix()

Get the weight prefix.

boolean

hasImage()

Check if this value has an associated image.

boolean

isDefault()

Check if this is the default value.

boolean

isDiscounted()

Check if this value is discounted.

boolean

isDisplayOnly()

Check if the attribute is 'display only'.

boolean

isFree()

Check if the attribute is free.

boolean

isIncludeInBasePrice()

Check if the base price is included.

boolean

isPriceFactorOneTime()

Check if the price factor is one time.

void

setAttribute(ZMAttribute attribute)

Set the parent attribute.

void

setDefault(boolean value)

Set the default value flag.

void

setDiscounted(boolean value)

Set the is discounted flag.

void

setDisplayOnly(boolean value)

Set the attribute is 'display only' flag.

void

setFree(boolean value)

Sheck the attribute free flag.

void

setId(int id)

Set the attribute value id.

void

setImage(string image)

Set the attribute value image (if any).

void

setIncludeInBasePrice(boolean value)

Set the base price is included flag.

void

setName(string name)

Set the attribute value name.

void

setOneTimePrice(double oneTimePrice)

Set the values one time price.

void

setPriceFactorOneTime(boolean value)

Set the price factor is one time flag.

void

setPricePrefix(string pricePrefix)

Set the price prefix.

void

setSortOrder(int sortOrder)

Set the attribute value sort order.

void

setTaxRate(ZMTaxRate taxRate)

Set the tax rate.

void

setValuePrice(double price)

Set the value price.

double

setWeight(mixed weight)

Set the attribute weight.

void

setWeightPrefix(string weightPrefix)

Set the weight prefix.

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

Constructor Detail

ZMAttributeValue

public ZMAttributeValue(mixed id, mixed name)

Create new instance. /


Method Detail

getAttribute

public ZMAttribute getAttribute()

Get the parent attribute.

Returns:
The attribute.

getFinalOneTimePriceForQty

protected float getFinalOneTimePriceForQty(int quantity)

Get the final one time attribute price.

Parameters:
quantity - The quantity.
Returns:
The price.

getFinalPriceForQty

protected float getFinalPriceForQty(int quantity)

Get the final attribute price without discount.

Parameters:
quantity - The quantity.
Returns:
The price.

getId

public int getId()

Get the attribute value id.

Returns:
The attribute value id.

getImage

public string getImage()

Get the attribute value image (if any).

Returns:
The attribute value image name.

getName

public string getName()

Get the attribute value name.

Returns:
The attribute value name.

getOneTimePrice

public double getOneTimePrice(boolean tax)

Get the final one time price.

Parameters:
tax - Set to true to include tax (if applicable); default is true.
Returns:
The attributes one time price.

getPrice

public double getPrice(boolean tax, int quantity)

Get the final (and discounted) value price.

Parameters:
tax - Set to true to include tax (if applicable); default is true.
quantity - Optional quantity; default is 1.
Returns:
The price.

getPriceFactorCharge

protected float getPriceFactorCharge(float price, float discountPrice, float priceFactor, int priceFactorOffset)

Get the price factor charge.

The setting 'isDiscountAttributePriceFactor' will determine whether to use the discount or regular price.

Parameters:
price - The calculated price.
discountPrice - The discounted price (if any).
priceFactor - The price factor.
priceFactorOffset - The price factopr offset.
Returns:
The price factor price.

getPricePrefix

public string getPricePrefix()

Get the price prefix.

Returns:
The price prefix.

getQtyPrice

protected float getQtyPrice(string qtyPrices, int quantity)

Get one time charge (if any) for the given range and quantity.

Parameters:
qtyPrices - The qty/price mappings.
quantity - The quantity.
Returns:
The one time charge.

getSortOrder

public int getSortOrder()

Get the attribute value sort order.

Returns:
The attribute sort order.

getTaxRate

public ZMTaxRate getTaxRate()

Get the tax rate.

Returns:
The tax rate.

getValuePrice

public double getValuePrice(boolean tax)

Get the value price.

Parameters:
tax - Set to true to include tax (if applicable); default is true.
Returns:
The price.

getWeight

public double getWeight()

Get the attribute weight.

Returns:
The attribute weight.

getWeightPrefix

public string getWeightPrefix()

Get the weight prefix.

Returns:
The weight prefix.

hasImage

public boolean hasImage()

Check if this value has an associated image.

Returns:
true if an image is available, false if not.

isDefault

public boolean isDefault()

Check if this is the default value.

Returns:
true if this is the default value, false if not.

isDiscounted

public boolean isDiscounted()

Check if this value is discounted.

Returns:
true if this value is discounted, false if not.

isDisplayOnly

public boolean isDisplayOnly()

Check if the attribute is 'display only'.

Returns:
true if the value is display only, false if not.

isFree

public boolean isFree()

Check if the attribute is free.

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

isIncludeInBasePrice

public boolean isIncludeInBasePrice()

Check if the base price is included.

Returns:
true if the base price is included, false if not.

isPriceFactorOneTime

public boolean isPriceFactorOneTime()

Check if the price factor is one time.

Returns:
true if the price factor is one time only, false if not.

setAttribute

public void setAttribute(ZMAttribute attribute)

Set the parent attribute.

Parameters:
attribute - The attribute.

setDefault

public void setDefault(boolean value)

Set the default value flag.

Parameters:
value - true if this is the default value, false if not.

setDiscounted

public void setDiscounted(boolean value)

Set the is discounted flag.

Parameters:
value - true if this value is discounted, false if not.

setDisplayOnly

public void setDisplayOnly(boolean value)

Set the attribute is 'display only' flag.

Parameters:
value - true if the value is display only, false if not.

setFree

public void setFree(boolean value)

Sheck the attribute free flag.

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

setId

public void setId(int id)

Set the attribute value id.

Parameters:
id - The attribute value id.

setImage

public void setImage(string image)

Set the attribute value image (if any).

Parameters:
image - The attribute value image name.

setIncludeInBasePrice

public void setIncludeInBasePrice(boolean value)

Set the base price is included flag.

Parameters:
value - true if the base price is included, false if not.

setName

public void setName(string name)

Set the attribute value name.

Parameters:
name - The attribute value name.

setOneTimePrice

public void setOneTimePrice(double oneTimePrice)

Set the values one time price.

Parameters:
oneTimePrice - The attributes one time price.

setPriceFactorOneTime

public void setPriceFactorOneTime(boolean value)

Set the price factor is one time flag.

Parameters:
value - true if the price factor is one time only, false if not.

setPricePrefix

public void setPricePrefix(string pricePrefix)

Set the price prefix.

Parameters:
pricePrefix - The price prefix.

setSortOrder

public void setSortOrder(int sortOrder)

Set the attribute value sort order.

Parameters:
sortOrder - The attribute sort order.

setTaxRate

public void setTaxRate(ZMTaxRate taxRate)

Set the tax rate.

Parameters:
taxRate - The tax rate.

setValuePrice

public void setValuePrice(double price)

Set the value price.

Parameters:
price - The price.

setWeight

public double setWeight(mixed weight)

Set the attribute weight.

Returns:
weight The attribute weight.

setWeightPrefix

public void setWeightPrefix(string weightPrefix)

Set the weight prefix.

Parameters:
weightPrefix - The weight prefix.

ZenMagick 0.9.6