Skip to content

Instantly share code, notes, and snippets.

@IvanChepurnyi
Created July 19, 2012 13:11
Show Gist options
  • Save IvanChepurnyi/3143810 to your computer and use it in GitHub Desktop.
Save IvanChepurnyi/3143810 to your computer and use it in GitHub Desktop.
Any reason for using collection to retrieve single address instead of using load method of model?
// From app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php
/**
* Edit order address form
*/
public function addressAction()
{
$addressId = $this->getRequest()->getParam('address_id');
$address = Mage::getModel('sales/order_address')
->getCollection()
->addFilter('entity_id', $addressId)
->getItemById($addressId);
if ($address) {
Mage::register('order_address', $address);
$this->loadLayout();
// Do not display VAT validation button on edit order address form
$addressFormContainer = $this->getLayout()->getBlock('sales_order_address.form.container');
if ($addressFormContainer) {
$addressFormContainer->getChild('form')->setDisplayVatValidationButton(false);
}
$this->renderLayout();
} else {
$this->_redirect('*/*/');
}
}
@Zifius
Copy link

Zifius commented Jul 19, 2012

Has been fixed in Mage+ apparently mageplus/mageplus@b4332cd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment