ModelDiscounts module

Discount

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

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.

# getCodesCount()
int
Returns the total count of the codes assigned to the discount.
# getId()
?int
# getName()
?string
# getPosition()
?int
# isFinal()
bool
Once the discount is applied, further discounts will not be considered
# getMaxUses()
?int
The maximum number of times the discount can be used. The discount is considered used when a checkout is created with it. It stays used when an order is placed. Canceled orders, requested refunds, etc. do not cancel the fact of the usage.
# getCreated()
?DateTime
Date the record was created.
# getModified()
?DateTime
Last modification date for the record.
# getFrom()
?DateTime
Start date for discount availability, not applied prior to this date. If not set, the discount is available immediately.
# getTo()
?DateTime
End date for discount availability, not applied after this date. If not set, the discount does not expire.
# getSite()
?Site
# getRules()
?Collection<Rule>
# getCodes()
?Collection<Code>
# 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

Methods 1

Take arguments. The API serialises only getters that need none.

# hasAnyAssociatedCodeByList(array $codes)
bool
Checks if the discount has assigned any code of the provided list.

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.

# codesCount
int
Returns the total count of the codes assigned to the discount.
# id
?int
# name
?string
# position
?int
# final
bool
Once the discount is applied, further discounts will not be considered
# maxUses
?int
The maximum number of times the discount can be used. The discount is considered used when a checkout is created with it. It stays used when an order is placed. Canceled orders, requested refunds, etc. do not cancel the fact of the usage.
# created
?DateTime
Date the record was created.
# modified
?DateTime
Last modification date for the record.
# from
?DateTime
Start date for discount availability, not applied prior to this date. If not set, the discount is available immediately.
# to
?DateTime
End date for discount availability, not applied after this date. If not set, the discount does not expire.
# site
?Site
# rules
?Collection<Rule>
# codes
?Collection<Code>

Admin view

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

Properties 23

Take no arguments.

# getCodesCount()
int
Returns the total count of the codes assigned to the discount.
# getId()
?int
# getName()
?string
# getPosition()
?int
# isFinal()
bool
Once the discount is applied, further discounts will not be considered
# getMaxUses()
?int
The maximum number of times the discount can be used. The discount is considered used when a checkout is created with it. It stays used when an order is placed. Canceled orders, requested refunds, etc. do not cancel the fact of the usage.
# getCreated()
?DateTime
Date the record was created.
# getModified()
?DateTime
Last modification date for the record.
# getFrom()
?DateTime
Start date for discount availability, not applied prior to this date. If not set, the discount is available immediately.
# getTo()
?DateTime
End date for discount availability, not applied after this date. If not set, the discount does not expire.
# getSite()
?Site
# getRules()
?Collection<Rule>
# getCodes()
?Collection<Code>
# 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
# getCodesCountDisplay() Admin only
string
Returns a display codes count value, either "auto" or "code" with count value
# getEditUrl() Admin only
?string
Get the url for editing the record.
# getDeleteUrl() Admin only
?string
Get the url for deleting the record.
# getManageUrl() Admin only
?string
Get the url for managing records.
# getMoveUrl() Admin only
?string
Get the url for moving the record.

Methods 1

Take arguments. The API serialises only getters that need none.

# hasAnyAssociatedCodeByList(array $codes)
bool
Checks if the discount has assigned any code of the provided list.