I found this code below at AddressesPost.php
for addresses.phtml
. How can addresses.phtml
send parameter continue
or new_address
so AddressesPost.php
can getParam('continue')
or getParam('new_address')
?
AddressesPost.php :
if ($this->getRequest()->getParam('continue', false)) {
$this->_getCheckout()->setCollectRatesFlag(true);
$this->_getState()->setActiveStep(State::STEP_SHIPPING);
$this->_getState()->setCompleteStep(State::STEP_SELECT_ADDRESSES);
$this->_redirect('*/*/shipping');
} elseif ($this->getRequest()->getParam('new_address')) {
$this->_redirect('*/checkout_address/newShipping');
} else {
$this->_redirect('*/*/addresses');
}
I already add <input type="hidden" name="split" value="0" id="split_flag"/>
and <input type="hidden" name="update" value="0" id="update_flag"/>
in addresses.phtml
and the getParam in controller like in code below.
Controller :
elseif ($this->getRequest()->getParam('new_address')) {
$this->_redirect('*/checkout_address/newShipping');
} elseif ($this->getRequest()->getParam('split')) {
$btn = $this->getRequest()->getPost('btn');
if($post = $this->getRequest()->getPost('split')){
$this->_getCheckout()->setSplitItemInformation($post, $btn);
} else{
$this->_redirect('*/*/addresses');
}
} elseif ($this->getRequest()->getParam('update')) {
$this->messageManager->addError('test');
$this->_redirect('*/*/addresses');
} else {
$this->_redirect('*/*/addresses');
}
It's work for getParam('split'), but it's not work for getParam('update').