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 – 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

jQuery Backstretch

Thought I'd blog my first proper stackoverflow answer; http://stackoverflow.com/questions/7125499/use-backstretch-inside-a-division-and-reduce-width-to-width-of-division/10209027#10209027 Let's see it get downvoted into the bowels of the earth :) I wanted to use backstretch to fill an element which was full width but took up only the top 560px of the screen. And if the image had to be resized larger than the original it didn't recenter vertically but was offset so the top disappeared. Yes, the link above is correct, you change the container from the body to the element you want to fill, in this case it was #backimage; Then I changed the code to assign a ... 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

VPS Hosting – Phenomenal Service

After yet another example of truly brilliant service I thought I would quickly dash off a blog post with a nicely optimised anchor text link through to NuBlue, who are truly exceptional for hosting.  I wouldn't say I'm hard to please but it's not very often I'd describe any service I've got as phenomenal. I can with Nublue though; UK VPS Hosting - Best Service There, that's a nice-a link! I've had a VPS with them for about 2 and a half years now, I set it up originally for hosting clients' Magento sites (for those not conversant with Magento, the Big M is a great system but a little resource hungry - there's no point ... Read more