ModelDiscounts module

MaxUsageCondition

Max usage condition describes the conditions that need to be met for the discount to be applied; based on usage quantity (for the current discount) or total discount price (in discount logs).
Applies to the current user. There are no "from/to" fields as they don't make sense.
The amount value is the discounted price amount.
If a discount gives $30 off, and the amount in this condition is set to $100, a user could use $30 + $30 + $30 = $90 (which is clear). However, then there is no restriction for the discounted price (because the action is responsible for that, not a condition),
and the condition for the 4th time is $90 < $100 => allow applying. Thus, the resulting total discount will be 30 + $30 + $30 + $30 = $120 with no further following applies.

A model in the Discounts module, with 16 members for templates, 13 API properties and 17 members for admin templates.

Discounts\Models\Frontend\MaxUsageCondition Discounts\Models\Api\MaxUsageCondition Discounts\Models\Backend\MaxUsageCondition Also in Discounts: BaseAction CartAction CartCondition Code CodeUrl CodeUrlProduct CountryCondition DateCondition Discount Log OrderCondition PersonCondition PersonGroupCondition ProductAction ProductCategoryCondition ProductCondition Rule ShippingAction TemplateCondition
View
What Smarty and Twig templates receive. Properties in REST API responses and job payloads. What admin screen templates receive when you override them.

Templates view

Properties 16

Take no arguments.

# getQuantity()
?int
Gets a maximum number of usages (the set value is included) that can be applied for the discount to remain active. Checks for the current user.
# getAmount()
?string
Gets a maximum total discounted price provided (the set value is included) that can be used for the discount to remain active (for the current user).
# getDisplayType()
string
Returns the nice name of a condition type
# getType()
string
Returns the type of condition
# getSnakeType()
string
Returns the type of condition in the snake case format: lowercase and connected by underline
# getSlugType()
string
Returns the type of condition in the slug format: lowercase and connected by hyphen
# getId()
?int
# getName()
?string
# getData()
?array
# isActive()
bool
# getCreated()
?DateTime
Date the record was created.
# getModified()
?DateTime
Last modification date for the record.
# getRule()
?Rule
# isNewRecord() Not in API & Jobs
bool
Check if the record is a new record
# isHierarchicalModel() Not in API & Jobs
bool
Check whether a model is a hierarchical model, i.e. can have children
# isVersionedModel() Not in API & Jobs
bool
Check whether a model is versioned

API & Jobs view

API & JobsEach property is a key in REST API responses and job payloads. Its name is the template getter without get, is or has. Methods that need arguments are not available here.

Properties 13

Read-only values on the record.

# quantity
?int
Gets a maximum number of usages (the set value is included) that can be applied for the discount to remain active. Checks for the current user.
# amount
?string
Gets a maximum total discounted price provided (the set value is included) that can be used for the discount to remain active (for the current user).
# displayType
string
Returns the nice name of a condition type
# type
string
Returns the type of condition
# snakeType
string
Returns the type of condition in the snake case format: lowercase and connected by underline
# slugType
string
Returns the type of condition in the slug format: lowercase and connected by hyphen
# id
?int
# name
?string
# data
?array
# active
bool
# created
?DateTime
Date the record was created.
# modified
?DateTime
Last modification date for the record.
# rule
?Rule

Admin view

AdminAvailable in cdna-admin templates. Copy an admin template into your site repository to change how this record is edited.

Properties 17

Take no arguments.

# getQuantity()
?int
Gets a maximum number of usages (the set value is included) that can be applied for the discount to remain active. Checks for the current user.
# getAmount()
?string
Gets a maximum total discounted price provided (the set value is included) that can be used for the discount to remain active (for the current user).
# getDisplayType()
string
Returns the nice name of a condition type
# getType()
string
Returns the type of condition
# getSnakeType()
string
Returns the type of condition in the snake case format: lowercase and connected by underline
# getSlugType()
string
Returns the type of condition in the slug format: lowercase and connected by hyphen
# getId()
?int
# getName()
?string
# getData()
?array
# isActive()
bool
# getCreated()
?DateTime
Date the record was created.
# getModified()
?DateTime
Last modification date for the record.
# getRule()
?Rule
# isNewRecord() Not in API & Jobs
bool
Check if the record is a new record
# isHierarchicalModel() Not in API & Jobs
bool
Check whether a model is a hierarchical model, i.e. can have children
# isVersionedModel() Not in API & Jobs
bool
Check whether a model is versioned
# getIcon() Admin only
string
Returns the icon that represents the type