When magento resizes images, resized images always loss their original colors. whether you set quality to 100 or not. Maybe it’s okay to live with to some of us.
But what if it’s true color such as white(#FFF) or black(#000)? As far as I tested, GD2(magento default image lib) doesn’t really handle well with these. So if you really want to keep white color as white then you will need some update on magento’s GD2 file.
So here is the sample code for fixing white color issues.
Magento provides a robust ORM for accessing data from various modules, without having to write any SQL. It also provides abstraction for the underlying RDBMS.
An example below illustrates loading of a product collection, if our task required getting names and SKUs of all simple products in the system, which are enabled, sorted by SKU:
$products = Mage::getModel('catalog/product')
Module rewriting should be the second choice, after it is determined to be the absolute necessity, and impossible to achieve with the use of observers.
Do not use local/Mage
It may be tempting to simply copy the desired files, in their entirety, from core/Mage to local/Mage, but this method violates Magento coding standards. This method technically functions due to Magento’s autoloader searching for the given classes inside the local pool, before proceeding to the core, effectively forcing the copied classes to be loaded first. This is considered to be bad practice, as it makes upgradability significantly more difficult. Even a minor version bump is meant to replace all files inside core/Mage. If any of these files are rewritten in local/Mage, then the updated files will never be executed, and outdated versions from local scope will continue to be used. Furthermore, copying of entire files, rather than rewriting specific methods, include redundant code, that is not necessarily being changed. Edits and customizations become difficult to track and maintain.
Observers are the preferred way of extending Magento’s core functionality. Observers simplify upgradability of code, as they do not overwrite any core classes. Furthermore, they reduce the possibility of conflict between modules and extensions. Multiple modules can observe the same event. To accomplish a similar task using rewrites, class chaining would be required.
The example below will illustrate observing an event which fires after a product is added to a cart.