interface CouponInterface

Represents a Coupon ready to be processed in a Checkout process

Methods

string
getName()

Get I18n name

string
getToolTip()

Get I18n tooltip

string
getServiceId()

Get Coupon Manager service Id

set( FacadeInterface $facade, string $code, string $title, string $shortDescription, string $description, array $effects, bool $isCumulative, bool $isRemovingPostage, bool $isAvailableOnSpecialOffers, bool $isEnabled, int $maxUsage, DateTime $expirationDate, ObjectCollection $freeShippingForCountries, ObjectCollection $freeShippingForModules, bool $perCustomerUsageCount)

Set Coupon

string
getCode()

Return Coupon code (ex: XMAS)

string
getTitle()

Return Coupon title (ex: Coupon for XMAS)

string
getShortDescription()

Return Coupon short description

string
getDescription()

Return Coupon description

bool
isCumulative()

If Coupon is cumulative or prevent any accumulation If is cumulative you can sum Coupon effects If not cancel all other Coupon and take the last given

bool
isRemovingPostage()

If Coupon is removing Checkout Postage

getConditions()

Return condition to validate the Coupon or not

$this
setConditions( ConditionCollection $conditions)

Replace the existing Conditions by those given in parameter If one Condition is badly implemented, no Condition will be added

getExpirationDate()

Return Coupon expiration date

boolean
isAvailableOnSpecialOffers()

Check if the Coupon can be used against a product already with a special offer price

boolean
getPerCustomerUsageCount()

Check if the Coupon can be used against a product already with a special offer price

boolean
isEnabled()

Check if Coupon has been disabled by admin

int
getMaxUsage()

Return how many time the Coupon can be used again Ex : -1 unlimited

bool
isExpired()

Check if the Coupon is already Expired

float
exec()

Return an amount thant will be subtracted to the cart total, or zero.

bool
isMatching()

Check if the current Coupon is matching its conditions Thelia variables are given by the FacadeInterface

string
drawBackOfficeInputs()

Draw the input displayed in the BackOffice allowing Admin to set its Coupon effect

ObjectCollection
getFreeShippingForCountries()

No description

ObjectCollection
getFreeShippingForModules()

No description

array
getEffects( array $data)

Create the effect array from the list of fields

clear()

Clear all the data the coupon may have stored, called after an order is completed.

bool
isInUse()

No description

Details

at line 33
string getName()

Get I18n name

Return Value

string

at line 40
string getToolTip()

Get I18n tooltip

Return Value

string

at line 47
string getServiceId()

Get Coupon Manager service Id

Return Value

string

at line 69
set( FacadeInterface $facade, string $code, string $title, string $shortDescription, string $description, array $effects, bool $isCumulative, bool $isRemovingPostage, bool $isAvailableOnSpecialOffers, bool $isEnabled, int $maxUsage, DateTime $expirationDate, ObjectCollection $freeShippingForCountries, ObjectCollection $freeShippingForModules, bool $perCustomerUsageCount)

Set Coupon

Parameters

FacadeInterface $facade Provides necessary value from Thelia
string $code Coupon code (ex: XMAS)
string $title Coupon title (ex: Coupon for XMAS)
string $shortDescription Coupon short description
string $description Coupon description
array $effects Coupon effects params
bool $isCumulative If Coupon is cumulative
bool $isRemovingPostage If Coupon is removing postage
bool $isAvailableOnSpecialOffers If available on Product already on special offer price
bool $isEnabled False if Coupon is disabled by admin
int $maxUsage How many usage left
DateTime $expirationDate When the Code is expiring
ObjectCollection $freeShippingForCountries list of countries which shipping is free. All if empty
ObjectCollection $freeShippingForModules list of modules for which shipping is free. All if empty
bool $perCustomerUsageCount true if usage count is per customer only

at line 92
string getCode()

Return Coupon code (ex: XMAS)

Return Value

string

at line 99
string getTitle()

Return Coupon title (ex: Coupon for XMAS)

Return Value

string

at line 106
string getShortDescription()

Return Coupon short description

Return Value

string

at line 113
string getDescription()

Return Coupon description

Return Value

string

at line 122
bool isCumulative()

If Coupon is cumulative or prevent any accumulation If is cumulative you can sum Coupon effects If not cancel all other Coupon and take the last given

Return Value

bool

at line 129
bool isRemovingPostage()

If Coupon is removing Checkout Postage

Return Value

bool

at line 136
ConditionCollection getConditions()

Return condition to validate the Coupon or not

Return Value

ConditionCollection A set of ConditionInterface

at line 147
$this setConditions( ConditionCollection $conditions)

Replace the existing Conditions by those given in parameter If one Condition is badly implemented, no Condition will be added

Parameters

ConditionCollection $conditions ConditionInterface to add

Return Value

$this

Exceptions

InvalidConditionException

at line 154
DateTime getExpirationDate()

Return Coupon expiration date

Return Value

DateTime

at line 162
boolean isAvailableOnSpecialOffers()

Check if the Coupon can be used against a product already with a special offer price

Return Value

boolean

at line 170
boolean getPerCustomerUsageCount()

Check if the Coupon can be used against a product already with a special offer price

Return Value

boolean

at line 177
boolean isEnabled()

Check if Coupon has been disabled by admin

Return Value

boolean

at line 185
int getMaxUsage()

Return how many time the Coupon can be used again Ex : -1 unlimited

Return Value

int

at line 192
bool isExpired()

Check if the Coupon is already Expired

Return Value

bool

at line 205
float exec()

Return an amount thant will be subtracted to the cart total, or zero.

This method could also perform something else than the calculating an amount to subtract from the cart. It may add a product to the cart, for example. In this case, an amount of 0 will be returned.

WARNING: this method could be called several times, so perform suitable checks before performing cart manipulations, so that the coupon effect will not be applied several times.

Return Value

float Amount removed from the cart total

at line 213
bool isMatching()

Check if the current Coupon is matching its conditions Thelia variables are given by the FacadeInterface

Return Value

bool

at line 221
string drawBackOfficeInputs()

Draw the input displayed in the BackOffice allowing Admin to set its Coupon effect

Return Value

string HTML string

at line 226
ObjectCollection getFreeShippingForCountries()

Return Value

ObjectCollection list of country IDs for which shipping is free. All if empty

at line 231
ObjectCollection getFreeShippingForModules()

Return Value

ObjectCollection list of module IDs for which shipping is free. All if empty

at line 240
array getEffects( array $data)

Create the effect array from the list of fields

Parameters

array $data the input form data (e.g. $form->getData())

Return Value

array a filedName => fieldValue array

at line 245
clear()

Clear all the data the coupon may have stored, called after an order is completed.

at line 250
bool isInUse()

Return Value

bool true if the coupon is currently in use in the current order process, false otherwise