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 setWrappingVat( $dVat )
00058     {
00059         $this->_dVat = $dVat;
00060     }
00061 
00069     public function assign( $dbRecord )
00070     {
00071         // loading object from database
00072         parent::assign( $dbRecord );
00073 
00074         // setting image path
00075         $myConfig = $this->getConfig();
00076     }
00077 
00085     public function getWrappingPrice( $dAmount = 1 )
00086     {
00087         if ( $this->_oPrice === null ) {
00088             $this->_oPrice = oxNew( 'oxprice' );
00089 
00090             $oCur = $this->getConfig()->getActShopCurrencyObject();
00091             $this->_oPrice->setPrice( $this->oxwrapping__oxprice->value * $oCur->rate, $this->_dVat );
00092             $this->_oPrice->multiply( $dAmount );
00093         }
00094 
00095         return $this->_oPrice;
00096     }
00097 
00105     public function getWrappingList( $sWrapType )
00106     {
00107         // load wrapping
00108         $oEntries = oxNew( 'oxlist' );
00109         $oEntries->init( 'oxwrapping' );
00110         $sWrappingViewName = getViewName( 'oxwrapping' );
00111         $sSelect =  "select * from $sWrappingViewName where $sWrappingViewName.oxactive = '1' and $sWrappingViewName.oxtype = " . oxDb::getDb()->quote( $sWrapType );
00112         $oEntries->selectString( $sSelect );
00113 
00114         return $oEntries;
00115     }
00116 
00124     public function getWrappingCount( $sWrapType )
00125     {
00126         $sWrappingViewName = getViewName( 'oxwrapping' );
00127         $sQ = "select count(*) from $sWrappingViewName where $sWrappingViewName.oxactive = '1' and $sWrappingViewName.oxtype = " . oxDb::getDb()->quote( $sWrapType );
00128         return (int) oxDb::getDb()->getOne( $sQ );
00129     }
00130 
00136     public function getFPrice()
00137     {
00138         return oxLang::getInstance()->formatCurrency( $this->getWrappingPrice()->getBruttoPrice(), $this->getConfig()->getActShopCurrencyObject() );
00139     }
00140 
00146     public function getNoSslDynImageDir()
00147     {
00148         return $this->getConfig()->getPictureUrl(null, false, false, null, $this->oxwrapping__oxshopid->value);
00149     }
00150 
00156     public function getPictureUrl()
00157     {
00158         if ( $this->oxwrapping__oxpic->value ) {
00159            return $this->getConfig()->getPictureUrl( "master/wrapping/".$this->oxwrapping__oxpic->value, false, $this->getConfig()->isSsl(), null, $this->oxwrapping__oxshopid->value );
00160         }
00161     }
00162 }