class PriceRule extends AbstractPriceRule

Class PriceRule

Properties

int $id from AbstractModel
static Dispatcher[] $conditionDispatcher from AbstractRule
static Dispatcher[] $actionDispatcher from AbstractRule
static string $type
string $name from AbstractRule
array $conditions from AbstractRule
array $actions from AbstractRule
string $label
string $code
string $description
bool $active
bool $highlight
int $usagePerVoucherCode
boolean $useMultipleVoucherCodes

Methods

static  null|AbstractModel
getById($id)

Get Range by id.

static  boolean
isMultiShop()

No description

static  boolean
isMultiShopFK()

No description

static  AbstractModel
create()

Create new instance of Pimcore Object.

static  AbstractModel|null
getByShopId($id, null $shopId = null)

No description

static  null|AbstractModel
getByField( string $field, string $value, int $shopId = null)

Get Range by id.

static  AbstractListing
getList()

get listing class.

static  AbstractModel[]
getAll()

Get all objects form this type.

int
getId()

No description

setId( int $id)

No description

string
getCacheKey()

No description

save()

save model to database.

bool
delete()

delete model.

getLocalizedFields()

Get LocalizedFields Provider.

setLocalizedFields($localizedFields)

Get LocalizedFields Provider.

AbstractModel
setValue($key, $value)

Override setValue function to support localized fields.

string
__toString()

No description

array
__sleep()

Prepare object to goto sleep.

__wakeup()

Prepare object to wakeup.

array
prepareActions($actions)

No description

mixed
prepareConditions($conditions)

No description

static  Dispatcher
getConditionDispatcher()

No description

static  Dispatcher
getActionDispatcher()

No description

static  string
getType()

No description

getMyConditionDispatcher()

No description

getMyActionDispatcher()

get action dispatcher for instance of type

array
serialize()

No description

string
getName()

No description

setName( string $name)

No description

getConditions()

No description

setConditions( AbstractCondition[] $conditions)

No description

getActions()

No description

setActions( AbstractAction[] $actions)

No description

static 
addCondition($condition)

No description

static 
addAction($action)

No description

static  PriceRule|null
getByCode($code)

Get PriceRule by Code.

static  array
getPricingRules()

Get al PriceRules.

static  array
getHighlightItems( Cart $cart)

Get public PriceRules.

static 
autoRemoveFromCart( Cart $cart)

Remove default PriceRule from Cart.

static  bool
autoAddToCart( Cart $cart)

Add default PriceRule to Cart.

static  int
getTotalUsesForPriceRule( PriceRule $priceRule, $voucherCode = null)

No description

bool
checkValidity( Cart $cart, string $voucherCode = null, bool|false $throwException = false, bool|false $alreadyInCart = false)

Check if PriceRule is Valid for Cart.

applyRules( Cart $cart)

Applies Rules to Cart.

unApplyRules( Cart $cart)

Removes Rules from Cart.

applyOrder( Order $order, Item $item)

apply price rule on order

unApplyOrder( Order $order, Item $item)

un apply price rule on order

int
getDiscount( Cart $cart, boolean $withTax = true)

Get Discount for PriceRule.

getVoucherCodes()

No description

string
getLabel()

No description

setLabel( string $label)

No description

string
getDescription()

No description

setDescription( string $description)

No description

bool
getActive()

No description

setActive( bool $active)

No description

string
getCode()

No description

setCode( string $code)

No description

bool
getHighlight()

No description

setHighlight( bool $highlight)

No description

int
getUsagePerVoucherCode()

No description

setUsagePerVoucherCode( int $usagePerVoucherCode)

No description

boolean
getUseMultipleVoucherCodes()

No description

setUseMultipleVoucherCodes( boolean $useMultipleVoucherCodes)

No description

Details

in AbstractModel at line line 72
static null|AbstractModel getById($id)

Get Range by id.

Parameters

$id

Return Value

null|AbstractModel

in AbstractModel at line line 80
static boolean isMultiShop()

Return Value

boolean

in AbstractModel at line line 94
static boolean isMultiShopFK()

Return Value

boolean

in AbstractModel at line line 112
static AbstractModel create()

Create new instance of Pimcore Object.

Return Value

AbstractModel

Exceptions

Exception

in AbstractModel at line line 122
static AbstractModel|null getByShopId($id, null $shopId = null)

Parameters

$id
null $shopId

Return Value

AbstractModel|null

in AbstractModel at line line 170
static null|AbstractModel getByField( string $field, string $value, int $shopId = null)

Get Range by id.

Parameters

string $field
string $value
int $shopId

Return Value

null|AbstractModel

in AbstractModel at line line 223
static AbstractListing getList()

get listing class.

Return Value

AbstractListing

Exceptions

Exception

in AbstractModel at line line 243
static AbstractModel[] getAll()

Get all objects form this type.

Return Value

AbstractModel[]

in AbstractModel at line line 253
int getId()

Return Value

int

in AbstractModel at line line 261
setId( int $id)

Parameters

int $id

in AbstractModel at line line 269
string getCacheKey()

Return Value

string

in AbstractModel at line line 277
save()

save model to database.

in AbstractModel at line line 294
bool delete()

delete model.

Return Value

bool

in AbstractModel at line line 310
LocalizedFields|null getLocalizedFields()

Get LocalizedFields Provider.

Return Value

LocalizedFields|null

in AbstractModel at line line 329
setLocalizedFields($localizedFields)

Get LocalizedFields Provider.

Parameters

$localizedFields

in AbstractModel at line line 342
AbstractModel setValue($key, $value)

Override setValue function to support localized fields.

Parameters

$key
$value

Return Value

AbstractModel

at line line 561
string __toString()

Return Value

string

in AbstractModel at line line 370
array __sleep()

Prepare object to goto sleep.

Return Value

array

in AbstractModel at line line 390
__wakeup()

Prepare object to wakeup.

in AbstractRule at line line 67
array prepareActions($actions)

Parameters

$actions

Return Value

array

Exceptions

Exception

in AbstractRule at line line 93
mixed prepareConditions($conditions)

Parameters

$conditions

Return Value

mixed

Exceptions

Exception

in AbstractRule at line line 121
static Dispatcher getConditionDispatcher()

Return Value

Dispatcher

in AbstractRule at line line 137
static Dispatcher getActionDispatcher()

Return Value

Dispatcher

in AbstractRule at line line 167
static string getType()

Return Value

string

in AbstractRule at line line 185
getMyConditionDispatcher()

in AbstractRule at line line 194
Dispatcher getMyActionDispatcher()

get action dispatcher for instance of type

Return Value

Dispatcher

in AbstractRule at line line 201
array serialize()

Return Value

array

in AbstractRule at line line 226
string getName()

Return Value

string

in AbstractRule at line line 234
setName( string $name)

Parameters

string $name

in AbstractRule at line line 242
AbstractCondition[] getConditions()

Return Value

AbstractCondition[]

in AbstractRule at line line 250
setConditions( AbstractCondition[] $conditions)

Parameters

AbstractCondition[] $conditions

in AbstractRule at line line 258
AbstractAction[] getActions()

Return Value

AbstractAction[]

in AbstractRule at line line 266
setActions( AbstractAction[] $actions)

Parameters

AbstractAction[] $actions

at line line 81
static addCondition($condition)

Parameters

$condition

at line line 93
static addAction($action)

Parameters

$action

at line line 142
static PriceRule|null getByCode($code)

Get PriceRule by Code.

Parameters

$code

Return Value

PriceRule|null

at line line 168
static array getPricingRules()

Get al PriceRules.

Return Value

array

at line line 182
static array getHighlightItems( Cart $cart)

Get public PriceRules.

Parameters

Cart $cart

Return Value

array

at line line 222
static autoRemoveFromCart( Cart $cart)

Remove default PriceRule from Cart.

Parameters

Cart $cart

at line line 242
static bool autoAddToCart( Cart $cart)

Add default PriceRule to Cart.

Parameters

Cart $cart

Return Value

bool

at line line 270
static int getTotalUsesForPriceRule( PriceRule $priceRule, $voucherCode = null)

Parameters

PriceRule $priceRule
$voucherCode

Return Value

int

at line line 305
bool checkValidity( Cart $cart, string $voucherCode = null, bool|false $throwException = false, bool|false $alreadyInCart = false)

Check if PriceRule is Valid for Cart.

Parameters

Cart $cart
string $voucherCode
bool|false $throwException
bool|false $alreadyInCart

Return Value

bool

Exceptions

Exception

at line line 355
applyRules( Cart $cart)

Applies Rules to Cart.

Parameters

Cart $cart

at line line 369
unApplyRules( Cart $cart)

Removes Rules from Cart.

Parameters

Cart $cart

at line line 384
applyOrder( Order $order, Item $item)

apply price rule on order

Parameters

Order $order
Item $item

at line line 401
unApplyOrder( Order $order, Item $item)

un apply price rule on order

Parameters

Order $order
Item $item

at line line 420
int getDiscount( Cart $cart, boolean $withTax = true)

Get Discount for PriceRule.

Parameters

Cart $cart
boolean $withTax

Return Value

int

at line line 438
VoucherCode[] getVoucherCodes()

Return Value

VoucherCode[]

at line line 449
string getLabel()

Return Value

string

at line line 457
setLabel( string $label)

Parameters

string $label

at line line 465
string getDescription()

Return Value

string

at line line 473
setDescription( string $description)

Parameters

string $description

at line line 481
bool getActive()

Return Value

bool

at line line 489
setActive( bool $active)

Parameters

bool $active

at line line 497
string getCode()

Return Value

string

at line line 505
setCode( string $code)

Parameters

string $code

at line line 513
bool getHighlight()

Return Value

bool

at line line 521
setHighlight( bool $highlight)

Parameters

bool $highlight

at line line 529
int getUsagePerVoucherCode()

Return Value

int

at line line 537
setUsagePerVoucherCode( int $usagePerVoucherCode)

Parameters

int $usagePerVoucherCode

at line line 545
boolean getUseMultipleVoucherCodes()

Return Value

boolean

at line line 553
setUseMultipleVoucherCodes( boolean $useMultipleVoucherCodes)

Parameters

boolean $useMultipleVoucherCodes