/**
  * Returns user shipping address country id.
  *
  * @param oxUser $oUser
  *
  * @return string
  */
 protected function _getUserShippingCountryId($oUser)
 {
     if ($oUser->getSelectedAddressId() && $oUser->getSelectedAddress()) {
         $sCountryId = $oUser->getSelectedAddress()->oxaddress__oxcountryid->value;
     } else {
         $sCountryId = $oUser->oxuser__oxcountryid->value;
     }
     return $sCountryId;
 }
Example #2
0
 /**
  * Returns country id which VAT should be applied to.
  * Depending on configuration option either user billing country or shipping country (if available) is returned.
  *
  * @param oxUser $oUser user object
  *
  * @return string
  */
 protected function _getVatCountry(oxUser $oUser)
 {
     $blUseShippingCountry = $this->getConfig()->getConfigParam("blShippingCountryVat");
     if ($blUseShippingCountry) {
         $aAddresses = $oUser->getUserAddresses($oUser->getId());
         $sSelectedAddress = $oUser->getSelectedAddressId();
         if (isset($aAddresses[$sSelectedAddress])) {
             return $aAddresses[$sSelectedAddress]->oxaddress__oxcountryid->value;
         }
     }
     return $oUser->oxuser__oxcountryid->value;
 }