Get the title of an order’s payment method in Magento Apr 8, 2011 I have been writing a magento based site for a client and they have a few requirements for their despatch system that I had not seen before. One of them is to set a flag in their dispatch system indicating the payment method chosen by the customer (seems sensible, I just haven’t had to do it before). Anyway, turns out as it often is with Magento, that this is a really simple thing to do, once you find the information. Development Development How To's Magento magento development payment php web development
Putting products on a Magento CMS page or Homepage Mar 31, 2011 No matter how many Magento websites I build I never seem to be able to remember the following code snippet to add products onto the homepage or CMS page. I thought I would post, simply so I know where I can quickly find the information – I hope others find it useful as well. The simplest way to do this is to add a widget to the cms page which allows you to specify a category if you need to as well as the template. Development Development How To's Magento cms homepage magento development
Building a website switcher module for Magento Mar 25, 2011 I recently had to build a module for Magento that let you switch between each of the Magento Websites in the admin. I’ve written a short explanation of how I did this below, along with the code. Create a module First off, you need a name for your company/organisation and a name for your module. Once you decide that you need to create the folders. You will probably want to put your module on the local scope – this is where I do everything, although if you are developing a plugin then people sometimes use the community scope. Development Development How To's Magento magento development multi-labguage multi-region php
Magento: Limit the address fields to n characters Mar 21, 2011 There are a number of reasons you may want to do this – but primarily I think it is because your despatch system will likely be printing labels and if the lines are too long it won’t work properly. You could try dealing with the line lengths when you export but that leaves you with the messy situations of trying to work out where to put the bits of the address yo uhave chopped off. Development Development How To's Magento form forms html magento development
Magento: Retrieve the store name, inside a module Mar 17, 2011 I thought this would be simple usually that is my first mistake with Magento. As it transpires it really is simple for once but worth mentioning, if only so that when I need it again in six months time I have it written down somewhere. There are plenty of reasons you might want to do this, from turning functionality on or off within your module – or like in my case – using the store code as a prefix on order numbers. Development Development How To's Magento how-to magento development module php store tutorial
Magento: Display the store telephone number Mar 13, 2011 Displaying the store telephone number that you entered into the Magento Admin seems like it should be obvious but it took me ages to track down, here is how. In a template file you add the telephone number by calling getStoreConfig like this… <?php echo Mage::getStoreConfig('general/store_information/phone'); ?> But from within the CMS, it is much simpler – there is actually a link to insert it somewhere in the menu that Development Development How To's Magento layout magento development telephone template
Magento: fixing a broken pear.ini after migrating server Mar 10, 2011 When you copy files from one server to another the pear.ini file contains some hardcoded paths that need to be fixed. The file format is some kind of PHP serialisation. The file can be found in downloader/pearlib and you need to change ther paths manually, as well as the prefix numbers that indicate the lengths of the string. e.g. s:9:”some/path” would become s:14:”someother/path”. Development Development How To's Magento config fix magento development pear php
Custom translations file in Magento Feb 25, 2011 It is very helpful to create a single translation file for your magento template to include any words or phrases that you add to the basic templates. Simply create an empty module (create a folder under app/code/local/[yourcompany]/[yourmodule]) and then add a subfolder etc and create a config.xml which should contain the following. <?xml version="1.0" encoding="utf-8"?> <config> <modules> <translations> <version>1.0.0</version> </translations> </modules> <frontend> <translate> <modules> <translations> <files> <default>swn_translations.csv</default> </files> </translations> </modules> </translate> </frontend> <adminhtml> <translate> <modules> <translations> <files> <default>swn_translations.csv</default> </files> </translations> </modules> </translate> </adminhtml> </config> Make sure your module is enabled (see [Creating your own module][1]). Development Development How To's Magento csv magento development multi-language translations web development
Magento Multi Language, Currency & Region Setup Feb 22, 2011 Several options here depending on exactly what you need. Currency can be handled at website, Store or Store level and if multiple currencies are set “as allowed” then the currency changer will show up. By default this appears in the left sidebar and is added in using the directory layout file (why directory?). To move this to the header, comment out the directory bit and move it to the page layout file – inside the header block. Development Development How To's Magento magento development multi-currency multi-region muti-language php tutorial web development
Read URL parameters inside Magento (for tracking) Feb 19, 2011 You likely want to be able to pass some tracking information about the visitors to your Magento site through to your back-end systems. I usually implement tracking using the same method as Google Analytics, just for convenience. Also, there is a ready-made [URL Builder][1] for clients non-google campaigns. This sends tracking data through to the site but you need a custom module to read those parameters and store them in a cookie. Development Development How To's Magento event google magento development php tags tracking