/** * @param Market_AddressModel $address * @param Market_TaxZoneModel $zone * @return bool */ private function matchAddress(Market_AddressModel $address = null, Market_TaxZoneModel $zone) { //when having no address check default tax zones only if (!$address) { return $zone->default; } if ($zone->countryBased) { $countriesIds = $zone->getCountriesIds(); if (in_array($address->countryId, $countriesIds)) { return true; } } else { foreach ($zone->states as $state) { if ($state->country->id == $address->countryId && $state->name == $address->getStateText()) { return true; } } } return false; }
/** * @return Market_AddressModel */ public function getBillingAddress() { if (!isset($this->_billingAddress)) { // Get the live linked address if it is still a cart, else cached if (!$this->dateOrdered) { $this->_billingAddress = craft()->market_address->getAddressById($this->billingAddressId); } else { $this->_billingAddress = Market_AddressModel::populateModel($this->billingAddressData); } } return $this->_billingAddress; }