ModelDiscounts module

ProductCondition

Product condition describes the conditions that need to be met for the discount to be applied; based on product quantity or price that is in the current cart.
Set "quantityTo" value to 0 to "exclude" the product from the cart; i.e. when the added product is in the cart, the discount is not applied.

A model in the Discounts module, with 21 members for templates, 18 API properties and 22 members for admin templates.

Discounts\Models\Frontend\ProductCondition Discounts\Models\Api\ProductCondition Discounts\Models\Backend\ProductCondition Also in Discounts: BaseAction CartAction CartCondition Code CodeUrl CodeUrlProduct CountryCondition DateCondition Discount Log MaxUsageCondition OrderCondition PersonCondition PersonGroupCondition ProductAction ProductCategoryCondition 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 21

Take no arguments.

# getProductIds()
array
Gets the product IDs for this condition.
# getQuantityFrom()
?int
Gets a minimum quantity of the product that needs to be in the cart to apply the discount.
# getQuantityTo()
?int
Gets a maximum quantity of the product that can be in the cart to apply the discount. Can be 0 to exclude the product from the cart.
# isAllowed()
bool
Checks if the condition set to allow a product. If is allowed when not forbidden.
# isForbidden()
bool
Checks if the condition set to forbid a product. It is forbidden when either "quantity to" or "amount to" are set to 0.
# getAmountFrom()
?string
Gets a minimum price amount of the product that needs to be in the cart to apply the discount.
# getAmountTo()
?string
Gets a maximum price amount of the product that can be in the cart to apply the discount.
# 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 18

Read-only values on the record.

# productIds
array
Gets the product IDs for this condition.
# quantityFrom
?int
Gets a minimum quantity of the product that needs to be in the cart to apply the discount.
# quantityTo
?int
Gets a maximum quantity of the product that can be in the cart to apply the discount. Can be 0 to exclude the product from the cart.
# allowed
bool
Checks if the condition set to allow a product. If is allowed when not forbidden.
# forbidden
bool
Checks if the condition set to forbid a product. It is forbidden when either "quantity to" or "amount to" are set to 0.
# amountFrom
?string
Gets a minimum price amount of the product that needs to be in the cart to apply the discount.
# amountTo
?string
Gets a maximum price amount of the product that can be in the cart to apply the discount.
# 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 22

Take no arguments.

# getProductIds()
array
Gets the product IDs for this condition.
# getQuantityFrom()
?int
Gets a minimum quantity of the product that needs to be in the cart to apply the discount.
# getQuantityTo()
?int
Gets a maximum quantity of the product that can be in the cart to apply the discount. Can be 0 to exclude the product from the cart.
# isAllowed()
bool
Checks if the condition set to allow a product. If is allowed when not forbidden.
# isForbidden()
bool
Checks if the condition set to forbid a product. It is forbidden when either "quantity to" or "amount to" are set to 0.
# getAmountFrom()
?string
Gets a minimum price amount of the product that needs to be in the cart to apply the discount.
# getAmountTo()
?string
Gets a maximum price amount of the product that can be in the cart to apply the discount.
# 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