Book Image

Instant Magento Performance Optimization How-to

By : Nayrolles Mathieu (USD), Mathieu Nayrolles
Book Image

Instant Magento Performance Optimization How-to

By: Nayrolles Mathieu (USD), Mathieu Nayrolles

Overview of this book

The optimization of an attractive commercial website is a non-trivial task that demands time and knowledge. Optimization is a critical point for all growing businesses because a misconfiguration could make you lose money, a lot of money. If your server is overloaded, a browser that wants to turn into a buyer will not be able to, and you will lose customers. "Instant Magento Performance Optimization How-To" is a practical, hands-on guide that provides you with a number of clear, step-by-step exercises to help you reach a high performance level for your Magento stores and keep your customers satisfied.This book looks at tweaks and tips used to boost your Magento Performance, and breaks down the confusion that surrounds the subject.You will learn how to compress your pages, styles, and scripts by almost 80%. We will also take a look at controversial optimization settings such as Magento core compilation or enabling all caching systems. You will discover new applications that improve performance. If you wish your e-businesses to grow and want to keep your customers satisfied, you definitely need this book.
Table of Contents (7 chapters)

Using template hints (Must know)


In this recipe we will learn how to display template-related information for debugging purposes.

How to do it...

Go to System | Configuration | Advanced | Developer | Debug.

Turn on both the Template Path Hints and Add Block Names to Hints fields, and then save your configuration in the top-right corner.

If these options are not available at your backend, open and modify the system.xml file under the YOUR_STORE.COM/app/code/core/Mage/Core/etc/ directory at line 512 so that it looks like the following:

<template_hints translate="label">
  <label>Template Path Hints</label>
  <frontend_type>select</frontend_type>
  <source_model>adminhtml/system_config_source_yesno
  </source_model>
  <sort_order>20</sort_order>
  <show_in_default>1</show_in_default>
  <show_in_website>1</show_in_website>
  <show_in_store>1</show_in_store>
</template_hints>

<template_hints_blocks translate="label">
  <label>Add Block Names to Hints</label>
  <frontend_type>select</frontend_type>
  <source_model>adminhtml/system_config_source_yesno
  </source_model>
  <sort_order>21</sort_order>
  <show_in_default>1</show_in_default>
  <show_in_website>1</show_in_website>
  <show_in_store>1</show_in_store>
</template_hints_blocks>

The lines to be modified are the ones that are highlighted. Then you can come back to your administration site and activate these options.

As you can see in the previous image, each part of our Magento now contains the name and the path of the responsible HTML or PHTML file. With this information, it will be easier to identify where the problems are.

How it works...

The Magento Core adds an HTML <div> tag before each file in order to build the final page with a specific case. This new HTML <div> tag contains the filename and the file path in order to locate it easily. Then, when you browse to it, the previous <div> tag is displayed.