00001 <?php
00002
00008 class oxWrapping extends oxI18n
00009 {
00015 protected $_sCoreTbl = 'oxwrapping';
00016
00022 protected $_sClassName = 'oxwrapping';
00023
00029 protected $_oPrice = null;
00030
00036 protected $_dVat = 0;
00037
00044 public function __construct()
00045 {
00046 $this->setWrappingVat( $this->getConfig()->getConfigParam( 'dDefaultVAT' ) );
00047 parent::__construct();
00048 $this->init( 'oxwrapping' );
00049 }
00050
00058 public function __get($sName)
00059 {
00060 switch ($sName) {
00061 case 'fprice':
00062 return $this->getFPrice();
00063 break;
00064
00065 }
00066
00067 return parent::__get( $sName );
00068 }
00069
00077 public function setWrappingVat( $dVat )
00078 {
00079 $this->_dVat = $dVat;
00080 }
00081
00089 public function assign( $dbRecord )
00090 {
00091
00092 parent::assign( $dbRecord );
00093
00094
00095 $myConfig = $this->getConfig();
00096
00097 $this->dimagedir = $myConfig->getDynImageDir( $this->oxwrapping__oxshopid->value );
00098 $this->nossl_dimagedir = $myConfig->getDynImageDir( $this->oxwrapping__oxshopid->value, true );
00099 }
00100
00108 public function getWrappingPrice( $dAmount = 1 )
00109 {
00110 if ( $this->_oPrice === null ) {
00111 $this->_oPrice = oxNew( 'oxprice' );
00112
00113 $oCur = $this->getConfig()->getActShopCurrencyObject();
00114 $this->_oPrice->setPrice( $this->oxwrapping__oxprice->value * $oCur->rate, $this->_dVat );
00115 $this->_oPrice->multiply( $dAmount );
00116 }
00117
00118 return $this->_oPrice;
00119 }
00120
00128 public function getWrappingList( $sWrapType )
00129 {
00130
00131 $oEntries = oxNew( 'oxlist' );
00132 $oEntries->init( 'oxwrapping' );
00133 $sWrappingViewName = getViewName( 'oxwrapping' );
00134 $sSelect = "select * from $sWrappingViewName where $sWrappingViewName.oxactive = '1' and $sWrappingViewName.oxtype = '$sWrapType' ";
00135 $oEntries->selectString( $sSelect );
00136
00137 return $oEntries;
00138 }
00139
00147 public function getWrappingCount( $sWrapType )
00148 {
00149 $sWrappingViewName = getViewName( 'oxwrapping' );
00150 $sQ = "select count(*) from $sWrappingViewName where $sWrappingViewName.oxactive = '1' and $sWrappingViewName.oxtype = '$sWrapType' ";
00151 return (int) oxDb::getDb()->getOne( $sQ );
00152 }
00153
00159 public function getFPrice()
00160 {
00161 return oxLang::getInstance()->formatCurrency( $this->getWrappingPrice()->getBruttoPrice(), $this->getConfig()->getActShopCurrencyObject() );
00162 }
00163
00169 public function getNoSslDynImageDir()
00170 {
00171 return $this->getConfig()->getDynImageDir( $this->oxwrapping__oxshopid->value, true );
00172 }
00173
00179 public function getPictureUrl()
00180 {
00181 return $this->getConfig()->getDynImageDir( $this->oxwrapping__oxshopid->value );
00182 }
00183
00184 }