-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patch for code that is not following best practices in Magento development #46
Conversation
…o use more appropriate load() method of the model.
->getCollection() | ||
->addFilter('entity_id', $addressId) | ||
->getItemById($addressId); | ||
$address = Mage::getModel('Mage_Sales_Model_Order_Address')->load($addressId); | ||
if ($address) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collection method getItemById returns object instance if found and null otherwise.
Your code will return Mage_Sales_Model_Order_Address instance in any case.
So you need to change if statement to be something like this:
if ($address->getId() !== null)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ($address->getId()) is enough, just 10 lines of code later the similar construction is used.
…problem is visible if you have additional custom totals that need to be placed in between core ones.
…hp, to move them into separate branch
Closed in favor of #48 |
[Firedrakes] Bugfixes. Sprint 35
MC-42057: Fix jQuery.fn.resize()
See attached commit, where using of collection for retrieving address by id is replaced by using of standard load method of the model.