Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
setRule (\Magento\SalesRule\Model\Rule $rule) | |
loadPrimaryByRule ($rule) | |
loadByCode ($couponCode) | |
getCouponId () | |
setCouponId ($couponId) | |
getRuleId () | |
setRuleId ($ruleId) | |
getCode () | |
setCode ($code) | |
getUsageLimit () | |
setUsageLimit ($usageLimit) | |
getUsagePerCustomer () | |
setUsagePerCustomer ($usagePerCustomer) | |
getTimesUsed () | |
setTimesUsed ($timesUsed) | |
getExpirationDate () | |
setExpirationDate ($expirationDate) | |
getIsPrimary () | |
setIsPrimary ($isPrimary) | |
getCreatedAt () | |
setCreatedAt ($createdAt) | |
getType () | |
setType ($type) | |
getExtensionAttributes () | |
setExtensionAttributes (\Magento\SalesRule\Api\Data\CouponExtensionInterface $extensionAttributes) | |
![]() | |
__construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[]) | |
getCustomAttributes () | |
getCustomAttribute ($attributeCode) | |
setCustomAttributes (array $attributes) | |
setCustomAttribute ($attributeCode, $attributeValue) | |
setData ($key, $value=null) | |
unsetData ($key=null) | |
getData ($key='', $index=null) | |
setId ($value) | |
__sleep () | |
__wakeup () | |
![]() | |
__construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[]) | |
__sleep () | |
__wakeup () | |
setIdFieldName ($name) | |
getIdFieldName () | |
getId () | |
setId ($value) | |
isDeleted ($isDeleted=null) | |
hasDataChanges () | |
setData ($key, $value=null) | |
unsetData ($key=null) | |
setDataChanges ($value) | |
getOrigData ($key=null) | |
setOrigData ($key=null, $data=null) | |
dataHasChangedFor ($field) | |
getResourceName () | |
getResourceCollection () | |
getCollection () | |
load ($modelId, $field=null) | |
beforeLoad ($identifier, $field=null) | |
afterLoad () | |
isSaveAllowed () | |
setHasDataChanges ($flag) | |
save () | |
afterCommitCallback () | |
isObjectNew ($flag=null) | |
beforeSave () | |
validateBeforeSave () | |
getCacheTags () | |
cleanModelCache () | |
afterSave () | |
delete () | |
beforeDelete () | |
afterDelete () | |
afterDeleteCommit () | |
getResource () | |
getEntityId () | |
setEntityId ($entityId) | |
clearInstance () | |
getStoredData () | |
getEventPrefix () | |
![]() | |
__construct (array $data=[]) | |
addData (array $arr) | |
setData ($key, $value=null) | |
unsetData ($key=null) | |
getData ($key='', $index=null) | |
getDataByPath ($path) | |
getDataByKey ($key) | |
setDataUsingMethod ($key, $args=[]) | |
getDataUsingMethod ($key, $args=null) | |
hasData ($key='') | |
toArray (array $keys=[]) | |
convertToArray (array $keys=[]) | |
toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true) | |
convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true) | |
toJson (array $keys=[]) | |
convertToJson (array $keys=[]) | |
toString ($format='') | |
__call ($method, $args) | |
isEmpty () | |
serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"') | |
debug ($data=null, &$objects=[]) | |
offsetSet ($offset, $value) | |
offsetExists ($offset) | |
offsetUnset ($offset) | |
offsetGet ($offset) | |
Data Fields | |
const | KEY_COUPON_ID = 'coupon_id' |
const | KEY_RULE_ID = 'rule_id' |
const | KEY_CODE = 'code' |
const | KEY_USAGE_LIMIT = 'usage_limit' |
const | KEY_USAGE_PER_CUSTOMER = 'usage_per_customer' |
const | KEY_TIMES_USED = 'times_used' |
const | KEY_EXPIRATION_DATE = 'expiration_date' |
const | KEY_IS_PRIMARY = 'is_primary' |
const | KEY_CREATED_AT = 'created_at' |
const | KEY_TYPE = 'type' |
![]() | |
const | CUSTOM_ATTRIBUTES = 'custom_attributes' |
![]() | |
const | EXTENSION_ATTRIBUTES_KEY = 'extension_attributes' |
![]() | |
const | TYPE_MANUAL = 0 |
const | TYPE_GENERATED = 1 |
Protected Member Functions | |
_construct () | |
![]() | |
filterCustomAttributes ($data) | |
initializeCustomAttributes () | |
convertCustomAttributeValues (array &$customAttributes) | |
getCustomAttributesCodes () | |
_setExtensionAttributes (\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes) | |
_getExtensionAttributes () | |
![]() | |
_construct () | |
_init ($resourceModel) | |
_setResourceModel ($resourceName, $collectionName=null) | |
_getResource () | |
_getEventData () | |
_beforeLoad ($modelId, $field=null) | |
_afterLoad () | |
_hasModelChanged () | |
_getValidatorBeforeSave () | |
_createValidatorBeforeSave () | |
_getValidationRulesBeforeSave () | |
_clearReferences () | |
_clearData () | |
![]() | |
_getData ($key) | |
_underscore ($name) | |
Additional Inherited Members | |
![]() | |
$extensionAttributesFactory | |
$extensionAttributes | |
$customAttributeFactory | |
$customAttributesCodes = null | |
$customAttributesChanged = false | |
![]() | |
$_eventPrefix = 'core_abstract' | |
$_eventObject = 'object' | |
$_idFieldName = 'id' | |
$_hasDataChanges = false | |
$_origData | |
$_isDeleted = false | |
$_resource | |
$_resourceCollection | |
$_resourceName | |
$_collectionName | |
$_cacheTag = false | |
$_dataSaveAllowed = true | |
$_isObjectNew = null | |
$_validatorBeforeSave = null | |
$_eventManager | |
$_cacheManager | |
$_registry | |
$_logger | |
$_appState | |
$_actionValidator | |
$storedData = [] | |
![]() | |
$_data = [] | |
![]() | |
static | $_underscoreCache = [] |
|
protected |
getCode | ( | ) |
Get coupon code
Implements CouponInterface.
Definition at line 124 of file Coupon.php.
getCouponId | ( | ) |
Get coupon id
Implements CouponInterface.
Definition at line 82 of file Coupon.php.
getCreatedAt | ( | ) |
Date when the coupon is created
Implements CouponInterface.
Definition at line 249 of file Coupon.php.
getExpirationDate | ( | ) |
Get expiration date
Implements CouponInterface.
Definition at line 206 of file Coupon.php.
getExtensionAttributes | ( | ) |
Retrieve existing extension attributes object or create a new one.
Implements CouponInterface.
Definition at line 289 of file Coupon.php.
getIsPrimary | ( | ) |
Whether the coupon is primary coupon for the rule that it's associated with
Implements CouponInterface.
Definition at line 228 of file Coupon.php.
getRuleId | ( | ) |
Get the id of the rule associated with the coupon
Implements CouponInterface.
Definition at line 103 of file Coupon.php.
getTimesUsed | ( | ) |
Get the number of times the coupon has been used
Implements CouponInterface.
Definition at line 187 of file Coupon.php.
getType | ( | ) |
Type of coupon
Implements CouponInterface.
Definition at line 270 of file Coupon.php.
getUsageLimit | ( | ) |
Get usage limit
Implements CouponInterface.
Definition at line 145 of file Coupon.php.
getUsagePerCustomer | ( | ) |
Get usage limit per customer
Implements CouponInterface.
Definition at line 166 of file Coupon.php.
loadByCode | ( | $couponCode | ) |
Load Cart Price Rule by coupon code
string | $couponCode |
Definition at line 69 of file Coupon.php.
loadPrimaryByRule | ( | $rule | ) |
Load primary coupon for specified rule
\Magento\SalesRule\Model\Rule | int | $rule |
Definition at line 57 of file Coupon.php.
setCode | ( | $code | ) |
Set coupon code
string | $code |
Implements CouponInterface.
Definition at line 135 of file Coupon.php.
setCouponId | ( | $couponId | ) |
Set coupon id
int | $couponId |
Implements CouponInterface.
Definition at line 93 of file Coupon.php.
setCreatedAt | ( | $createdAt | ) |
Set the date the coupon is created
string | $createdAt |
Implements CouponInterface.
Definition at line 260 of file Coupon.php.
setExpirationDate | ( | $expirationDate | ) |
Set expiration date
string | $expirationDate |
Implements CouponInterface.
Definition at line 217 of file Coupon.php.
setExtensionAttributes | ( | \Magento\SalesRule\Api\Data\CouponExtensionInterface | $extensionAttributes | ) |
Set an extension attributes object.
\Magento\SalesRule\Api\Data\CouponExtensionInterface | $extensionAttributes |
Implements CouponInterface.
Definition at line 300 of file Coupon.php.
setIsPrimary | ( | $isPrimary | ) |
Set whether the coupon is the primary coupon for the rule that it's associated with
bool | $isPrimary |
Implements CouponInterface.
Definition at line 239 of file Coupon.php.
setRule | ( | \Magento\SalesRule\Model\Rule | $rule | ) |
Set rule instance
\Magento\SalesRule\Model\Rule | $rule |
Definition at line 45 of file Coupon.php.
setRuleId | ( | $ruleId | ) |
Set rule id
int | $ruleId |
Implements CouponInterface.
Definition at line 114 of file Coupon.php.
setTimesUsed | ( | $timesUsed | ) |
int | $timesUsed |
Implements CouponInterface.
Definition at line 196 of file Coupon.php.
setType | ( | $type | ) |
int | $type |
Implements CouponInterface.
Definition at line 279 of file Coupon.php.
setUsageLimit | ( | $usageLimit | ) |
Set usage limit
int | $usageLimit |
Implements CouponInterface.
Definition at line 156 of file Coupon.php.
setUsagePerCustomer | ( | $usagePerCustomer | ) |
Set usage limit per customer
int | $usagePerCustomer |
Implements CouponInterface.
Definition at line 177 of file Coupon.php.
const KEY_CODE = 'code' |
Definition at line 19 of file Coupon.php.
const KEY_COUPON_ID = 'coupon_id' |
Definition at line 17 of file Coupon.php.
const KEY_CREATED_AT = 'created_at' |
Definition at line 25 of file Coupon.php.
const KEY_EXPIRATION_DATE = 'expiration_date' |
Definition at line 23 of file Coupon.php.
const KEY_IS_PRIMARY = 'is_primary' |
Definition at line 24 of file Coupon.php.
const KEY_RULE_ID = 'rule_id' |
Definition at line 18 of file Coupon.php.
const KEY_TIMES_USED = 'times_used' |
Definition at line 22 of file Coupon.php.
const KEY_TYPE = 'type' |
Definition at line 26 of file Coupon.php.
const KEY_USAGE_LIMIT = 'usage_limit' |
Definition at line 20 of file Coupon.php.
const KEY_USAGE_PER_CUSTOMER = 'usage_per_customer' |
Definition at line 21 of file Coupon.php.