original_string: protected function setFormDataAddressCheckout()
      {
          $countries = array();
  
          foreach ((array) $this->country->getList(array('status' => true)) as $code => $country) {
              $countries[$code] = $country['native_name'];
          }
  
          $default_country = count($countries) == 1 ? key($countries) : '';
  
          $address = $this->getSubmitted('address', array());
  
          if (!isset($address['payment']['country'])) {
              $address['payment']['country'] = $default_country;
          }
  
          if (!isset($address['shipping']['country'])) {
              $address['shipping']['country'] = $default_country;
          }
  
          $this->data_form['address'] = $address;
          $this->data_form['countries'] = $countries;
          $this->data_form['addresses'] = $this->address->getTranslatedList($this->order_user_id);
  
          $excessed = $this->address->getExceeded($this->order_user_id, $this->data_form['addresses']);
  
          $this->data_form['can_add_address'] = empty($excessed);
          $this->data_form['can_save_address'] = empty($excessed) && !empty($this->uid);
  
          foreach ($address as $type => $fields) {
              $this->data_form['format'][$type] = $this->country->getFormat($fields['country']);
              $this->data_form['states'][$type] = $this->state->getList(array('country' => $fields['country'], 'status' => 1));
              if (empty($this->data_form['states'][$type])) {
                  unset($this->data_form['format'][$type]['state_id']);
              }
          }
      }
code: protected function setFormDataAddressCheckout()
      {
          $countries = array();
  
          foreach ((array) $this->country->getList(array('status' => true)) as $code => $country) {
              $countries[$code] = $country['native_name'];
          }
  
          $default_country = count($countries) == 1 ? key($countries) : '';
  
          $address = $this->getSubmitted('address', array());
  
          if (!isset($address['payment']['country'])) {
              $address['payment']['country'] = $default_country;
          }
  
          if (!isset($address['shipping']['country'])) {
              $address['shipping']['country'] = $default_country;
          }
  
          $this->data_form['address'] = $address;
          $this->data_form['countries'] = $countries;
          $this->data_form['addresses'] = $this->address->getTranslatedList($this->order_user_id);
  
          $excessed = $this->address->getExceeded($this->order_user_id, $this->data_form['addresses']);
  
          $this->data_form['can_add_address'] = empty($excessed);
          $this->data_form['can_save_address'] = empty($excessed) && !empty($this->uid);
  
          foreach ($address as $type => $fields) {
              $this->data_form['format'][$type] = $this->country->getFormat($fields['country']);
              $this->data_form['states'][$type] = $this->state->getList(array('country' => $fields['country'], 'status' => 1));
              if (empty($this->data_form['states'][$type])) {
                  unset($this->data_form['format'][$type]['state_id']);
              }
          }
      }
code_tokens: protected function setFormDataAddressCheckout ( ) { $ countries = array ( ) ; foreach ( ( array ) $ this -> country -> getList ( array ( 'status' => true ) ) as $ code => $ country ) { $ countries [ $ code ] = $ country [ 'native_name' ] ; } $ default_country = count ( $ countries ) == 1 ? key ( $ countries ) : '' ; $ address = $ this -> getSubmitted ( 'address' , array ( ) ) ; if ( ! isset ( $ address [ 'payment' ] [ 'country' ] ) ) { $ address [ 'payment' ] [ 'country' ] = $ default_country ; } if ( ! isset ( $ address [ 'shipping' ] [ 'country' ] ) ) { $ address [ 'shipping' ] [ 'country' ] = $ default_country ; } $ this -> data_form [ 'address' ] = $ address ; $ this -> data_form [ 'countries' ] = $ countries ; $ this -> data_form [ 'addresses' ] = $ this -> address -> getTranslatedList ( $ this -> order_user_id ) ; $ excessed = $ this -> address -> getExceeded ( $ this -> order_user_id , $ this -> data_form [ 'addresses' ] ) ; $ this -> data_form [ 'can_add_address' ] = empty ( $ excessed ) ; $ this -> data_form [ 'can_save_address' ] = empty ( $ excessed ) && ! empty ( $ this -> uid ) ; foreach ( $ address as $ type => $ fields ) { $ this -> data_form [ 'format' ] [ $ type ] = $ this -> country -> getFormat ( $ fields [ 'country' ] ) ; $ this -> data_form [ 'states' ] [ $ type ] = $ this -> state -> getList ( array ( 'country' => $ fields [ 'country' ] , 'status' => 1 ) ) ; if ( empty ( $ this -> data_form [ 'states' ] [ $ type ] ) ) { unset ( $ this -> data_form [ 'format' ] [ $ type ] [ 'state_id' ] ) ; } } }
docstring: Sets the checkout address variables
docstring_tokens: Sets the checkout address variables