ZenMagick 0.9.8


org.zenmagick.store.model.catalog.ZMOffers
\store\model\catalog\ZMOffers.php at line 34

Class ZMOffers

ZMObject
└─ZMOffers

public class ZMOffers
extends ZMObject

All stuff related to product prices and offers.

Author:
DerManoMann
Version:
$Id: ZMOffers.php 2694 2009-12-03 22:32:18Z dermanomann $

Field Summary
final int

$DISCOUNT_FROM_BASE_PRICE

final int

DISCOUNT_FROM_SPECIAL_PRICE

final int

DISCOUNT_TYPE_AMOUNT

final int

$DISCOUNT_TYPE_NONE

final int

DISCOUNT_TYPE_PERCENT

final int

DISCOUNT_TYPE_PRICE

final int

$SALE_TYPE_AMOUNT

final int

SALE_TYPE_PERCENT

final int

SALE_TYPE_PRICE

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

ZMOffers(ZMProduct product)

Create new instance.

Method Summary
float

calculateDiscount(float amount)

Calculate discount for either product or the given amount (for example to calculate discounts on attributes).

protected void

calculatePrice()

Calculate the (best) price.

protected void

doGetBasePrice()

Calculate the base price.

protected void

doGetSalePrice()

Calculate the discount price.

float

getBasePrice(boolean tax)

Get the base price; this is the lowest possible product price.

float

getCalculatedPrice(boolean tax)

Get the calculated price.

float

getDiscountAmount()

Get the discount amount.

float

getDiscountPercent()

Get the discount as percent value.

float

getProductPrice(boolean tax)

Get the product price.

array

getQuantityDiscounts(boolean tax)

Get quantity discounts, if any.

float

getSalePrice(boolean tax)

Get the discount price.

float

getSpecialPrice(boolean tax)

Get the special price.

float

getTaxRate()

Get the tax rate for the product.

boolean

isAttributePrice()

Checks if there are attribute prices that will affect the final price.

boolean

isSale()

Checks if a sale price is available.

boolean

isSpecial()

Checks if a special price is available.

void

setProduct(ZMProduct product)

Set the product.

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

Field Detail

\store\model\catalog\ZMOffers.php at line 45

DISCOUNT_FROM_BASE_PRICE

public final int $DISCOUNT_FROM_BASE_PRICE

\store\model\catalog\ZMOffers.php at line 46

DISCOUNT_FROM_SPECIAL_PRICE

public final int DISCOUNT_FROM_SPECIAL_PRICE = 1

\store\model\catalog\ZMOffers.php at line 44

DISCOUNT_TYPE_AMOUNT

public final int DISCOUNT_TYPE_AMOUNT = 3

\store\model\catalog\ZMOffers.php at line 41

DISCOUNT_TYPE_NONE

public final int $DISCOUNT_TYPE_NONE

\store\model\catalog\ZMOffers.php at line 42

DISCOUNT_TYPE_PERCENT

public final int DISCOUNT_TYPE_PERCENT = 1

\store\model\catalog\ZMOffers.php at line 43

DISCOUNT_TYPE_PRICE

public final int DISCOUNT_TYPE_PRICE = 2

\store\model\catalog\ZMOffers.php at line 36

SALE_TYPE_AMOUNT

public final int $SALE_TYPE_AMOUNT

\store\model\catalog\ZMOffers.php at line 37

SALE_TYPE_PERCENT

public final int SALE_TYPE_PERCENT = 1

\store\model\catalog\ZMOffers.php at line 38

SALE_TYPE_PRICE

public final int SALE_TYPE_PRICE = 2

Constructor Detail

\store\model\catalog\ZMOffers.php at line 62

ZMOffers

public ZMOffers(ZMProduct product)

Create new instance.

Parameters:
product - The product.

Method Detail

\store\model\catalog\ZMOffers.php at line 423

calculateDiscount

public float calculateDiscount(float amount)

Calculate discount for either product or the given amount (for example to calculate discounts on attributes).

Parameters:
amount - Optional amount; default is null to calculate the discount of the product price.
Returns:
The discounted amount.

\store\model\catalog\ZMOffers.php at line 276

calculatePrice

protected void calculatePrice()

Calculate the (best) price.


\store\model\catalog\ZMOffers.php at line 137

doGetBasePrice

protected void doGetBasePrice()

Calculate the base price.


\store\model\catalog\ZMOffers.php at line 199

doGetSalePrice

protected void doGetSalePrice()

Calculate the discount price.


\store\model\catalog\ZMOffers.php at line 126

getBasePrice

public float getBasePrice(boolean tax)

Get the base price; this is the lowest possible product price.

The base price consists of the product price plus the lowest attribute price (if any).

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

\store\model\catalog\ZMOffers.php at line 351

getCalculatedPrice

public float getCalculatedPrice(boolean tax)

Get the calculated price.

This is the actual price, taking into account if sale or discount are available.

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

\store\model\catalog\ZMOffers.php at line 304

getDiscountAmount

public float getDiscountAmount()

Get the discount amount.

Returns:
The discount amount.

\store\model\catalog\ZMOffers.php at line 297

getDiscountPercent

public float getDiscountPercent()

Get the discount as percent value.

Returns:
The discount in percent.

\store\model\catalog\ZMOffers.php at line 114

getProductPrice

public float getProductPrice(boolean tax)

Get the product price.

This is the price as configured in the database.

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

\store\model\catalog\ZMOffers.php at line 369

getQuantityDiscounts

public array getQuantityDiscounts(boolean tax)

Get quantity discounts, if any.

Parameters:
tax - Set to true to include tax (if applicable); default is true.
Returns:
A list of ZMQuantityDiscount instances.

\store\model\catalog\ZMOffers.php at line 188

getSalePrice

public float getSalePrice(boolean tax)

Get the discount price.

This price is the price as set up with the sales maker in the admin interface.

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

\store\model\catalog\ZMOffers.php at line 172

getSpecialPrice

public float getSpecialPrice(boolean tax)

Get the special price.

Special price as configured.

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

\store\model\catalog\ZMOffers.php at line 321

getTaxRate

public float getTaxRate()

Get the tax rate for the product.

Returns:
The tax rate.

\store\model\catalog\ZMOffers.php at line 87

isAttributePrice

public boolean isAttributePrice()

Checks if there are attribute prices that will affect the final price.

Returns:
true if attribute prices exist.

\store\model\catalog\ZMOffers.php at line 341

isSale

public boolean isSale()

Checks if a sale price is available.

Returns:
true if a sale price is available.

\store\model\catalog\ZMOffers.php at line 334

isSpecial

public boolean isSpecial()

Checks if a special price is available.

Returns:
true if a special price is available.

\store\model\catalog\ZMOffers.php at line 104

setProduct

public void setProduct(ZMProduct product)

Set the product.

Parameters:
product - The product.

ZenMagick 0.9.8