Best Way of Upgrading Magento 1

Magento 1 applications were never made easy to upgrade, whether that was upgrading a minor version (1.9.0 to 1.9.1) or a major version (1.8.0 to 1.9.0). A lot of discussions between users online involved long winded methods, such as copying across product, customer and order data which carried major risks in corrupting the database. The …

Code Optimisation Techniques in Magento

A vanilla install of Magento will usually have a page load time of under a second, even with all cache types disabled in the admin. As functionality gets added to the Magento application, the more configuration it has to load and there is an decrease in page speed. However, there are many examples of …

Magento Varien Object

Within Magento you’ll have probably come across methods where you can retrieve data from certain entities. For example, to load a simple product you would write the following code below.
And to get data from certain attributes, you might use the example shown below.
You can also set data on certain attributes.
Furthermore, if you …

Magento Class Inheritance List

The Magento class inheritance list below represents classes that are used when extending Magento functionality. This includes when defining new classes and the parent classes that they should extend from.

Custom blocks should extend the Mage_Core_Block_Template class.
The Mage_Core_Block_Template class in turn extends the Mage_Core_Block_Abstract class.
Mage_Core_Block_Abstract also extends the Varien_Object class.

Magento EAV Loading and Saving

What makes something either a simple Model or an EAV Model in Magento is its Model Resource.
Whenever you’ve defined a custom model, resource model and collection, more than likely your resource model will extend the Mage_Core_Model_Resource_Db_Abstract class.
An EAV resource model extends the Mage_Eav_Model_Entity_Abstract class, rather than Mage_Core_Model_Resource_Db_Abstract.
Their collections also extend the Mage_Eav_Model_Entity_Collection …

Magento Store Configuration

Within Magento, we can use useful methods to return data that is saved within Magento’s configuration.
When using the getStoreConfig() method, we can pass in a single string parameter.
The sectionName, groupName and fieldName are present under the <sections>, <groups> and <fields> nodes respectively in the system.xml files of Magento.
As an example, …

Magento Dispatch Process

Following on from the Magento Front Controller article, we now take a look at the Magento dispatch process within the dispatch() method. Let’s take a look at it.
Firstly, we check the base URL using the _checkBaseUrl() method. This method will redirect a visitor to the configured base URL if the current request does not …

Magento ACL Permissions

Magento ACL Permissions are used with the admin area and check to see whether a user has permission to access a particular area.
Within the preDispatch() method of the Mage_Adminhtml_Controller_Action class, a call to the _isAllowed() method is made.
The isAllowed() method is usually overridden in module’s individual controller file, such as the ProductController.php file.

Magento Dispatch Event

When Magento dispatches an event, observers can execute code by listening to these events. There are a lot of references to the Magento dispatch event method within Magento. An example of how this might look can be seen below.
We can look at this method in more depth by navigation to the Mage.php class.
Take …

Magento Autoloading

Magento makes use of PHP 5’s autoloading feature to include classes. One of the more irritating aspects of a large application is including class files at the top of each script every time you create a new class. Autoloading eliminates this problem. This article represents how Magento uses its Varien_Autoload class.
Firstly, Magento sets its …