Magento and PayPal payment doesn’t set Delivery Address Apr 13, 2011 I came across this minor problem when a client running a Magento website wanted to enable the paypal checkout. Once I enabled paypal express checkout and started to run through some test orders the custom module I had written to export their orders ready for their warehouse/dispatch system had a few problems. The problem is that PayPal doesn’t use the same naming for its addresses as Magento. In Magento the customer is asked for billing and delivery addresses and where they opt to use the same address the details are simply repeated. Development Magento address bug checkout paypal
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
How to check if a string contains another string in PHP Apr 7, 2011 This post is another quick explanation on something that is is much more difficult to figure out than it should be. One of the most basic things you would ever want to do in programming is check if one string of text contains another string of text. In every other programming language I can think of this is simple but for some reason the PHP way of doing this has added complexity. Development Development How To's php string
Joining a table to itself in Ruby on Rails 3 when you can’t use the Id Mar 31, 2011 First of all let me explain that joining a table to itself normally – i.e. using primary and foreign keys, is pretty simple and can be done using the lovely ActiveRecord belongs_to and has_many association. That isn’t what I am talking about here, I am interested in joining to the same table using other fields and conditions. Why would you want to do this? Well in my case it is the first step in shortlisting customers in the database who have potential duplicates. Development Development How To's Ruby on Rails join rails
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
Padding a number with zero in PHP Mar 17, 2011 This really should be simpler than it is. Well, that isn’t entirely true because it really is simple – but it took me at least three google searches to find out how to do what I wanted, so I thought it was worth sharing. I first tried using str_pad and got nowhere but then found an example using sprintf. The following code will take a number ($raw) and prefix it with two zeros. Development Development How To's php sprintf
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