OXID eShop CE  4.8.12
 All Classes Files Functions Variables Pages
oxtsproduct.php
Go to the documentation of this file.
1 <?php
2 
7 class oxTsProduct extends oxSuperCfg
8 {
14  protected $_sTsId = null;
15 
21  protected $_iAmount = null;
22 
30  protected $_fPrice = null;
31 
39  protected $_fNettoPrice = null;
40 
48  protected $_fVatValue = null;
49 
55  protected $_oPrice = null;
56 
57 
63  protected $_dVat = null;
64 
70  protected $_sTsProtectProducts = array( "TS080501_500_30_EUR" => array( "netto" => "0.82", "amount" => "500" ),
71  "TS080501_1500_30_EUR" => array( "netto" => "2.47", "amount" => "1500" ),
72  "TS080501_2500_30_EUR" => array( "netto" => "4.12", "amount" => "2500" ),
73  "TS080501_5000_30_EUR" => array( "netto" => "8.24", "amount" => "5000" ),
74  "TS080501_10000_30_EUR" => array( "netto" => "16.47", "amount" => "10000" ),
75  "TS080501_20000_30_EUR" => array( "netto" => "32.94", "amount" => "20000" )
76  );
77 
83  public function getVat()
84  {
85  return $this->_dVat;
86  }
87 
95  public function setVat( $dVat )
96  {
97  $this->_dVat = $dVat;
98  }
99 
105  public function getTsId()
106  {
107  return $this->_sTsId;
108  }
109 
117  public function setTsId( $sTsId )
118  {
119  $this->_sTsId = $sTsId;
120  }
121 
127  public function getAmount()
128  {
129  if ( $this->_iAmount == null ) {
130  if ( $sTsId = $this->getTsId() ) {
131  $aTsProducts = $this->getAllTsProducts();
132  if ( $aTsProducts[$sTsId] && is_array($aTsProducts[$sTsId]) ) {
133  $this->_iAmount = $aTsProducts[$sTsId]['amount'];
134  }
135  }
136  }
137  return $this->_iAmount;
138  }
139 
147  public function getFPrice()
148  {
149  if ( $this->_fPrice == null ) {
150  if ( $oPrice = $this->getPrice() ) {
151  $this->_fPrice = oxRegistry::getLang()->formatCurrency( $oPrice->getBruttoPrice() );
152  }
153  }
154  return $this->_fPrice;
155  }
156 
164  public function getFNettoPrice()
165  {
166  if ( $this->_fNettoPrice == null ) {
167  if ( $oPrice = $this->getPrice() ) {
168  $this->_fNettoPrice = oxRegistry::getLang()->formatCurrency( $oPrice->getNettoPrice() );
169  }
170  }
171  return $this->_fNettoPrice;
172  }
173 
181  public function getFVatValue()
182  {
183  if ( $this->_fVatValue == null ) {
184  if ( $oPrice = $this->getPrice() ) {
185  $this->_fVatValue = oxRegistry::getLang()->formatCurrency( $oPrice->getVatValue() );
186  }
187  }
188  return $this->_fVatValue;
189  }
190 
196  public function getPrice()
197  {
198  if ( $this->_oPrice == null ) {
199  if ( $sTsId = $this->getTsId() ) {
200  $aTsProducts = $this->getAllTsProducts();
201  if ( $aTsProducts[$sTsId] && is_array($aTsProducts[$sTsId]) ) {
202  $dPrice = $aTsProducts[$sTsId]['netto'];
203  $oPrice = oxNew( 'oxPrice' );
204  $oPrice->setNettoPriceMode();
205  $oPrice->setPrice( $dPrice );
206  $oPrice->setVat( $this->getVat() );
207  $this->_oPrice = $oPrice;
208  }
209  }
210  }
211  return $this->_oPrice;
212  }
213 
219  public function getAllTsProducts()
220  {
222  }
223 }