OXID eShop CE  4.9.7
 All Classes Files Functions Variables Pages
oxtsproduct.php
Go to the documentation of this file.
1 <?php
2 
7 class oxTsProduct extends oxSuperCfg
8 {
9 
15  protected $_sTsId = null;
16 
22  protected $_iAmount = null;
23 
31  protected $_fPrice = null;
32 
40  protected $_fNettoPrice = null;
41 
49  protected $_fVatValue = null;
50 
56  protected $_oPrice = null;
57 
58 
64  protected $_dVat = null;
65 
71  protected $_sTsProtectProducts = array("TS080501_500_30_EUR" => array("netto" => "0.82", "amount" => "500"),
72  "TS080501_1500_30_EUR" => array("netto" => "2.47", "amount" => "1500"),
73  "TS080501_2500_30_EUR" => array("netto" => "4.12", "amount" => "2500"),
74  "TS080501_5000_30_EUR" => array("netto" => "8.24", "amount" => "5000"),
75  "TS080501_10000_30_EUR" => array("netto" => "16.47", "amount" => "10000"),
76  "TS080501_20000_30_EUR" => array("netto" => "32.94", "amount" => "20000")
77  );
78 
84  public function getVat()
85  {
86  return $this->_dVat;
87  }
88 
94  public function setVat($dVat)
95  {
96  $this->_dVat = $dVat;
97  }
98 
104  public function getTsId()
105  {
106  return $this->_sTsId;
107  }
108 
114  public function setTsId($sTsId)
115  {
116  $this->_sTsId = $sTsId;
117  }
118 
124  public function getAmount()
125  {
126  if ($this->_iAmount == null) {
127  if ($sTsId = $this->getTsId()) {
128  $aTsProducts = $this->getAllTsProducts();
129  if ($aTsProducts[$sTsId] && is_array($aTsProducts[$sTsId])) {
130  $this->_iAmount = $aTsProducts[$sTsId]['amount'];
131  }
132  }
133  }
134 
135  return $this->_iAmount;
136  }
137 
145  public function getFPrice()
146  {
147  if ($this->_fPrice == null) {
148  if ($oPrice = $this->getPrice()) {
149  $this->_fPrice = oxRegistry::getLang()->formatCurrency($oPrice->getBruttoPrice());
150  }
151  }
152 
153  return $this->_fPrice;
154  }
155 
163  public function getFNettoPrice()
164  {
165  if ($this->_fNettoPrice == null) {
166  if ($oPrice = $this->getPrice()) {
167  $this->_fNettoPrice = oxRegistry::getLang()->formatCurrency($oPrice->getNettoPrice());
168  }
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 
189  return $this->_fVatValue;
190  }
191 
197  public function getPrice()
198  {
199  if ($this->_oPrice == null) {
200  if ($sTsId = $this->getTsId()) {
201  $aTsProducts = $this->getAllTsProducts();
202  if ($aTsProducts[$sTsId] && is_array($aTsProducts[$sTsId])) {
203  $dPrice = $aTsProducts[$sTsId]['netto'];
204  $oPrice = oxNew('oxPrice');
205  $oPrice->setNettoPriceMode();
206  $oPrice->setPrice($dPrice);
207  $oPrice->setVat($this->getVat());
208  $this->_oPrice = $oPrice;
209  }
210  }
211  }
212 
213  return $this->_oPrice;
214  }
215 
221  public function getAllTsProducts()
222  {
224  }
225 }