Components \ commerce \ affiliates administrators commissions payments \ configuration paymentmethods \ shippingmethods \ methods delivery discounts \ products brands categories \ recurringsales storedcards \ sales items \ receipts allocations \ customers \ contacts passwords referrertypes \ relationships types \ groups contacts \ marketing \ emailmarketing \ sends contacts unsubscribers \ events attendees locations \ reminders \ automation eventremindertrigger \ settings administrators components configurationitems cpanel customfields \ developer scheduledtasks threads domains \ website \ analytics sessions comments \ designs generator media pages \ posts categories Framework \ architecture publicassets \ assets css javascript \ caching filebased \ components textualids \ data util \ database mainconnection date \ dom currentcontext renderer \ html converters highlighter javascript \ http redirection request session useragent \ i18n companytypes countries languages \ network cidr dns geoip random \ reflection api \ system filenames filesystem toasts
.
.
.
quick access
\ methods

\Components\Commerce\Discounts::

Allow you to setup discounts on products, categories and brands.

Class Methods

The following static methods are available on this class:
void activateCodeDiscountWithCode($strDiscountCode)
Description
Activates a discount with a specific code
Parameters
$strDiscountCode
string
Return
void
void activatedCodeDiscountRemoveAll()
Description
Removes all discounts that have been activated by code
Parameters
none
Return
void
bool activatedCodeDiscountsIsCodeApplied($strDiscountCode)
Description
Returns whether a discount with a specific id has been applied
Parameters
$strDiscountCode
string
Return
bool
string configGetValue($strConfigId)
Description
Retrieves the value of a config item for the current component
Parameters
$strConfigId
string
Return
Config item value
bool delete($strKeyValue, $bDeleteMedia, $strReason)
Description
Deletes an entity and triggers the pre/post component events
Parameters
$strKeyValue
string
$bDeleteMedia
bool
$strReason
mixed
Return
bool
array get($strKey)
Description
Returns an entity
Parameters
$strKey
mixed
Value of the primary key
Return
{Array} getAll($arrProperties)
Description
Return all entities in the database.
Parameters
$arrProperties
mixed
Return
Array of Discounts
int getCodeDiscountsForPublicCount()
Description
Retrieves the number of discounts which require a code and enabled for public
Parameters
none
Return
int
mixed getColumn($strKey, $strColumn)
Description
Returns a single column of an entity
Parameters
$strKey
string
$strColumn
string
Return
mixed
int getContactId()
Description
Retrieves the contact id on which discounts are currently meant to be applied to. This is useful for custom algorithm discounts
Parameters
none
Return
int
int getCount($arrFilter)
Description
Returns a count of all rows in the data adapter
Parameters
$arrFilter
array
Return
int
string mediaFolderGet($strKey)
Description
Returns the media folder for this data adapter
Parameters
$strKey
mixed
Return
Folder
mixed save($arrEntity, $strReason)
Description
Saves an entity and triggers the pre/post component events
Parameters
$arrEntity
array
$strReason
string
Return
mixed
mixed saveColumn($strKeyValue, $strColumn, $strValue, $strReason)
Description
Changes a column of an existing entity Supports primary keys spanning on several columns if passing $strKeyValue as an associative arry
Parameters
$strKeyValue
string
$strColumn
string
$strValue
string
$strReason
string
Return
Id
array search($strSearch, $arrProperties)
Description
Performs a search
Parameters
$strSearch
string
$arrProperties
mixed
Return
array

Database Fields

The following fields are used when retrieving and saving entities.
affiliate_id
int unsigned (10)
automation_condition_id
int (10)
discount_auto_delete
tinyint (1)
discount_code
varchar (31)
discount_end_date
datetime
discount_entities
text
discount_entity_type
varchar (255)
discount_id
int (11)
discount_is_enabled_admin
tinyint unsigned (1)
Default value: 1
discount_is_enabled_public
tinyint unsigned (1)
Default value: 1
discount_products_total_threshold
int (11)
discount_scope
enum ('cart','product')
Default value: cart
discount_start_date
datetime
discount_title
varchar (255)
discount_type
enum ('flat','percentage','custom','free_shipping')
Default value: flat
discount_usage_limit
int (11)
discount_value
text