OXID eShop CE  6.1.5
OxidEsales\EshopCommunity\Application\Model\Voucher Class Reference
+ Inheritance diagram for OxidEsales\EshopCommunity\Application\Model\Voucher:
+ Collaboration diagram for OxidEsales\EshopCommunity\Application\Model\Voucher:

Public Member Functions

 __construct ()
 
 getVoucherByNr ($sVoucherNr, $aVouchers=[], $blCheckavalability=false)
 
 markAsUsed ($sOrderId, $sUserId, $dDiscount)
 
 markAsReserved ()
 
 unMarkAsReserved ()
 
 getDiscountValue ($dPrice)
 
 checkVoucherAvailability ($aVouchers, $dPrice)
 
 checkBasketVoucherAvailability ($aVouchers, $dPrice)
 
 checkUserAvailability ($oUser)
 
 getSimpleVoucher ()
 
 getSerie ()
 
 getDiscount ()
 
 getDiscountType ()
 
 __get ($sName)
 

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)
 
 _getGenericDiscountValue ($dPrice)
 
 _getProductDiscoutValue ($dPrice)
 
 _getProductDiscountValue ($dPrice)
 
 _getCategoryDiscoutValue ($dPrice)
 
 _getCategoryDiscountValue ($dPrice)
 
 _getVoucherTimeout ()
 

Protected Attributes

 $_oSerie = null
 
 $_blDisableShopCheck = true
 
 $_sClassName = 'oxvoucher'
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

OxidEsales\EshopCommunity\Application\Model\Voucher::__construct ( )

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

Member Function Documentation

◆ __get()

OxidEsales\EshopCommunity\Application\Model\Voucher::__get (   $sName)

Extra getter to guarantee compatibility with templates

Parameters
string$sNamename of variable to get
Returns
string

◆ _getBasketItems()

OxidEsales\EshopCommunity\Application\Model\Voucher::_getBasketItems (   $oDiscount = null)
protected

Returns basket item information array from session or order.

Parameters
\OxidEsales\Eshop\Application\Model\Discount$oDiscountdiscount object
Returns
array

◆ _getCategoryDiscountValue()

OxidEsales\EshopCommunity\Application\Model\Voucher::_getCategoryDiscountValue (   $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

◆ _getCategoryDiscoutValue()

OxidEsales\EshopCommunity\Application\Model\Voucher::_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
Deprecated:
on b-dev (2015-03-31); Use function _getCategoryDiscountValue()
Returns
double

◆ _getGenericDiscountValue()

OxidEsales\EshopCommunity\Application\Model\Voucher::_getGenericDiscountValue (   $dPrice)
protected

Returns the discount value used.

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

◆ _getGenericDiscoutValue()

OxidEsales\EshopCommunity\Application\Model\Voucher::_getGenericDiscoutValue (   $dPrice)
protected

Returns the discount value used.

Parameters
double$dPriceprice to calculate discount on it
Exceptions
oxVoucherExceptionexception
Deprecated:
on b-dev (2015-03-31); Use function _getGenericDiscountValue()
Returns
double

◆ _getOrderBasketItems()

OxidEsales\EshopCommunity\Application\Model\Voucher::_getOrderBasketItems (   $oDiscount = null)
protected

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

Parameters
\OxidEsales\Eshop\Application\Model\Discount$oDiscountdiscount object
Returns
array

◆ _getProductDiscountValue()

OxidEsales\EshopCommunity\Application\Model\Voucher::_getProductDiscountValue (   $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

◆ _getProductDiscoutValue()

OxidEsales\EshopCommunity\Application\Model\Voucher::_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
Deprecated:
on b-dev (2015-03-31); Use function _getProductDiscountValue()
Returns
double

◆ _getSerieDiscount()

OxidEsales\EshopCommunity\Application\Model\Voucher::_getSerieDiscount ( )
protected

Returns the discount object created from voucher serie data

Returns
object

◆ _getSessionBasketItems()

OxidEsales\EshopCommunity\Application\Model\Voucher::_getSessionBasketItems (   $oDiscount = null)
protected

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

Parameters
\OxidEsales\Eshop\Application\Model\Discount$oDiscountdiscount object
Returns
array

◆ _getVoucherTimeout()

OxidEsales\EshopCommunity\Application\Model\Voucher::_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

◆ _isAvailableInOtherOrder()

OxidEsales\EshopCommunity\Application\Model\Voucher::_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

◆ _isAvailablePrice()

OxidEsales\EshopCommunity\Application\Model\Voucher::_isAvailablePrice (   $dPrice)
protected

Checks availability about price. Returns error array.

Parameters
double$dPricebase article price
Exceptions
oxVoucherExceptionexception
Returns
array

◆ _isAvailableWithOtherSeries()

OxidEsales\EshopCommunity\Application\Model\Voucher::_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

◆ _isAvailableWithSameSeries()

OxidEsales\EshopCommunity\Application\Model\Voucher::_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

◆ _isCategoryVoucher()

OxidEsales\EshopCommunity\Application\Model\Voucher::_isCategoryVoucher ( )
protected

Returns true if voucher is category specific, otherwise false

Returns
boolean

◆ _isNotReserved()

OxidEsales\EshopCommunity\Application\Model\Voucher::_isNotReserved ( )
protected

Checks if voucher is not yet reserved before.

Exceptions
oxVoucherExceptionexception
Returns
bool

◆ _isProductVoucher()

OxidEsales\EshopCommunity\Application\Model\Voucher::_isProductVoucher ( )
protected

Returns true if voucher is product specific, otherwise false

Returns
boolean

◆ _isValidDate()

OxidEsales\EshopCommunity\Application\Model\Voucher::_isValidDate ( )
protected

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

Exceptions
oxVoucherExceptionexception
Returns
bool

◆ _isValidUserGroup()

OxidEsales\EshopCommunity\Application\Model\Voucher::_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

◆ checkBasketVoucherAvailability()

OxidEsales\EshopCommunity\Application\Model\Voucher::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

◆ checkUserAvailability()

OxidEsales\EshopCommunity\Application\Model\Voucher::checkUserAvailability (   $oUser)

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

Parameters
object$oUseruser object
Exceptions
oxVoucherExceptionexception
Returns
array

◆ checkVoucherAvailability()

OxidEsales\EshopCommunity\Application\Model\Voucher::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

◆ getDiscount()

OxidEsales\EshopCommunity\Application\Model\Voucher::getDiscount ( )

Return discount value

Returns
double

◆ getDiscountType()

OxidEsales\EshopCommunity\Application\Model\Voucher::getDiscountType ( )

Return discount type

Returns
string

◆ getDiscountValue()

OxidEsales\EshopCommunity\Application\Model\Voucher::getDiscountValue (   $dPrice)

Returns the discount value used.

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

◆ getSerie()

OxidEsales\EshopCommunity\Application\Model\Voucher::getSerie ( )

create oxVoucherSerie object of this voucher

Exceptions
oxObjectException
Returns
oxVoucherSerie

◆ getSimpleVoucher()

OxidEsales\EshopCommunity\Application\Model\Voucher::getSimpleVoucher ( )

Returns compact voucher object which is used in oxBasket

Returns
stdClass

◆ getVoucherByNr()

OxidEsales\EshopCommunity\Application\Model\Voucher::getVoucherByNr (   $sVoucherNr,
  $aVouchers = [],
  $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

◆ markAsReserved()

OxidEsales\EshopCommunity\Application\Model\Voucher::markAsReserved ( )

mark voucher as reserved

◆ markAsUsed()

OxidEsales\EshopCommunity\Application\Model\Voucher::markAsUsed (   $sOrderId,
  $sUserId,
  $dDiscount 
)

marks voucher as used

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

◆ unMarkAsReserved()

OxidEsales\EshopCommunity\Application\Model\Voucher::unMarkAsReserved ( )

un mark as reserved

Member Data Documentation

◆ $_blDisableShopCheck

OxidEsales\EshopCommunity\Application\Model\Voucher::$_blDisableShopCheck = true
protected

◆ $_oSerie

OxidEsales\EshopCommunity\Application\Model\Voucher::$_oSerie = null
protected

◆ $_sClassName

OxidEsales\EshopCommunity\Application\Model\Voucher::$_sClassName = 'oxvoucher'
protected

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