Magento Development

Magento: Remove the “Customer Login” page title when using a form_login on your homepage

Jun 7, 2011

Magento provides a very nice way of placing a login form directly onto your page design, instead of the user having to click a login button, the only problem is that the login form inadvertently sets the page title to “Customer Login” for any page it is placed on. The fix is fairly simple, if a little bit of a hack. What you need to do is override the module that you use when placing the login form into your template.

Display your Magento store address (from the configuration)

Jun 6, 2011

Magento lets you enter your store address directly into the configuration settings – here is the code snippet to display that in one of your Magento Templates. First of all the setting is found in the system-Configuration page under General – Shop Information. Obviously you can vary this for different Store Views etc. Here is a quick screenshot to make sure you are in the right place… Configuration General-Shop->Information” src=“/wp-content/uploads/2011/06/Mageno-System-Configuration-General-Shop-Information-575x212.png” alt=“Magento System->Configuration General-Shop->Information” width=“575” height=“212” /> the code to then display this in one of your templates is then a one line snippet of PHP… echo Mage::getStoreConfig('general/store_information/address'); You probably want to display on multiple lines – by default this will just include line breaks that will then be ignored in HTML.

Adding Debug Messages to a Magento Module

Jun 4, 2011

When you start building your own Magento modules/plugins, or even just resort to looking at the code to try to work out how to things need to be in your templates it is often useful to output debugging information. Magento helpfully provides such a facility but it is a bit tricky to find. Buried away in the depths of the System->Configuration menu under Advanced – Develop and then Log Settings you can turn on logging.

Order product list on your homepage in Magento

Jun 3, 2011

I recently found that having worked out how to place a cateogry of products on the homepage of my Magento site I wanted to specify the order that those products were listed in. Mainly this was because I was hiding the standard Magento toolbars, so the customer could not do this themselves. The first place I started looking was the system configuration menu, see below. This seemed like a promising place to start with the dropdown for “Product Listing Sort by”.

Magento Error SQLSTATE[28000] [1045] Access denied for user "username"@"localhost" (using password: YES)

May 20, 2011

I have fallen foul of this error a couple of times now and it is tricky to find the correct information online to fix the problem. It seems there are two obvious situations where this error occurs and depending on your version of Magento, or exactly what you did then there are three simple things to check to fix it and get your Magento site back up and running. It is worth mentioning at this point that you can always get back to your system by renaming your local.xml file and hitting your homepage.

Update: Translations Specific To Your Magento Theme

May 19, 2011

I recently wrote an article explaining how to add arbitrary translations to your Magento site using an empty plugin to allow you to attach a translations csv file. You can read the original here: [Custom translations file in Magento][1] Anyway, this is all well and good if you are adding text to your plugin or suite of Magento plugins that need to be translated. Of course, if this is the case then you already have a plugin to put the translations in but hopefully my post explains how that is done.

Setting number of columns on Magento search results

May 12, 2011

I have been recently working on a Magento template that required plenty of changes to the product lists and grids and some way down the line I realised that the search results weren’t playing by the rules. In the catalogsearch layout file an action called addColumnCountLayoutDepend to set the number of columns depending on the template that is being used. Obviously you want to show more columns in the search results if you have the space to do so.

Magento enable cookies displayed when you already have cookies enabled

Apr 28, 2011

This is a strange problem that has cropped up on Magento sites I have been building a couple of times now. There seem to be plenty of people with a similar problem, so I figured it was worth casting it out onto the Internet in the hope somebody might find it useful. This only happens on your dev/test server. Symptom You have been developing your Magento website using Firefox but when you view it in Chrome or Internet Explorer Magento tells you that you need to enable cookies.

Magento: Setting columns and limiting products shown in grid

Apr 15, 2011

I recently started experimenting with creating my own page templates and using the layout update XML to add content into the page. This works well for more complicated page designs and is particularly suitable for the homepage or landing pages. I did hit a minor snag however and that was when I added a product list or grid I couldn’t see how to specify the number of columns the grid should contain.

Add a new Magento CMS Template

Apr 14, 2011

I usually try and stick to the standard Magento templates where possible. The 3 column, 2 column left and right and single column layouts are nicely put together and it gives enough flexibility for most sites. I have recently been dealing with sites with landing pages that follow a single design layout but that are a bit too complicated to build from scratch each time using the single column template. So, I wondered how simple would it be to create my own template file that I can use for CMS pages, with dedicated blocks for different areas of the page.