OXID eShop CE  4.10.1
 All Classes Namespaces Files Functions Variables Pages
oxtsproduct.php
Go to the documentation of this file.
1 <?php
2 
8 class oxTsProduct extends oxSuperCfg
9 {
10 
16  protected $_sTsId = null;
17 
23  protected $_iAmount = null;
24 
32  protected $_fPrice = null;
33 
41  protected $_fNettoPrice = null;
42 
50  protected $_fVatValue = null;
51 
57  protected $_oPrice = null;
58 
59 
65  protected $_dVat = null;
66 
72  protected $_sTsProtectProducts = array("TS080501_500_30_EUR" => array("netto" => "0.82", "amount" => "500"),
73  "TS080501_1500_30_EUR" => array("netto" => "2.47", "amount" => "1500"),
74  "TS080501_2500_30_EUR" => array("netto" => "4.12", "amount" => "2500"),
75  "TS080501_5000_30_EUR" => array("netto" => "8.24", "amount" => "5000"),
76  "TS080501_10000_30_EUR" => array("netto" => "16.47", "amount" => "10000"),
77  "TS080501_20000_30_EUR" => array("netto" => "32.94", "amount" => "20000")
78  );
79 
85  public function getVat()
86  {
87  return $this->_dVat;
88  }
89 
95  public function setVat($dVat)
96  {
97  $this->_dVat = $dVat;
98  }
99 
105  public function getTsId()
106  {
107  return $this->_sTsId;
108  }
109 
115  public function setTsId($sTsId)
116  {
117  $this->_sTsId = $sTsId;
118  }
119 
125  public function getAmount()
126  {
127  if ($this->_iAmount == null) {
128  if ($sTsId = $this->getTsId()) {
129  $aTsProducts = $this->getAllTsProducts();
130  if ($aTsProducts[$sTsId] && is_array($aTsProducts[$sTsId])) {
131  $this->_iAmount = $aTsProducts[$sTsId]['amount'];
132  }
133  }
134  }
135 
136  return $this->_iAmount;
137  }
138 
146  public function getFPrice()
147  {
148  if ($this->_fPrice == null) {
149  if ($oPrice = $this->getPrice()) {
150  $this->_fPrice = oxRegistry::getLang()->formatCurrency($oPrice->getBruttoPrice());
151  }
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 
172  return $this->_fNettoPrice;
173  }
174 
182  public function getFVatValue()
183  {
184  if ($this->_fVatValue == null) {
185  if ($oPrice = $this->getPrice()) {
186  $this->_fVatValue = oxRegistry::getLang()->formatCurrency($oPrice->getVatValue());
187  }
188  }
189 
190  return $this->_fVatValue;
191  }
192 
198  public function getPrice()
199  {
200  if ($this->_oPrice == null) {
201  if ($sTsId = $this->getTsId()) {
202  $aTsProducts = $this->getAllTsProducts();
203  if ($aTsProducts[$sTsId] && is_array($aTsProducts[$sTsId])) {
204  $dPrice = $aTsProducts[$sTsId]['netto'];
205  $oPrice = oxNew('oxPrice');
206  $oPrice->setNettoPriceMode();
207  $oPrice->setPrice($dPrice);
208  $oPrice->setVat($this->getVat());
209  $this->_oPrice = $oPrice;
210  }
211  }
212  }
213 
214  return $this->_oPrice;
215  }
216 
222  public function getAllTsProducts()
223  {
225  }
226 }