oxsimplevariant.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxSimpleVariant extends oxI18n
00008 {
00009 
00015     protected $_blUseLazyLoading = true;
00016 
00022     protected $_oPrice = null;
00023 
00029     protected $_oParent = null;
00030 
00035     public function __construct()
00036     {
00037         parent::__construct();
00038         $this->_sCacheKey = "simplevariants";
00039         $this->init( 'oxarticles' );
00040     }
00041 
00048     public function getSelectLists()
00049     {
00050         return null;
00051     }
00052 
00058     public function getPrice()
00059     {
00060         if (!is_null($this->_oPrice)) {
00061             return $this->_oPrice;
00062         }
00063 
00064         $this->_oPrice = oxNew("oxPrice");
00065         $dPrice = $this->oxarticles__oxprice->value;
00066         if (!$dPrice) {
00067             $dPrice = $this->_getParentPrice();
00068         }
00069 
00070         $this->_oPrice->setPrice($dPrice, $this->_dVat);
00071 
00072         $this->_applyParentVat($this->_oPrice);
00073 
00074         return $this->_oPrice;
00075     }
00076 
00083     protected function _applyParentVat($oPrice)
00084     {
00085         $oParent = $this->getParent();
00086         if (!($oParent instanceof oxarticle)) {
00087             return;
00088         }
00089 
00090         $oParent->applyVats($oPrice);
00091     }
00092 
00100     public function setPrice($oPrice)
00101     {
00102         $this->_oPrice = $oPrice;
00103     }
00104 
00110     public function getFPrice()
00111     {
00112         if ( $oPrice = $this->getPrice() ) {
00113             return oxLang::getInstance()->formatCurrency( $oPrice->getBruttoPrice() );
00114         } else {
00115             return null;
00116         }
00117     }
00118 
00126     public function setParent($oParent)
00127     {
00128         $this->_oParent = $oParent;
00129     }
00130 
00136     public function getParent()
00137     {
00138         return $this->_oParent;
00139     }
00140 
00146     protected function _getParentPrice()
00147     {
00148 
00149         if (isset($this->_oParent->oxarticles__oxprice->value)) {
00150             return $this->_oParent->oxarticles__oxprice->value;
00151         }
00152 
00153         return 0;
00154     }
00155 }

Generated on Wed May 13 13:25:51 2009 for OXID eShop CE by  doxygen 1.5.5