OXID eShop CE  4.9.6
 All Classes Files Functions Variables Pages
oxcountry.php
Go to the documentation of this file.
1 <?php
2 
3 
8 class oxCountry extends oxI18n
9 {
10 
16  protected $_sClassName = 'oxcountry';
17 
23  protected $_aStates = null;
24 
28  public function __construct()
29  {
31  $this->init('oxcountry');
32  }
33 
39  public function isForeignCountry()
40  {
41  return !in_array($this->getId(), $this->getConfig()->getConfigParam('aHomeCountry'));
42  }
43 
49  public function isInEU()
50  {
51  return (bool) ($this->oxcountry__oxvatstatus->value == 1);
52  }
53 
59  public function getStates()
60  {
61  if (!is_null($this->_aStates)) {
62  return $this->_aStates;
63  }
64 
65  $sCountryId = $this->getId();
66  $sViewName = getViewName("oxstates", $this->getLanguage());
67  $sQ = "select * from {$sViewName} where `oxcountryid` = '$sCountryId' order by `oxtitle` ";
68  $this->_aStates = oxNew("oxlist");
69  $this->_aStates->init("oxstate");
70  $this->_aStates->selectString($sQ);
71 
72  return $this->_aStates;
73  }
74 
82  public function getIdByCode($sCode)
83  {
84  $oDb = oxDb::getDb();
85 
86  return $oDb->getOne("select oxid from oxcountry where oxisoalpha2 = " . $oDb->quote($sCode));
87  }
88 
95  {
96  return $this->oxcountry__oxvatinprefix->value;
97  }
98 
99 }