original_string: protected function submitOrderCheckout()
      {
          if (!$this->isPosted('save')) {
              return null;
          }
  
          $errors = array();
  
          foreach (array('payment', 'shipping') as $type) {
  
              $address_errors = $this->validateAddressCheckout($type);
  
              if (!empty($address_errors)) {
                  $errors = gplcart_array_merge($errors, $address_errors);
              }
  
              if (empty($address_errors)) {
                  $this->addAddressCheckout($type);
              }
          }
  
          $order_errors = $this->validateOrderCheckout();
          $errors = gplcart_array_merge($errors, $order_errors);
  
          if (empty($errors)) {
              $this->addOrderCheckout();
          } else {
              $this->setError(null, $errors);
          }
      }
code: protected function submitOrderCheckout()
      {
          if (!$this->isPosted('save')) {
              return null;
          }
  
          $errors = array();
  
          foreach (array('payment', 'shipping') as $type) {
  
              $address_errors = $this->validateAddressCheckout($type);
  
              if (!empty($address_errors)) {
                  $errors = gplcart_array_merge($errors, $address_errors);
              }
  
              if (empty($address_errors)) {
                  $this->addAddressCheckout($type);
              }
          }
  
          $order_errors = $this->validateOrderCheckout();
          $errors = gplcart_array_merge($errors, $order_errors);
  
          if (empty($errors)) {
              $this->addOrderCheckout();
          } else {
              $this->setError(null, $errors);
          }
      }
code_tokens: protected function submitOrderCheckout ( ) { if ( ! $ this -> isPosted ( 'save' ) ) { return null ; } $ errors = array ( ) ; foreach ( array ( 'payment' , 'shipping' ) as $ type ) { $ address_errors = $ this -> validateAddressCheckout ( $ type ) ; if ( ! empty ( $ address_errors ) ) { $ errors = gplcart_array_merge ( $ errors , $ address_errors ) ; } if ( empty ( $ address_errors ) ) { $ this -> addAddressCheckout ( $ type ) ; } } $ order_errors = $ this -> validateOrderCheckout ( ) ; $ errors = gplcart_array_merge ( $ errors , $ order_errors ) ; if ( empty ( $ errors ) ) { $ this -> addOrderCheckout ( ) ; } else { $ this -> setError ( null , $ errors ) ; } }
docstring: Saves an order to the database
docstring_tokens: Saves an order to the database