ZenMagick 0.9.10


zenmagick.store.shared.model.catalog\ZMOffers
model\catalog\ZMOffers.php at line 33

Class ZMOffers

ZMObject
└─ZMOffers

public class ZMOffers
extends ZMObject

All stuff related to product prices and offers.

Author:
DerManoMann

Constant Summary
final static int

$DISCOUNT_FROM_BASE_PRICE

final static int

DISCOUNT_FROM_SPECIAL_PRICE

final static int

DISCOUNT_TYPE_AMOUNT

final static int

$DISCOUNT_TYPE_NONE

final static int

DISCOUNT_TYPE_PERCENT

final static int

DISCOUNT_TYPE_PRICE

final static int

$SALE_TYPE_AMOUNT

final static int

SALE_TYPE_PERCENT

final static int

SALE_TYPE_PRICE

Field Summary
protected mixed

$product_

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

__construct(ZMProduct product)

Create new instance.

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

Constant Detail

model\catalog\ZMOffers.php at line 44

DISCOUNT_FROM_BASE_PRICE

public final static int $DISCOUNT_FROM_BASE_PRICE

model\catalog\ZMOffers.php at line 45

DISCOUNT_FROM_SPECIAL_PRICE

public final static int DISCOUNT_FROM_SPECIAL_PRICE = 1

model\catalog\ZMOffers.php at line 43

DISCOUNT_TYPE_AMOUNT

public final static int DISCOUNT_TYPE_AMOUNT = 3

model\catalog\ZMOffers.php at line 40

DISCOUNT_TYPE_NONE

public final static int $DISCOUNT_TYPE_NONE

model\catalog\ZMOffers.php at line 41

DISCOUNT_TYPE_PERCENT

public final static int DISCOUNT_TYPE_PERCENT = 1

model\catalog\ZMOffers.php at line 42

DISCOUNT_TYPE_PRICE

public final static int DISCOUNT_TYPE_PRICE = 2

model\catalog\ZMOffers.php at line 35

SALE_TYPE_AMOUNT

public final static int $SALE_TYPE_AMOUNT

model\catalog\ZMOffers.php at line 36

SALE_TYPE_PERCENT

public final static int SALE_TYPE_PERCENT = 1

model\catalog\ZMOffers.php at line 37

SALE_TYPE_PRICE

public final static int SALE_TYPE_PRICE = 2

Field Detail

model\catalog\ZMOffers.php at line 47

product_

protected mixed $product_

Method Detail

model\catalog\ZMOffers.php at line 61

__construct

public void __construct(ZMProduct product)

Create new instance.

Parameters:
product - The product.

model\catalog\ZMOffers.php at line 422

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.

model\catalog\ZMOffers.php at line 275

calculatePrice

protected void calculatePrice()

Calculate the (best) price.


model\catalog\ZMOffers.php at line 136

doGetBasePrice

protected void doGetBasePrice()

Calculate the base price.


model\catalog\ZMOffers.php at line 198

doGetSalePrice

protected void doGetSalePrice()

Calculate the discount price.


model\catalog\ZMOffers.php at line 125

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.

model\catalog\ZMOffers.php at line 350

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.

model\catalog\ZMOffers.php at line 303

getDiscountAmount

public float getDiscountAmount()

Get the discount amount.

Returns:
The discount amount.

model\catalog\ZMOffers.php at line 296

getDiscountPercent

public float getDiscountPercent()

Get the discount as percent value.

Returns:
The discount in percent.

model\catalog\ZMOffers.php at line 113

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.

model\catalog\ZMOffers.php at line 368

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.

model\catalog\ZMOffers.php at line 187

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.

model\catalog\ZMOffers.php at line 171

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.

model\catalog\ZMOffers.php at line 320

getTaxRate

public float getTaxRate()

Get the tax rate for the product.

Returns:
The tax rate.

model\catalog\ZMOffers.php at line 86

isAttributePrice

public boolean isAttributePrice()

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

Returns:
true if attribute prices exist.

model\catalog\ZMOffers.php at line 340

isSale

public boolean isSale()

Checks if a sale price is available.

Returns:
true if a sale price is available.

model\catalog\ZMOffers.php at line 333

isSpecial

public boolean isSpecial()

Checks if a special price is available.

Returns:
true if a special price is available.

model\catalog\ZMOffers.php at line 103

setProduct

public void setProduct(ZMProduct product)

Set the product.

Parameters:
product - The product.

ZenMagick 0.9.10