Witty and insightful observations on the world? Sorry to disappoint, this is a techie blog purely for self reference - published online in the hope it will help others!

Magento – Bulk Coupons and URL rewrites

I did the development work for the 2012 Queens Diamond Jubilee site, a Magento and Wordpress combination for Igniyte in Shipley (as I write I'm planning to do a case study about it, I'll make a note to come back and link to it here when I'm done). The site has been live for 5 months now and it's been really successful, shipping a lot of products globally and generally performing really well. Well enough that the mighty Vodafone decided to do a tie in with the site and offer a selection of products to their customers free. They needed: Free product cost and free delivery on one list of products. I needed to generate coupons in bulk, ... Read more

Magento – Displaying Products in a Static Block

This is one of those ones that can be a bit frustrating, there's many a tutorial out there that suggests you have to create a new template file and call that. It's possible to call the standard catalog/product/view.phtml template from a static block but also pass parameters which dictate how it's displayed. So you can add the following; And it will display the products using the default list template, with product numbers pulled from the System -> Configuration -> Catalog -> Frontend config. Better still, you can copy that template and rename it as a custom template, take out a lot of the grid/list and toolbar conditionals and style it up the ... Read more

Magento newsletter subscription success message

Right, this one is one of those truly annoying Magentoisms that have you scratching your head and trying all kinds of things. Global success messages. Magento uses a session array that stores variables including error/success messages, they can be accessed and displayed in phtml templates using; The default page.xml file includes a call to the global messages in the default node; So the latest Magento job I'm doing has a design with a newsletter signup form on the homepage. I've tied it into Campaign Monitor using the Fontis CM Module, everything is working great except there's no signup message when the user submits their email, all that happens is the page reloads. That's no ... Read more

Determining which Magento CMS page you are on

This post describes how to achieve what is effectively the same as the Wordpress is_page() method in Magento. Surprisingly I couldn't turn up much on Google about this, so thought it was worth a blog post on how I did it. I'm using a modified version of the jQuery backstretch plugin (posted here). I wanted the main product image to be shown as the background on each product page, but on CMS pages I wanted specific images to be displayed as the background for each page. The issue is that the Javscript for the backstretch is included in the head, so you need to be able to establish in templates/page/html/head.pthml whether you are on a product page ... Read more

prettyGallery & Magento

I really like the stuff that Stephane Caron does at No-Margin-For-Errors, he's published some awesome jQuery plugins. For my money prettyPhoto is the best lightbox out there, and I recently had need to put a small image slider in a Magento site for a client in West Yorkshire. The main Magento product image was to load in as a background image into a version of Scott Robbin's jQuery plugin Backstretch which I customised to work on a container rather than the body tag. The designs from the agency (who I can't mention - NDA) showed that additional images were loaded into a scrollable container further down the page, so I decided to use prettyGallery. ... Read more

Magento – Adding CMS pages to Main Nav

This is just a quickie. Magento, by default, will create a navigation menu which is driven entirely through the catalogue. Naturally there will be the need to include other static items within the main navigation menu, including the obvious defaults like 'Home' and 'Contact'. Two good choices for my example because normally you'd have 'Home' on the left and 'Contact' on the far right, with the product catalogue navigation sandwiched in between. As with most things in web development, there are numerous ways to achieve this - some better than others. The quick and dirty method would involve hardcoding links into your catalog/navigation/top.phtml template, like so; Read more

Magento – Worldpay Module

I've used it on a few sites but I'm not a big fan of Worldpay in general.  From a completely non-Magento point of view some of the admin functionality in their web interface is just terrible -  I've had to help clients who were struggling to do basic things like export forms and locate specific transactions (things you would expect to be nice and easy - they weren't!!). Worldpay haven't had the foresite to do what SagePay have done and commission a developer to create and support an official module which they give out for free, instead it's been left to a German developer called Phoenix.  While they've done a great job, you find that the payment module is lagging behind ... Read more

Magento Breadcrumbs – Custom ‘Home’ Link

This is a quick and easy one, but useful for those who are building their Magento store as a section of a larger site.  The problem is that, by default, the Magento breadcrumbs will produce markup with the home text or icon linking through to the base url of the Magento store.  However, if your Magento installation isn't the root of the site you won't want this. You can customise the home link by creating a local version of app\code\core\Mage\Catalog\Block\Breadcrumbs.php and then hardcoding the link url as below; As per tzyganu's advice on this thread here; http://www.magentocommerce.com/boards/v/viewthread/178468/#t227643 Read more

Magento – Default Homepage

Sometimes I'm doing a Magento build and e-commerce isn't the main focus of the site. It happens quite a lot, I end up doing the main site in, say, Wordpress and then installing Magento in a subdirectory that's accessible from the main site through the menu as 'Shop' or something similar. The thing is, when you do that you often want the Magento site to load stright into a single main container category rather than the default CMS page. You do this by changing the System → Configuration → Web, Default Web URL from cms to the following catalog/category/view/id/category_id Replacing category_id with the category number. Read more

Magento – Category Descriptions & Images

I hate it when you spend time trying to get something to work - then realised that you've already solved this same problem before and really should have remembered. Must blog more!! Anyway this one relates to Magento Category descriptions and images. Using the method Won't work unless you amended the Mage_Catalog_Block_Navigation class. Take a local copy of Mage/Catalog/Block/Navigation.php and ensure that the getCurrentChildCategories() method works like below. Note there's an interesting point on Stackoverflow about removing the load() call prior to returning it. public function getCurrentChildCategories() { $layer = Mage::getSingleton('catalog/layer'); $category = $layer->getCurrentCategory(); ... Read more

Categories