oxtsproduct.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxTsProduct extends oxSuperCfg
00008 {
00009 
00015     protected $_sTsId = null;
00016 
00022     protected $_iAmount = null;
00023 
00031     protected $_fPrice = null;
00032 
00040     protected $_fNettoPrice = null;
00041 
00049     protected $_fVatValue = null;
00050 
00056     protected $_oPrice = null;
00057 
00058 
00064     protected $_dVat = null;
00065 
00071     protected $_sTsProtectProducts = array("TS080501_500_30_EUR"   => array("netto" => "0.82", "amount" => "500"),
00072                                            "TS080501_1500_30_EUR"  => array("netto" => "2.47", "amount" => "1500"),
00073                                            "TS080501_2500_30_EUR"  => array("netto" => "4.12", "amount" => "2500"),
00074                                            "TS080501_5000_30_EUR"  => array("netto" => "8.24", "amount" => "5000"),
00075                                            "TS080501_10000_30_EUR" => array("netto" => "16.47", "amount" => "10000"),
00076                                            "TS080501_20000_30_EUR" => array("netto" => "32.94", "amount" => "20000")
00077     );
00078 
00084     public function getVat()
00085     {
00086         return $this->_dVat;
00087     }
00088 
00094     public function setVat($dVat)
00095     {
00096         $this->_dVat = $dVat;
00097     }
00098 
00104     public function getTsId()
00105     {
00106         return $this->_sTsId;
00107     }
00108 
00114     public function setTsId($sTsId)
00115     {
00116         $this->_sTsId = $sTsId;
00117     }
00118 
00124     public function getAmount()
00125     {
00126         if ($this->_iAmount == null) {
00127             if ($sTsId = $this->getTsId()) {
00128                 $aTsProducts = $this->getAllTsProducts();
00129                 if ($aTsProducts[$sTsId] && is_array($aTsProducts[$sTsId])) {
00130                     $this->_iAmount = $aTsProducts[$sTsId]['amount'];
00131                 }
00132             }
00133         }
00134 
00135         return $this->_iAmount;
00136     }
00137 
00145     public function getFPrice()
00146     {
00147         if ($this->_fPrice == null) {
00148             if ($oPrice = $this->getPrice()) {
00149                 $this->_fPrice = oxRegistry::getLang()->formatCurrency($oPrice->getBruttoPrice());
00150             }
00151         }
00152 
00153         return $this->_fPrice;
00154     }
00155 
00163     public function getFNettoPrice()
00164     {
00165         if ($this->_fNettoPrice == null) {
00166             if ($oPrice = $this->getPrice()) {
00167                 $this->_fNettoPrice = oxRegistry::getLang()->formatCurrency($oPrice->getNettoPrice());
00168             }
00169         }
00170 
00171         return $this->_fNettoPrice;
00172     }
00173 
00181     public function getFVatValue()
00182     {
00183         if ($this->_fVatValue == null) {
00184             if ($oPrice = $this->getPrice()) {
00185                 $this->_fVatValue = oxRegistry::getLang()->formatCurrency($oPrice->getVatValue());
00186             }
00187         }
00188 
00189         return $this->_fVatValue;
00190     }
00191 
00197     public function getPrice()
00198     {
00199         if ($this->_oPrice == null) {
00200             if ($sTsId = $this->getTsId()) {
00201                 $aTsProducts = $this->getAllTsProducts();
00202                 if ($aTsProducts[$sTsId] && is_array($aTsProducts[$sTsId])) {
00203                     $dPrice = $aTsProducts[$sTsId]['netto'];
00204                     $oPrice = oxNew('oxPrice');
00205                     $oPrice->setNettoPriceMode();
00206                     $oPrice->setPrice($dPrice);
00207                     $oPrice->setVat($this->getVat());
00208                     $this->_oPrice = $oPrice;
00209                 }
00210             }
00211         }
00212 
00213         return $this->_oPrice;
00214     }
00215 
00221     public function getAllTsProducts()
00222     {
00223         return $this->_sTsProtectProducts;
00224     }
00225 }