Magento checkout agreements missing

Magento I had to work on a Magento template that was bought and assumed to be in a “fully functional and anatomically correct form” (cit), except that it was not able to show the checkout agreements in the checkout process even if the standard procedures are all done correctly.

The problem was (of course) in the XML layout of the checkout page (checkout.xml) where the block that was supposed to output the agreements, here below:

<block type="checkout/agreements" name="checkout.onepage.agreements" as="agreements" template="checkout/onepage/agreements.phtml"/>

Was positioned in the wrong place, in my case it was inside the “Review” element of the checkout:

<block type="checkout/onepage_review" name="" as="review" template="checkout/onepage/review.phtml">
  -- stuffs --

That is pretty wrong! This error will make impossible for customers to complete the checkout process as the system will spam pop “Hey you did not accept the agreements!”. That block is supposed to stay inside the info block of the review:

<block type="checkout/onepage_review_info" name="root" output="toHtml" template="checkout/onepage/review/info.phtml">
  -- many stuffs --
  <block type="checkout/agreements" name="checkout.onepage.agreements" as="agreements" template="checkout/onepage/agreements.phtml"/>

At this point a simple cache refresh fixed the issue and get the checkout agreements in the checkout page.



Magento headers already sent

MagentoSometime while working with Magento, especially while browsing the site with Google Chrome, you may get the following error:

Duplicate headers received from server
The response from the server contained duplicate headers. This problem is generally the result of a misconfigured website or proxy. Only the website or proxy administrator can fix this issue.
Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple Content-Disposition headers received. This is disallowed to protect against HTTP response splitting attacks.

This will be fixed in Magento 1.7.x, but until then, if you like to fix it you need to duplicate a core file in the app/code/local/ folder modifying few lines.

The file you need is app/code/core/Mage/Core/Controller/Varien/Action.php, and you need to modify the method _prepareDownloadResponse, in particular this code:

->setHeader('Pragma', 'public', true)
->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
->setHeader('Content-type', $contentType, true)
->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength)
->setHeader('Content-Disposition', 'attachment; filename="'.$fileName.'"')
->setHeader('Last-Modified', date('r'));


->setHeader('Pragma', 'public', true)
->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
->setHeader('Content-type', $contentType, true)
->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength, true)
->setHeader('Content-Disposition', 'attachment; filename="'.$fileName.'"', true)
->setHeader('Last-Modified', date('r'), true);

As said before, you have to duplicate this file before modifying, messing with the core files is always bad!
Your new file will be /app/code/local/Mage/core/Controller/Varien/Action.php.

If you plan to upgrade to Magento 1.7.x keep in mind that it is better to remove this patched file!


Magento store and website information

MagentoIf you need to get information about the current store, or storeview or website, you may find handy the following small snippets:

Will give you the Store ID, easy uh?

Will give you the Store View Name.

Will give you the Store Group Name.

Will give you the Website Name.

Small & handy.

I use this stuff a lot while working on custom themes or some special integration processes on custom ad hoc modules.


Magento google sitemap generation for multistore installation

MagentoHello everyone,
if you ever need to have a sitemap for each store created under a single Magento installation, you will probably face a little error about the unavailability of your specified path for the creation of the sitemap.

Regardless of the path you may specify, you will get the following error all the time:

Path "mypath/mysitemap.xml" is not available and cannot be used.

As you can imagine the problem is not very clear as the error is misleading to a different source.

As today (Magento 1.6.x) the only way to avoid the problem, without touching core files that is, is to understand that Magento want a specific name for the sitemap, and it will not accept anything else:


However, to have more sitemap.xml, one for each storeview, you will need to manage sub-paths, like:


If you would like a clean approach you can, however, work with the rewrites to let the Apache serve a clean url for the sitemap:

RewriteCond %{HTTP_HOST} ^.*yourstore_1\.com$ 
RewriteRule ^sitemap.xml$ yourpath/sitemap.xml [NC]



Also available in dutch!

Magento error “getimagesize(): Read error!”

MagentoProbably is explicit or maybe not, but this error is what happen when there is an a file under the media/import directory that as an invalid size, usually you can spot these files because they occupy 0 bytes.

Removing or uploading them again fix the issue.

How can I find the broken files?

With a simple bash command:
find . -size -1 -exec ls -l {} \;


Magento Magereverse

MagentoHello everyone,
working on a Magento’s SQL error I found this pretty website,, it is a database diagram dedicated to Magento.
It is still in Beta but I find it very helpful to understand better the mess in the Magento Database.


Magento category childs

MagentoBack from holidays and with a simple task to be completed.

To check if a category as children categories you can use the simple method “getChildren()”, it return a coma separated list of all the categories IDs.

$cat_child_list = $this->getCurrentCategory()->getChildren();