oxwrapping.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxWrapping extends oxI18n
00008 {
00014     protected $_sCoreTbl = 'oxwrapping';
00015 
00021     protected $_sClassName = 'oxwrapping';
00022 
00028     protected $_oPrice = null;
00029 
00035     protected $_dVat = 0;
00036 
00043     public function __construct()
00044     {
00045         $this->setWrappingVat( $this->getConfig()->getConfigParam( 'dDefaultVAT' ) );
00046         parent::__construct();
00047         $this->init( 'oxwrapping' );
00048     }
00049 
00057     public function __get($sName)
00058     {
00059         switch ( $sName ) {
00060             case 'fprice':
00061                 $sValue = $this->getFPrice();
00062                 break;
00063             default:
00064                 $sValue = parent::__get( $sName );
00065         }
00066 
00067         return $sValue;
00068     }
00069 
00077     public function setWrappingVat( $dVat )
00078     {
00079         $this->_dVat = $dVat;
00080     }
00081 
00089     public function assign( $dbRecord )
00090     {
00091         // loading object from database
00092         parent::assign( $dbRecord );
00093 
00094         // setting image path
00095         $myConfig = $this->getConfig();
00096         // this will be removed later
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         // load wrapping
00131         $oEntries = oxNew( 'oxlist' );
00132         $oEntries->init( 'oxwrapping' );
00133         $sWrappingViewName = getViewName( 'oxwrapping' );
00134         $sSelect =  "select * from $sWrappingViewName where $sWrappingViewName.".$this->getSqlFieldName( '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.".$this->getSqlFieldName( '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 }

Generated on Tue Apr 21 15:45:45 2009 for OXID eShop CE by  doxygen 1.5.5