OXID eShop CE  4.10.5
 All Classes Namespaces Files Functions Variables Pages
oxrequiredaddressfields.php
Go to the documentation of this file.
1 <?php
2 
7 {
8 
14  private $_aDefaultRequiredFields = array(
15  'oxuser__oxfname',
16  'oxuser__oxlname',
17  'oxuser__oxstreetnr',
18  'oxuser__oxstreet',
19  'oxuser__oxzip',
20  'oxuser__oxcity'
21  );
22 
28  private $_aRequiredFields = array();
29 
34  public function __construct()
35  {
36  $this->setRequiredFields($this->_aDefaultRequiredFields);
37 
38  $aRequiredFields = oxRegistry::getConfig()->getConfigParam('aMustFillFields');
39  if (is_array($aRequiredFields)) {
40  $this->setRequiredFields($aRequiredFields);
41  }
42  }
43 
49  public function setRequiredFields($aRequiredFields)
50  {
51  $this->_aRequiredFields = $aRequiredFields;
52  }
53 
59  public function getRequiredFields()
60  {
62  }
63 
69  public function getBillingFields()
70  {
71  $aRequiredFields = $this->getRequiredFields();
72 
73  return $this->_filterFields($aRequiredFields, 'oxuser__');
74  }
75 
81  public function getDeliveryFields()
82  {
83  $aRequiredFields = $this->getRequiredFields();
84 
85  return $this->_filterFields($aRequiredFields, 'oxaddress__');
86  }
87 
96  private function _filterFields($aFields, $sPrefix)
97  {
98  $aAllowed = array();
99  foreach ($aFields as $sKey => $sValue) {
100  if (strpos($sValue, $sPrefix) === 0) {
101  $aAllowed[] = $aFields[$sKey];
102  }
103  }
104 
105  return $aAllowed;
106  }
107 }