-
-
Notifications
You must be signed in to change notification settings - Fork 436
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
Directory currency - performance optimalization #1252
Directory currency - performance optimalization #1252
Conversation
Update from LTS
Updating from LTS repository
$defaultCurrencies = (string) Mage::app()->getConfig()->getNode(self::XML_PATH_CURRENCY_BASE, 'default'); | ||
return [$defaultCurrencies]; |
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.
why not change only the Mage_Directory_Model_Resource_Currency::getConfigCurrencies
to use config (which is cached) ?
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.
Agreed, there doesn't seem to be any good reason to directly query the config table so getConfigCurrencies
could simply be:
/**
* @deprecated
*/
public function getConfigCurrencies($model, $path)
{
return (string) Mage::app()->getConfig()->getNode($path, 'default');
}
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.
you can't do this return explode(',', (string) Mage::app()->getConfig()->getNode($path, 'default'));
, bcs. you can customize settings per website/store scope
This sounds like a nice improvement.
|
Or alternative solution (in my opinion us ugly, but complete without any additional SQL query):
|
@Sekiphp I like it! I would only create variable for |
@midlan Yeah, I can do it, it can improve readability of code |
@midlan @colinmollenhour @tmotyl @FreeWall Final solution is here :-) |
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.
approved
worth to the note that the trim
seems fixing an issue that occurred elsewhere (probably the config edit form)
Very nice. May I suggest a few improvements?
|
The base branch was changed.
@colinmollenhour Can you create issue for your suggestions? |
Description (*)
Lowering count of SQL queries when someone use this methods:
getConfigAllowCurrencies
getConfigBaseCurrencies
Fix unique currency which is at the end of string for mthod
getConfigAllowCurrencies
.Manual testing scenarios
getConfigBaseCurrencies
(*)Call this code:
Database:
SQL queries before: 2
SQL queries after: 0
Output from method is in same format.
Manual testing scenarios
getConfigAllowCurrencies
(*)**For this data in database: **
Call this code:
Output before changes:
Output afterchanges:
Related SQL queries before:
Related SQL queries after:
Contribution checklist (*)