53 $sId = $oUser->
getId();
54 if ( array_key_exists( $sId, self::$_aUserVatCache ) &&
55 self::$_aUserVatCache[$sId] !== null) {
56 return self::$_aUserVatCache[$sId];
65 $oCountry =
oxNew(
'oxcountry');
66 if (!$oCountry->load($sCountryId)) {
67 throw oxNew(
"oxObjectException" );
69 if ($oCountry->isForeignCountry()) {
74 self::$_aUserVatCache[$oUser->
getId()] = $ret;
89 if ($oUser->oxuser__oxustid->value) {
108 $sCatT = getViewName(
'oxcategories');
110 if ( $this->_blCatVatSet === null ) {
111 $sSelect =
"SELECT oxid FROM $sCatT WHERE oxvat IS NOT NULL LIMIT 1";
115 $this->_blCatVatSet = (bool) $oDb->getOne( $sSelect );
118 if ( !$this->_blCatVatSet ) {
122 $sO2C = getViewName(
'oxobject2category');
123 $sSql =
"SELECT c.oxvat
124 FROM $sCatT AS c, $sO2C AS o2c
125 WHERE c.oxid=o2c.oxcatnid AND
126 o2c.oxobjectid = ".$oDb->quote( $oArticle->
getId() ).
" AND
128 ORDER BY o2c.oxtime ";
130 $fVat = $oDb->getOne($sSql);
131 if ($fVat !==
false && $fVat !== null) {
147 startProfile(
"_assignPriceInternal");
150 if ( ( $dArticleVat = $oArticle->
getCustomVAT() ) !== null ) {
151 stopProfile(
"_assignPriceInternal");
155 stopProfile(
"_assignPriceInternal");
159 stopProfile(
"_assignPriceInternal");
160 return $this->
getConfig()->getConfigParam(
'dDefaultVAT' );
204 $blUseShippingCountry = $this->
getConfig()->getConfigParam(
"blShippingCountryVat");
206 if ($blUseShippingCountry) {
207 $aAddresses = $oUser->getUserAddresses($oUser->getId());
208 $sSelectedAddress = $oUser->getSelectedAddressId();
210 if (isset($aAddresses[$sSelectedAddress])) {
211 return $aAddresses[$sSelectedAddress]->oxaddress__oxcountryid->value;
215 return $oUser->oxuser__oxcountryid->value;