class AbstractRemoveOnAttributeValues extends CouponAbstract implements AmountAndPercentageCouponInterface

The base class to process a discount related to Attribute values.

Constants

COUPON_DATASET_NAME

The dataset name for all coupon specific input fields, that do not appear in the CouPonCreationForm form.

In the input form, these fields have to be created like:

theliacouponspecific[myfield, theliacouponcreationextended[myotherfield]

use the makeCouponField() method to do that safely.

AMOUNT_FIELD_NAME

A standard 'amount' filed name, thant can be used in coupons which extends this class

ATTRIBUTES_AV_LIST

ATTRIBUTE

Properties

$attributeAvList
$attribute

Methods

__construct( FacadeInterface $facade)

Constructor

$this
setOrganizer( ConditionOrganizerInterface $organizer)

Set Condition Organizer

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)

No description

$this
setPerCustomerUsageCount( true $perCustomerUsageCount)

No description

boolean
getPerCustomerUsageCount()

No description

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

ObjectCollection
getFreeShippingForCountries()

No description

ObjectCollection
getFreeShippingForModules()

No description

float
exec()

No description

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
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

string
getServiceId()

Get Coupon Manager service Id

bool
isMatching()

Check if the current state of the application is matching this Coupon conditions Thelia variables are given by the FacadeInterface

string
getInputName()

This is the field label than will be displayed in the form.

string
drawBackOfficeInputs()

Draw the input displayed in the BackOffice allowing Admin to set its Coupon effect Override this method to do something useful

array
getEffects( array $data)

Create the effect array from the list of fields

clear()

No description

bool
isInUse()

No description

setFieldsValue( Array $effects)

Set the value of specific coupon fields.

float
getCartItemDiscount( CartItem $cartItem)

Get the discount for a specific cart item.

string
drawBaseBackOfficeInputs( string $templateName, array $otherFields)

Renders the template which implements coupon specific user-input, using the provided template file, and a list of specific input fields.

getBaseFieldList($otherFields)

No description

checkBaseCouponFieldValue($fieldName, $fieldValue)

No description

Details

in CouponAbstract at line 120
__construct( FacadeInterface $facade)

Constructor

Parameters

FacadeInterface $facade Service facade

in CouponAbstract at line 134
$this setOrganizer( ConditionOrganizerInterface $organizer)

Set Condition Organizer

Parameters

ConditionOrganizerInterface $organizer Manage Condition groups (&& and ||)

Return Value

$this

at line 51
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)

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

in CouponAbstract at line 190
$this setPerCustomerUsageCount( true $perCustomerUsageCount)

Parameters

true $perCustomerUsageCount

Return Value

$this

in CouponAbstract at line 200
boolean getPerCustomerUsageCount()

Return Value

boolean

in CouponAbstract at line 210
string getCode()

Return Coupon code (ex: XMAS)

Return Value

string

in CouponAbstract at line 220
string getTitle()

Return Coupon title (ex: Coupon for XMAS)

Return Value

string

in CouponAbstract at line 230
string getShortDescription()

Return Coupon short description

Return Value

string

in CouponAbstract at line 240
string getDescription()

Return Coupon description

Return Value

string

in CouponAbstract at line 252
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

in CouponAbstract at line 262
bool isRemovingPostage()

If Coupon is removing Checkout Postage

Return Value

bool

in CouponAbstract at line 270
ObjectCollection getFreeShippingForCountries()

Return Value

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

in CouponAbstract at line 278
ObjectCollection getFreeShippingForModules()

Return Value

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

at line 102
float exec()

Return Value

float Amount removed from the cart total

in CouponAbstract at line 296
ConditionCollection getConditions()

Return condition to validate the Coupon or not

Return Value

ConditionCollection A set of ConditionInterface

in CouponAbstract at line 310
$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

in CouponAbstract at line 322
DateTime getExpirationDate()

Return Coupon expiration date

Return Value

DateTime

in CouponAbstract at line 333
boolean isAvailableOnSpecialOffers()

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

Return Value

boolean

in CouponAbstract at line 343
boolean isEnabled()

Check if Coupon has been disabled by admin

Return Value

boolean

in CouponAbstract at line 354
int getMaxUsage()

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

Return Value

int

in CouponAbstract at line 364
bool isExpired()

Check if the Coupon is already Expired

Return Value

bool

in CouponAbstract at line 381
string getServiceId()

Get Coupon Manager service Id

Return Value

string

in CouponAbstract at line 392
bool isMatching()

Check if the current state of the application is matching this Coupon conditions Thelia variables are given by the FacadeInterface

Return Value

bool

in CouponAbstract at line 405
string getInputName()

This is the field label than will be displayed in the form.

This method should be overridden to be useful.

For backward compatibility only.

Return Value

string

in CouponAbstract at line 417
string drawBackOfficeInputs()

Draw the input displayed in the BackOffice allowing Admin to set its Coupon effect Override this method to do something useful

Return Value

string HTML string

in CouponAbstract at line 495
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

in CouponAbstract at line 509
clear()

in CouponAbstract at line 514
bool isInUse()

Return Value

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

at line 38
abstract setFieldsValue( Array $effects)

Set the value of specific coupon fields.

Parameters

Array $effects the Coupon effects params

at line 46
abstract float getCartItemDiscount( CartItem $cartItem)

Get the discount for a specific cart item.

Parameters

CartItem $cartItem the cart item

Return Value

float the discount value

at line 142
string drawBaseBackOfficeInputs( string $templateName, array $otherFields)

Renders the template which implements coupon specific user-input, using the provided template file, and a list of specific input fields.

Parameters

string $templateName the path to the template
array $otherFields the list of additional fields fields

Return Value

string the rendered template.

at line 159
getBaseFieldList($otherFields)

Parameters

$otherFields

at line 167
checkBaseCouponFieldValue($fieldName, $fieldValue)

Parameters

$fieldName
$fieldValue