OXID eShop CE  4.8.12
 All Classes Files Functions Variables Pages
oxDiscount Class Reference
+ Inheritance diagram for oxDiscount:
+ Collaboration diagram for oxDiscount:

Public Member Functions

 __construct ()
 delete ($sOXID=null)
 isForArticle ($oArticle)
 isForBasketItem ($oArticle)
 isForBasketAmount ($oBasket)
 isForAmount ($dAmount)
 isForBasket ($oBasket)
 isForBundleItem ($oArticle)
 isForBundleBasket ($oBasket)
 getAbsValue ($dPrice, $dAmount=1)
 applyDiscount ($oPrice, $dAmount=1)
 getPercentage ($dPrice)
 getAddSum ()
 getAddSumType ()
 getBundleAmount ($dAmount)
 getSimpleDiscount ()
 getArticleIds ()
 getCategoryIds ()
- Public Member Functions inherited from oxI18n
 setLanguage ($iLang=null)
 getLanguage ()
 setEnableMultilang ($blEmployMultilanguage)
 isMultilingualField ($sFieldName)
 isMultilang ()
 loadInLang ($iLanguage, $sOxid)
 modifyCacheKey ($sCacheKey, $blOverride=false)
 getAvailableInLangs ()
 getUpdateSqlFieldName ($sField)
- Public Member Functions inherited from oxBase
 getUseSkipSaveFields ()
 setUseSkipSaveFields ($blUseSkipSaveFields)
 __set ($sName, $sValue)
 __get ($sName)
 __isset ($mVar)
 __clone ()
 oxClone ($oObject)
 getUpdateSeo ()
 setUpdateSeo ($blUpdateSeo)
 init ($sTableName=null, $blForceAllFields=false)
 assign ($dbRecord)
 getClassName ()
 getCoreTableName ()
 getId ()
 setId ($sOXID=null)
 setShopId ($iShopId)
 getShopId ()
 getViewName ($blForceCoreTableUsage=null)
 disableLazyLoading ()
 isDerived ()
 setIsDerived ($blVal)
 load ($sOXID)
 isLoaded ()
 buildSelectString ($aWhere=null)
 assignRecord ($sSelect)
 getFieldData ($sFieldName)
 getSelectFields ($blForceCoreTableUsage=null)
 save ()
 allowDerivedUpdate ()
 allowDerivedDelete ()
 exists ($sOXID=null)
 getSqlActiveSnippet ($blForceCoreTable=null)
 beforeUpdate ($sOXID=null)
 onChange ($iAction=null, $sOXID=null)
 setInList ()
 isOx ()
 isReadOnly ()
 setReadOnly ($blReadOnly)
 getFieldNames ()
 addFieldName ($sName)
- Public Member Functions inherited from oxSuperCfg
 __call ($sMethod, $aArgs)
 getConfig ()
 setConfig ($oConfig)
 getSession ()
 setSession ($oSession)
 getUser ()
 setUser ($oUser)
 isAdmin ()
 setAdminMode ($blAdmin)

Protected Member Functions

 _checkForArticleCategories ($oArticle)
 _getProductCheckQuery ($oProduct)
- Protected Member Functions inherited from oxI18n
 _getFieldStatus ($sFieldName)
 _getNonCachedFieldNames ($blForceFullStructure=false)
 _getFieldLang ($sFieldName)
 _setUpdateSeoOnFieldChange ($sField)
 _getUpdateFieldsForTable ($sTable, $blUseSkipSaveFields=true)
 _getUpdateFields ($blUseSkipSaveFields=true)
 _update ()
 _getLanguageSetTables ($sCoreTableName=null)
 _insert ()
 _getObjectViewName ($sTable, $sShopID=null)
 _getAllFields ($blReturnSimple=false)
 _addField ($sName, $sStatus, $sType=null, $sLength=null)
 _canFieldBeNull ($sFieldName)
- Protected Member Functions inherited from oxBase
 _isInList ()
 _getTableFields ($sTable, $blReturnSimple=false)
 _initDataStructure ($blForceFullStructure=false)
 _getFieldLongName ($sFieldName)
 _setFieldData ($sFieldName, $sValue, $iDataType=oxField::T_TEXT)
 _getFieldDefaultValue ($sFieldName)
 _getUpdateFieldValue ($sFieldName, $oField)
 _isDisabledFieldCache ()

Protected Attributes

 $_sClassName = 'oxdiscount'
 $_dAmount = null
 $_sBasketIdent = null
 $_blIsForArticleOrForCategory = null
 $_aHasArticleDiscounts = array()
- Protected Attributes inherited from oxI18n
 $_sClassName = 'oxI18n'
 $_iLanguage = null
 $_blEmployMultilanguage = true
- Protected Attributes inherited from oxBase
 $_sOXID = null
 $_iShopId = null
 $_blIsSimplyClonable = true
 $_sClassName = 'oxbase'
 $_sCoreTable = null
 $_sViewTable = null
 $_aFieldNames = array('oxid' => 0)
 $_sCacheKey = null
 $_blUseLazyLoading = false
 $_aSkipSaveFields = array('oxtimestamp')
 $_blUseSkipSaveFields = true
 $_sExistKey = 'oxid'
 $_blIsDerived = null
 $_blIsSeoObject = false
 $_blUpdateSeo = true
 $_blReadOnly = false
 $_blIsInList = false
 $_isLoaded = false
 $_aInnerLazyCache = null
 $_blEmployMultilanguage = false

Additional Inherited Members

- Static Protected Attributes inherited from oxBase
static $_blDisableFieldCaching = array()

Detailed Description

Discounts manager.

Definition at line 7 of file oxdiscount.php.

Constructor & Destructor Documentation

oxDiscount::__construct ( )

Class constructor, initiates parent constructor (parent::oxBase()).

Reimplemented from oxI18n.

Definition at line 47 of file oxdiscount.php.

Member Function Documentation

oxDiscount::_checkForArticleCategories (   $oArticle)
protected

Checks if discount may be applied according amounts info

Parameters
object$oArticlearticle object to chesk
Returns
bool

Definition at line 427 of file oxdiscount.php.

oxDiscount::_getProductCheckQuery (   $oProduct)
protected

Returns part of query for discount check. If product is variant - query contains both id check e.g. "and (oxobjectid = '...' or oxobjectid = '...')

Parameters
oxarticle$oProductproduct used for discount check
Returns
string

Definition at line 488 of file oxdiscount.php.

oxDiscount::applyDiscount (   $oPrice,
  $dAmount = 1 
)

Applies discount for current price

Parameters
oxprice$oPricebasket item price object
double$dAmountbasket item amount (default 1)
Deprecated:
since v5.0.1 (2012-11-08); use oxPrice class discount calculation methods;
Returns
null

Definition at line 340 of file oxdiscount.php.

oxDiscount::delete (   $sOXID = null)

Delete this object from the database, returns true on success.

Parameters
string$sOXIDObject ID(default null)
Returns
bool

Reimplemented from oxI18n.

Definition at line 60 of file oxdiscount.php.

oxDiscount::getAbsValue (   $dPrice,
  $dAmount = 1 
)

Returns absolute discount value

Parameters
float$dPriceitem price
float$dAmountitem amount, interpretted only when discount is absolute (default 1)
Returns
float

Definition at line 320 of file oxdiscount.php.

oxDiscount::getAddSum ( )

Return add sum in abs type discount with efected currency rate; Return discount percent value in other way;

Returns
double

Definition at line 378 of file oxdiscount.php.

oxDiscount::getAddSumType ( )

Return addsum type

Returns
string

Definition at line 393 of file oxdiscount.php.

oxDiscount::getArticleIds ( )

Returns article ids asigned to discount

Returns
array

Definition at line 465 of file oxdiscount.php.

oxDiscount::getBundleAmount (   $dAmount)

Returns amount of items to bundle

Parameters
double$dAmountitem amount
Returns
double

Definition at line 408 of file oxdiscount.php.

oxDiscount::getCategoryIds ( )

Returns category ids asigned to discount

Returns
array

Definition at line 475 of file oxdiscount.php.

oxDiscount::getPercentage (   $dPrice)

Return discount percent

Parameters
decimal$dPrice- price from which calculates discount
Returns
decimal

Definition at line 361 of file oxdiscount.php.

oxDiscount::getSimpleDiscount ( )

Returns compact discount object which is used in oxbasket

Returns
stdClass

Definition at line 450 of file oxdiscount.php.

oxDiscount::isForAmount (   $dAmount)

Tests if passed amount or price fits current discount (price priority)

Parameters
double$dAmountamount or price to check (price priority)
Returns
bool

Definition at line 225 of file oxdiscount.php.

oxDiscount::isForArticle (   $oArticle)

Checks if discount is setup for article

Parameters
oxarticle$oArticlearticle object
Returns
bool

Definition at line 83 of file oxdiscount.php.

oxDiscount::isForBasket (   $oBasket)

Checks if discount is setup for whole basket

Parameters
object$oBasketbasket object
Returns
bool

Definition at line 247 of file oxdiscount.php.

oxDiscount::isForBasketAmount (   $oBasket)

Tests if total amount or price (price priority) of articles that can be applied to current discount fits to discount configuration

Parameters
oxbasket$oBasketbasket
Returns
bool

Definition at line 188 of file oxdiscount.php.

oxDiscount::isForBasketItem (   $oArticle)

Checks if discount is setup for some basket item

Parameters
object$oArticlebasket item
Returns
bool

Definition at line 156 of file oxdiscount.php.

oxDiscount::isForBundleBasket (   $oBasket)

Checks if discount type is whole basket bundle discount

Parameters
object$oBasketbasket object
Returns
bool

Definition at line 303 of file oxdiscount.php.

oxDiscount::isForBundleItem (   $oArticle)

Checks if discount type is bundle discount

Parameters
object$oArticlearticle object
Returns
bool

Definition at line 280 of file oxdiscount.php.

Member Data Documentation

oxDiscount::$_aHasArticleDiscounts = array()
protected

Definition at line 42 of file oxdiscount.php.

oxDiscount::$_blIsForArticleOrForCategory = null
protected

Definition at line 35 of file oxdiscount.php.

oxDiscount::$_dAmount = null
protected

Definition at line 21 of file oxdiscount.php.

oxDiscount::$_sBasketIdent = null
protected

Definition at line 28 of file oxdiscount.php.

oxDiscount::$_sClassName = 'oxdiscount'
protected

Definition at line 14 of file oxdiscount.php.


The documentation for this class was generated from the following file: