Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AddressesPost.php
Go to the documentation of this file.
1 <?php
8 
10 
12 {
18  public function execute()
19  {
20  if (!$this->_getCheckout()->getCustomerDefaultShippingAddress()) {
21  $this->_redirect('*/checkout_address/newShipping');
22  return;
23  }
24  try {
25  if ($this->getRequest()->getParam('continue', false)) {
26  $this->_getCheckout()->setCollectRatesFlag(true);
27  $this->_getState()->setActiveStep(State::STEP_SHIPPING);
28  $this->_getState()->setCompleteStep(State::STEP_SELECT_ADDRESSES);
29  $this->_redirect('*/*/shipping');
30  } elseif ($this->getRequest()->getParam('new_address')) {
31  $this->_redirect('*/checkout_address/newShipping');
32  } else {
33  $this->_redirect('*/*/addresses');
34  }
35  if ($shipToInfo = $this->getRequest()->getPost('ship')) {
36  $this->_getCheckout()->setShippingItemsInformation($shipToInfo);
37  }
38  } catch (\Magento\Framework\Exception\LocalizedException $e) {
39  $this->messageManager->addError($e->getMessage());
40  $this->_redirect('*/*/addresses');
41  } catch (\Exception $e) {
42  $this->messageManager->addException($e, __('Data saving problem'));
43  $this->_redirect('*/*/addresses');
44  }
45  }
46 }
_redirect($path, $arguments=[])
Definition: Action.php:167
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
__()
Definition: __.php:13
execute()