Modifying the response in Magento before its displayed on browser

Magento uses a response object to send all output. All output is added to this object, and then its sendResponse method is called.  If you need to modifying the response in Magento before its displayed on browser then you can listen to the event “http_response_send_before” and modify the output in the observer method.

Continue reading »

Magento – AJAX "Headers already sent" error solved

While working with AJAX in Magento many of you might have received the following error like I did:

2013-05-02T10:25:15+00:00 DEBUG (7): HEADERS ALREADY SENT:
[0] /var/www/html/ecomm/app/code/core/Mage/Core/Controller/Response/Http.php:44
[1] /var/www/html/ecomm/lib/Zend/Controller/Response/Abstract.php:727
[2] /var/www/html/ecomm/app/code/core/Mage/Core/Controller/Response/Http.php:75
[3] /var/www/html/ecomm/app/code/core/Mage/Core/Controller/Varien/Front.php:188
[4] /var/www/html/ecomm/app/code/core/Mage/Core/Model/App.php:304
[5] /var/www/html/ecomm/app/Mage.php:599
[6] /var/www/html/ecomm/index.php:104

Continue reading »

SEO Ultimate version 7.6.1 syntax error on installation

I downloaded SEO Utlimate Version 7.6.1 [] wordpress plugin for my blog site. I unzipped the downloaded file and uploaded the extracted folder to /wp-content/plugins/. When I activated the plugin from admin I got the following error:

Parse error: syntax error, unexpected T_IF in /home/xxx/public_html/wp-content/plugins/seo-ultimate/modules/author-links/author-links.php on line 1

Continue reading »

Fatal error: Declaration of Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with Zend_Pdf_FileParserDataSource::__construct()

In one of our Magento projects, on development environment everything was working fine but when the site was live “Invoice” print in magento admin [Admin >> Sales >> Orders >> Invoice tab >> Open Invoice >> Click print button] was giving Fatal Error.

We though that we might have missed some file when moving to live site but ultimately we found that code base was same.

Continue reading »

Overriding Magento admin theme files

We create a new theme and assign it in the Magento admin to override the frontend theme. What if you need to override the admin theme file? Edit the default magento file? No, its not a good practise.

Continue reading »

Adding English (India) locale

We were working on a eCommerce website based on magento for INDIA. Magento allows the locale from admin, the path to be followed is Admin >> System >> Configuration >> General >> Locale. In the “Locale” dropdown it has option for English (United States), English (United Kingdom), Hindi (India) etc. but no option for English (India).

Continue reading »

Order address edit log not maintained in Magento Enterprise edition

Magento admin has a logging module that records actions performed in Magento admin. It is a very useful module when the admin is used by multiple persons and you want to track the changes made in admin. You have the option to select which of the admin actions are logged. To select/modify the admin actions to be logged go to Admin >> System >> Configuration >> Advanced >> Admin, check the checkbox next to any actions that you want to be logged in the log file.

Continue reading »

Excluding Pages from wordpress search results

By deafult Wordpress search feature displays pages as well as posts in the search results. It may be desirable that you want to display only posts for the search results in your blog. Here how you can do this.

Create the function below and add it to your theme functions.php file.

function SearchResultsFilter($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
return $query;


Continue reading »

Running Magento indexer from command line (shell)

Magento maintain various index tables to make data access faster. Magento core updates the indexes itself when you save a product but in some cases you may be required to update the indexes yourself. There are two ways to update the indexes from Magento admin or using the command line.

Continue reading »

Disabling the form submit on press of ENTER key

enter key

At times you would have seen that when you are filling a form on a website and you hit “ENTER” key the form gets submitted. As a developer you may have come across a situation where you would have wanted to prevent this action. The solution to this is to disable the “ENTER” key using javascript. Here’s a code snippet that disables “Enter” key in HTML textbox:

<script type="text/javascript">

// <![CDATA[
function disableEnterKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var elem = ( ? : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (elem.type=='text'))  {return false;}

document.onkeypress = disableEnterKey;
// ]]>


Continue reading »

Back to top