How to change ‘My Cart’ in Magento theme

Written by Gethin on February 15, 2013

There are many terms and phrases within standard Magento themes that may not always apply to your online business or even your targeted customers. ‘My Cart’ and ‘Credit Memo’ are terms that may only appeal to the American audience, where in other parts of the world, ‘My Basket’ or ‘Invoice’ may be more appropriate – not that these terms are going to hugely affect your revenues, but it  enhances your users experience when interacting with your store and brand. Our example is for a store that sells bits and bobs for the D.I.Y enthusiast where we wanted to create the experience of adding products to a ‘Box’, very much like a tool box. There are a few ways to do this, depending on your confidence and store set up.

Editing Template files

For our first example, we need to find out where the terms ‘My Cart’ and ‘Add to Cart’ exist in your themes code. With the aid of template hints, we can quickly find the file that hold these terms. Be aware that turning on template hints will drastically change the look and layout of your store – so it’s best to do this on a development store, or be very quick in taking note of the path to part of the template your trying to find!

magento-cart

Step 1

Log in to your Magento admin area and navigate to System > Configuration, then in the left column, change the ‘Current Configuration Scope’ to Default Store View

Step 2

Scroll down to the end of the left column and click Developer under the Advanced tab. This will show the Debug tab, here you can turn on Template path hints and Add block names to hints by choosing yes from the drop downs- if these are disabled, simply untick the checkboxes next to these two dropdowns.

Step 3

Hit Save Config and reload the front-end of your store and you’ll notice a lot of 1px dotted red borders with long path names to parts of your template. If we look at the ‘My Cart’ link at the very top of your store it should show a path pointing to where this file is. Take note of this and go deep directory diving in your local copy of your store and open the file at the end of this path. It should be something like this – frontend/base/default/template/page/template/file-you-need-to-open.phtml

Step 4

After opening your file, we now need to look for the term ‘My Cart’ – but being very careful not to change anything outside of the brackets or quote marks. Look for php snippets such as [php]<?php echo $this->__(‘My Box’) ?>[/php] and edit the contents of this and simply change ‘My Cart’ to ‘My Box’ or ‘My Bag’ or whatever you like. Go through all the necessary files and change this term to your new term.

Step 5

Upload this to your site and refresh your store to check out the results – You may need to turn template hints off again to see it properly!

Edit Translation File

A less technical approach is to add or edit a translation file which is formatted in .csv, making it a lot friendlier to edit.

The file in question can be found here – app > design > frontend > Some Theme > Some Theme > locale > en_US > translate.csv, where you see ‘some theme’ would actually be the name of your current theme used in your store. After opening this file, you may or may not notice a long list of terms or phrases that are used within your store.

Each phrase needs to be on its own line. From here, we can either locate the phrase we want to change or simply add it to the file. The first phrase on the line is the current phrase used, and the second is what we want it to read. For example, currently it should read My Cart, My Cart. All we need to do is change the second phrase to what we want it to read, such as ‘My Cart’, ‘My Bag’.

magento-table

Go ahead and change all the relevant phrases from ‘My Cart’ to ‘My Bag‘. Save this file and upload it to the site, refresh your browser and you should see your results.