public function __construct($code = null) { if ($base = shopp_setting('base_locale')) { if (isset($base[0])) { $this->code = $base[0]; } if (isset($base[1])) { $this->state = $base[1]; } } else { $this->code = $this->legacy(); } if (empty($this->code)) { $this->code = 'US'; } parent::__construct($this->code); }
/** * Sets the address location for calculating tax and shipping estimates * * @author Jonathan Davis * @since 1.1 * * @param array $data New address data to update * @return void **/ public function locate(array $data = null) { if ($data) { $this->updates($data); } if (empty($this->country)) { if (1 == count($markets)) { // If the target markets are set to single country, $this->country = key($markets); } else { $this->country = ShoppBaseLocale()->country(); } // base of operations } $Locale = new ShoppLocale($this->country); $this->region = $Locale->region(); // Update state if the postcode exists for tax updates if (isset($this->postcode)) { $this->postmap(); } }