OXID eShop CE  4.10.2
 All Classes Namespaces Files Functions Variables Pages
oxVoucher Class Reference
+ Inheritance diagram for oxVoucher:
+ Collaboration diagram for oxVoucher:

Public Member Functions

 __construct ()
 getVoucherByNr ($sVoucherNr, $aVouchers=array(), $blCheckavalability=false)
 markAsUsed ($sOrderId, $sUserId, $dDiscount)
 markAsReserved ()
 unMarkAsReserved ()
 getDiscountValue ($dPrice)
 checkVoucherAvailability ($aVouchers, $dPrice)
 checkBasketVoucherAvailability ($aVouchers, $dPrice)
 checkUserAvailability ($oUser)
 getSimpleVoucher ()
 getSerie ()
 getDiscount ()
 getDiscountType ()
 __get ($sName)
- Public Member Functions inherited from oxBase
 getUseSkipSaveFields ()
 setUseSkipSaveFields ($blUseSkipSaveFields)
 __set ($sName, $sValue)
 __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)
 modifyCacheKey ($sCacheKey, $blOverride=false)
 disableLazyLoading ()
 isDerived ()
 setIsDerived ($blVal)
 isMultilang ()
 load ($sOXID)
 isLoaded ()
 buildSelectString ($aWhere=null)
 assignRecord ($sSelect)
 getFieldData ($sFieldName)
 getSelectFields ($blForceCoreTableUsage=null)
 delete ($sOxId=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)
 getLanguage ()
- Public Member Functions inherited from oxSuperCfg
 __call ($sMethod, $aArgs)
 getConfig ()
 setConfig ($oConfig)
 getSession ()
 setSession ($oSession)
 getUser ()
 setUser ($oUser)
 isAdmin ()
 setAdminMode ($blAdmin)

Protected Member Functions

 _isAvailablePrice ($dPrice)
 _isAvailableWithSameSeries ($aVouchers)
 _isAvailableWithOtherSeries ($aVouchers)
 _isValidDate ()
 _isNotReserved ()
 _isAvailableInOtherOrder ($oUser)
 _isValidUserGroup ($oUser)
 _isProductVoucher ()
 _isCategoryVoucher ()
 _getSerieDiscount ()
 _getBasketItems ($oDiscount=null)
 _getOrderBasketItems ($oDiscount=null)
 _getSessionBasketItems ($oDiscount=null)
 _getGenericDiscoutValue ($dPrice)
 _getProductDiscoutValue ($dPrice)
 _getCategoryDiscoutValue ($dPrice)
 _getVoucherTimeout ()
- Protected Member Functions inherited from oxBase
 _setUpdateSeoOnFieldChange ($sField)
 _removeElement2ShopRelations ($sOxId)
 _isInList ()
 _getObjectViewName ($sTable, $sShopID=null)
 _getTableFields ($sTable, $blReturnSimple=false)
 _getAllFields ($blReturnSimple=false)
 _initDataStructure ($blForceFullStructure=false)
 _getNonCachedFieldNames ($blForceFullStructure=false)
 _getFieldStatus ($sFieldName)
 _addField ($sName, $iStatus, $sType=null, $sLength=null)
 _getFieldLongName ($sFieldName)
 _setFieldData ($sFieldName, $sValue, $iDataType=oxField::T_TEXT)
 _canFieldBeNull ($sFieldName)
 _getFieldDefaultValue ($sFieldName)
 _getUpdateFieldValue ($sFieldName, $oField)
 _getUpdateFields ($blUseSkipSaveFields=true)
 _update ()
 _insert ()
 _isDisabledFieldCache ()
 _addSkippedSaveFieldsForMapping ()
 _disableLazyLoadingForCaching ()

Protected Attributes

 $_oSerie = null
 $_blDisableShopCheck = true
 $_sClassName = 'oxvoucher'
- 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

Voucher manager. Performs deletion, generating, assigning to group and other voucher managing functions.

Definition at line 9 of file oxvoucher.php.

Constructor & Destructor Documentation

oxVoucher::__construct ( )

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

Reimplemented from oxBase.

Definition at line 30 of file oxvoucher.php.

Member Function Documentation

oxVoucher::__get (   $sName)

Extra getter to guarantee compatibility with templates

Parameters
string$sNamename of variable to get
Returns
string

Reimplemented from oxBase.

Definition at line 781 of file oxvoucher.php.

oxVoucher::_getBasketItems (   $oDiscount = null)
protected

Returns basket item information array from session or order.

Parameters
oxDiscount$oDiscountdiscount object
Returns
array

Definition at line 540 of file oxvoucher.php.

oxVoucher::_getCategoryDiscoutValue (   $dPrice)
protected

Returns the discount value used, if voucher is applied only for specific categories.

Parameters
double$dPriceprice to calculate discount on it
Exceptions
oxVoucherExceptionexception
Returns
double

Definition at line 746 of file oxvoucher.php.

oxVoucher::_getGenericDiscoutValue (   $dPrice)
protected

Returns the discount value used.

Parameters
double$dPriceprice to calculate discount on it
Exceptions
oxVoucherExceptionexception
Returns
double

Definition at line 628 of file oxvoucher.php.

oxVoucher::_getOrderBasketItems (   $oDiscount = null)
protected

Returns basket item information (id,amount,price) array takig item list from order.

Parameters
oxDiscount$oDiscountdiscount object
Returns
array

Definition at line 558 of file oxvoucher.php.

oxVoucher::_getProductDiscoutValue (   $dPrice)
protected

Returns the discount value used, if voucher is aplied only for specific products.

Parameters
double$dPriceprice to calculate discount on it
Exceptions
oxVoucherExceptionexception
Returns
double

Definition at line 680 of file oxvoucher.php.

oxVoucher::_getSerieDiscount ( )
protected

Returns the discount object created from voucher serie data

Returns
object

Definition at line 509 of file oxvoucher.php.

oxVoucher::_getSessionBasketItems (   $oDiscount = null)
protected

Returns basket item information (id,amount,price) array taking item list from session.

Parameters
oxDiscount$oDiscountdiscount object
Returns
array

Definition at line 592 of file oxvoucher.php.

oxVoucher::_getVoucherTimeout ( )
protected

Returns a configured value for voucher timeouts or a default of 3 hours if not configured

Returns
integer Seconds a voucher can stay in status reserved

Definition at line 805 of file oxvoucher.php.

oxVoucher::_isAvailableInOtherOrder (   $oUser)
protected

Checks if user already used vouchers from this series and can he use it again.

Parameters
object$oUseruser object
Exceptions
oxVoucherExceptionexception
Returns
boolean

Definition at line 386 of file oxvoucher.php.

oxVoucher::_isAvailablePrice (   $dPrice)
protected

Checks availability about price. Returns error array.

Parameters
double$dPricebase article price
Exceptions
oxVoucherExceptionexception
Returns
array

Definition at line 210 of file oxvoucher.php.

oxVoucher::_isAvailableWithOtherSeries (   $aVouchers)
protected

Checks if calculation with vouchers from the other series possible. Returns true on success.

Parameters
array$aVouchersarray of vouchers
Exceptions
oxVoucherExceptionexception
Returns
bool

Definition at line 270 of file oxvoucher.php.

oxVoucher::_isAvailableWithSameSeries (   $aVouchers)
protected

Checks if calculation with vouchers of the same series possible. Returns true on success.

Parameters
array$aVouchersarray of vouchers
Exceptions
oxVoucherExceptionexception
Returns
bool

Definition at line 235 of file oxvoucher.php.

oxVoucher::_isCategoryVoucher ( )
protected

Returns true if voucher is category specific, otherwise false

Returns
boolean

Definition at line 494 of file oxvoucher.php.

oxVoucher::_isNotReserved ( )
protected

Checks if voucher is not yet reserved before.

Exceptions
oxVoucherExceptionexception
Returns
bool

Definition at line 344 of file oxvoucher.php.

oxVoucher::_isProductVoucher ( )
protected

Returns true if voucher is product specific, otherwise false

Returns
boolean

Definition at line 479 of file oxvoucher.php.

oxVoucher::_isValidDate ( )
protected

Checks if voucher is in valid time period. Returns true on success.

Exceptions
oxVoucherExceptionexception
Returns
bool

Definition at line 307 of file oxvoucher.php.

oxVoucher::_isValidUserGroup (   $oUser)
protected

Checks if user belongs to the same group as the voucher. Returns true on sucess.

Parameters
object$oUseruser object
Exceptions
oxVoucherExceptionexception
Returns
bool

Definition at line 416 of file oxvoucher.php.

oxVoucher::checkBasketVoucherAvailability (   $aVouchers,
  $dPrice 
)

Performs basket level voucher availability check (no need to check if voucher is reserved or so).

Parameters
array$aVouchersarray of vouchers
double$dPricecurrent sum (price)
Exceptions
oxVoucherExceptionexception
Returns
array

Definition at line 190 of file oxvoucher.php.

oxVoucher::checkUserAvailability (   $oUser)

Checks availability for the given user. Returns array with errors.

Parameters
object$oUseruser object
Exceptions
oxVoucherExceptionexception
Returns
array

Definition at line 367 of file oxvoucher.php.

oxVoucher::checkVoucherAvailability (   $aVouchers,
  $dPrice 
)

Checks availability without user logged in. Returns array with errors.

Parameters
array$aVouchersarray of vouchers
double$dPricecurrent sum (price)
Exceptions
oxVoucherExceptionexception
Returns
array

Definition at line 167 of file oxvoucher.php.

oxVoucher::getDiscount ( )

Return discount value

Returns
double

Definition at line 651 of file oxvoucher.php.

oxVoucher::getDiscountType ( )

Return discount type

Returns
string

Definition at line 663 of file oxvoucher.php.

oxVoucher::getDiscountValue (   $dPrice)

Returns the discount value used.

Parameters
double$dPriceprice to calculate discount on it
Exceptions
oxVoucherExceptionexception
Returns
double

Definition at line 145 of file oxvoucher.php.

oxVoucher::getSerie ( )

create oxVoucherSeries object of this voucher

Returns
oxVoucherSeries

Definition at line 460 of file oxvoucher.php.

oxVoucher::getSimpleVoucher ( )

Returns compact voucher object which is used in oxBasket

Returns
stdClass

Definition at line 444 of file oxvoucher.php.

oxVoucher::getVoucherByNr (   $sVoucherNr,
  $aVouchers = array(),
  $blCheckavalability = false 
)

Gets voucher from db by given number.

Parameters
string$sVoucherNrVoucher number
array$aVouchersArray of available vouchers (default array())
bool$blCheckavalabilitycheck if voucher is still reserver od not
Exceptions
oxVoucherExceptionexception
Returns
mixed

Definition at line 47 of file oxvoucher.php.

oxVoucher::markAsReserved ( )

mark voucher as reserved

Definition at line 109 of file oxvoucher.php.

oxVoucher::markAsUsed (   $sOrderId,
  $sUserId,
  $dDiscount 
)

marks voucher as used

Parameters
string$sOrderIdorder id
string$sUserIduser id
double$dDiscountused discount

Definition at line 94 of file oxvoucher.php.

oxVoucher::unMarkAsReserved ( )

un mark as reserved

Definition at line 124 of file oxvoucher.php.

Member Data Documentation

oxVoucher::$_blDisableShopCheck = true
protected

Definition at line 20 of file oxvoucher.php.

oxVoucher::$_oSerie = null
protected

Definition at line 12 of file oxvoucher.php.

oxVoucher::$_sClassName = 'oxvoucher'
protected

Definition at line 25 of file oxvoucher.php.


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