Keep your aspirin in the drawer with these words of Magento shop wisdom.
Magento continues to excel as the leading open-source ecommerce platform. Its inherent flexibility serves as a blank canvas for merchants and developers to solve complex problems. With that power at our disposal, we are served well to avoid common mistakes that would otherwise make our Magento 1 shop a disaster. I’d like to show developers three ways to avoid some of that pain, keeping your headaches to a minimum.
3 Ways to Keep Headaches at a Minimum With Magento
Those of you who have been on the Magento 1 platform over the last couple of years would know that a series of exploits and subsequent patches have rocked the community and have forced integrators to endure serious hardship to strengthen the safety of their shops. A lot of that hardship is the result of poorly architected systems; and systems, which have had extensive modifications, made to its core.
When working with your team, it’s important to consider that some small but foundational changes to the development process can dramatically improve the efficiency of applying security patches. Here are a few tools of the trade that help.
This modularizing tool allows a developer to keep his customizations to Magento away from its core. Using a technique known as “symlinking,” the developer is able to instantly deploy, update, and repair his modules without modifying the core structure of the system. The benefit: major Magento system upgrades are more reliable.
2. Review Core Modifications
A tenet of good Magento development is when no modifications to the core have been made. Yet, it is almost inevitable that your shop will at some point inherit these blemishes. Before upgrading your system, use a tool like n98-magerun to scan for these problems. It supports an extension called the Magento Project Mess Detector, which can find core overrides and hacks that might break your shop during an upgrade. The benefit: it preserves the integrity of your shop.
3. Version Control (duh)
This is no surprise to the majority, and yet you would be surprised by the number of Magento shops still running without version control. Get it and use it from your development setups, to staging, to production environments. If your team is not using it, then you are putting the merchant at significant risk. Version control lets you see every change to your system, so that you can more easily infer the likelihood of an upgrade problem. The benefit: you won’t be clueless about what’s going on with your system.
Scheduled Task Management
Magento supports background processes. These are often used to sync or transfer information from third-party services that will integrate with your shop. For example, some shops need to export order data on a nightly basis to an ERP. Your shop likely has several running at any given hour of the day. Unfortunately, they run in the background with little to no visibility.
Solving this problem, is an extension for Magento 1 built by AOE which enhances Magento background process management. For shops featuring much custom integration, and especially those in the B2B space, AOE Scheduler lets you view the status of running jobs, in both a traditional table view and a useful graph form.
Use a Profiler
As we build and maintain Magento shops, it’s easy to overlook the quality and performance of our work. But take a moment of caution, to consider the value of doing something right the first time. As you are developing features to enhance your shops, take advantage of the built-in Magento profiler.
What’s great about this tool is that it allows you to see where performance issues may lie. Some common problem areas are the main navigation menu and product listing customizations.
In the example above, we can see exactly how long a particular process took to complete. We can also see how much memory each process consumed.
The profiler can describe a large number of core Magento processes. However, it would be wise to also profile your own customizations. To do this, we can simply wrap our suspect process with profiler activity, like so:
<?php /* File: app/code/local/Namespace/Module/Block/Catalog/Product/List.php */ ?>
public function getCustomProductData(Mage_Catalog_Model_Product $product)
$resource = Mage::getSingleton(‘core/resource’);
$adapter = $resource->getConnection(‘core_read’);
$select = $adapter->select()
->where(‘product_id = ?’, $product->getId());
$data = $adapter->fetchRow($select);
In this example, we are measuring the performance of a particular call to the database. During the course of our development, it may seem innocuous to make a call to the database for a product. But consider the impact of repeating this call hundreds or thousands of times per request. On the outside, you might just see another slow Magento shop. But if you were to profile your own work, you could more easily identify a solution to these problems.
Don’t be without a paddle when troubleshooting your Magento 1 shop. Applying these tips can give you the insight you need to build better, more scalable, and more reliable applications.
Did you know Groove provides technology support for Magento? Find out more about our Magento Managed Services packages.