Go to the documentation of this file.00001 <?php
00002
00007 class oxWrapping extends oxI18n
00008 {
00014 protected $_sClassName = 'oxwrapping';
00015
00021 protected $_oPrice = null;
00022
00028 protected $_dVat = 0;
00029
00035 protected $_blWrappingVatOnTop = false;
00036
00043 public function __construct()
00044 {
00045 $oConfig = $this->getConfig();
00046 $this->setWrappingVat( $oConfig->getConfigParam( 'dDefaultVAT' ) );
00047 $this->setWrappingVatOnTop( $oConfig->getConfigParam( 'blWrappingVatOnTop' ) );
00048 parent::__construct();
00049 $this->init( 'oxwrapping' );
00050 }
00051
00059 public function setWrappingVat( $dVat )
00060 {
00061 $this->_dVat = $dVat;
00062 }
00063
00071 public function setWrappingVatOnTop( $blOnTop )
00072 {
00073 $this->_blWrappingVatOnTop = $blOnTop;
00074 }
00075
00083 public function assign( $dbRecord )
00084 {
00085
00086 parent::assign( $dbRecord );
00087
00088
00089 $myConfig = $this->getConfig();
00090 }
00091
00099 public function getWrappingPrice( $dAmount = 1 )
00100 {
00101 if ( $this->_oPrice === null ) {
00102 $this->_oPrice = oxNew( 'oxprice' );
00103
00104 if ( !$this->_blWrappingVatOnTop ) {
00105 $this->_oPrice->setBruttoPriceMode();
00106 } else {
00107 $this->_oPrice->setNettoPriceMode();
00108 }
00109
00110 $oCur = $this->getConfig()->getActShopCurrencyObject();
00111 $this->_oPrice->setPrice( $this->oxwrapping__oxprice->value * $oCur->rate, $this->_dVat );
00112 $this->_oPrice->multiply( $dAmount );
00113 }
00114
00115 return $this->_oPrice;
00116 }
00117
00125 public function getWrappingList( $sWrapType )
00126 {
00127
00128 $oEntries = oxNew( 'oxlist' );
00129 $oEntries->init( 'oxwrapping' );
00130 $sWrappingViewName = getViewName( 'oxwrapping' );
00131 $sSelect = "select * from $sWrappingViewName where $sWrappingViewName.oxactive = '1' and $sWrappingViewName.oxtype = " . oxDb::getDb()->quote( $sWrapType );
00132 $oEntries->selectString( $sSelect );
00133
00134 return $oEntries;
00135 }
00136
00144 public function getWrappingCount( $sWrapType )
00145 {
00146 $sWrappingViewName = getViewName( 'oxwrapping' );
00147 $oDb = oxDb::getDb();
00148 $sQ = "select count(*) from $sWrappingViewName where $sWrappingViewName.oxactive = '1' and $sWrappingViewName.oxtype = " . $oDb->quote( $sWrapType );
00149 return (int) $oDb->getOne( $sQ );
00150 }
00151
00157 public function getFPrice()
00158 {
00159 return oxLang::getInstance()->formatCurrency( $this->getWrappingPrice()->getBruttoPrice(), $this->getConfig()->getActShopCurrencyObject() );
00160 }
00161
00167 public function getNoSslDynImageDir()
00168 {
00169 return $this->getConfig()->getPictureUrl(null, false, false, null, $this->oxwrapping__oxshopid->value);
00170 }
00171
00177 public function getPictureUrl()
00178 {
00179 if ( $this->oxwrapping__oxpic->value ) {
00180 return $this->getConfig()->getPictureUrl( "master/wrapping/".$this->oxwrapping__oxpic->value, false, $this->getConfig()->isSsl(), null, $this->oxwrapping__oxshopid->value );
00181 }
00182 }
00183 }