Whats This Blog All About?

Well here it goes my first post. I am a Junior Web Developer still learning his trade if you would like to know more about me head to the ‘About Me’ page.

I have started this blog for three reasons.

First to better my content writing skill (Which you will see are pretty bad)

Secondly to share any tricks & tips that I’ve picked up when either learning or using various web development tools / frameworks such as Magento, Laravel, Bootstrap, Grunt, git and many more. Most of these useful snippets were / will be picked up after hitting a brick wall with a development project. then having to spending hours on the web trying to find solution on forums and blogs. I will also share some useful SEO techniques that all web developers should know. I am no SEO specialist but I have work with many different SEO company over time and have picked up a few things on the way.

Thirdly for me just in case I hit that brick wall again 🙂 All the answers will be here no need to scroll through pages and pages on the internet trying to find a solution.

Please note I am no Web Developer Guru or SEO expert (if there is such a thing) I am just a guy who loves coding and wants to share what he has learned and is still learning.


Magento – Displaying CMS Static Block based on Category ID

I was asked to create a promotional banner for one of the ecommerce website I work on. The boss only wanted the banner to be displayed on certain product categories which were related to the promotion. This is how I went about it.

First in the Magento back end create a new Static Block. I will assume that you are already familiar with creating a Static Block in Magento so will not go into how to do this. If you are not familiar with creating Static Blocks please go to the Magento Knowledge Base


Now we need to pull in this static block into one of our Magento template files as I would like it to appear on the category pages I am going to add the code to 2columns-left.phtml which is in.


Decide where you would like your banner to be displayed in my case after the breadcrumbs then add this code.

Firstly you will need to change the numbers in the $myvalidid variable array. Here you will need to add the ID’s of the categories that you would like the Static Block to be visible in separated by comma. Your category ID’s can be found in the Magento back end.

Catalog > Manage Categories

Finally add the identifier for the Static Block you wish to be called into the page.

Save and upload the template file back into your Magento installation.


List Of Useful Windows Command Line Prompts

When you start to learn frameworks like Laravel and Syfony or using a JavaScript Task Runners like Grunt to compile less files you will have to start getting used to using the Command Line.

Personal I love using the command line even when there’s no need to; I guess that makes me a bit of a geek. Seriously it well worth getting used to using the Command Line.

I’m a window PC user so this post is going to be focused on the windows command line.

To open up the command line on your keyboard select Window + R keys

This brings up the Run box, type into it cmd then hit enter. This will open up the windows command line which looks like this.


Here’s a list of some of the more useful commands.

To see a list of all directories within your current directory type dir and press enter .


To change directory type cd followed by the directory name you wish to open.


To jump to specific directory type cd followed by the path to the directory you want from your current directory i.e. cd path/to/directory/you/want/to/go


Go back one directory use cd..


To go back multiple directories it the same as jumping forward to specific directory but you don’t need to use the directory name just trailing slash followed by two full stops i.e. cd../../.. This will take you back three directories


If you want to jump to the root C Drive of your computer just type cd/


To create a directory type mkdir followed by the name of the directory you want to create.


If we then type dir to give us a list of all the directories you will see a new folder has been created call directory-name


To delete a directory use rmdir followed by the name of the directory you wish to remove.


To create a blank file type echo.> followed by the file name with the file extension.


That’s the basic now you can move around make and delete directories even create a blank files without having to touch your mouse or scratch pad 🙂


Basic SEO Redirecting None WWW To WWW Or Vice Versa

When surfing the web I am always surprised to see how many website break a basic and fundamental SEO rule. This includes some professional SEO / web design companies who should know better. What is this core rule that so many website are missing?

Redirecting none www URL requests to a www URL or redirecting www URL requests to a none www URL . This is a SEO basic must have luckily it can be done with a simple .htaccess file. Why is this www thingy so important?

Since the updates to Google search algorithm early 2012 which promote unique user friendly content for web pages (No more copying and pasting your supplier’s product information into your description then stuffing it full of keywords) Google prefers that the content on your website is unique and not present on any other sites, sorry affiliates 🙁 What has this got to do with redirecting the www part of your websites URL’S?

Google will see




as two different websites even though they are the same one. This will throw up duplicate content issues.

This is where the htaccess file comes in.

The .htaccess (hypertext access) file is a very powerful configuration file. Placed in the root directory of your website it is capable of many things from authorization, authentication, cache control and even blocking users by their IP address or domain. None of this is necessary for a lot of websites.

Now make your decision whether you would like the www at the start of you website URL or not. I personally prefer to have the www before the URL but there is no right or wrong way. Once you have decided follow these simple steps to set up a .htaccess file on a Apache server.

If you haven’t got one create a file called .htaccess

Now if you want none www URL to be redirected to www add this to your .htaccess file.

But if you would prefer all incoming www to redirected to a none www URL add this to your .htaccess file instead.

Place the .htaccess file in the web root of your website and you are done. It that simple! now there’s no excuse for not doing it on your next web project 🙂


How To Improve Your Magento Search Results

The Magento platform is great especially for small to medium business. It’s a bit of a monster to learn but it offers a lot out of the box. Having said this there are a few things that need to be tweaked. This post is about the Magento search function which to be honest sucks, why?

I work for a company that sell outdoor furniture and one of our product ranges are parasols. We sell wooden, aluminium and high end teak ones. If you don’t modify the search function and a customer does a search for lets say ‘wooden parasol’ they would be presented with hundreds of results with a lot of the results not having anything to do with parasols. This is because it will look for every instance of the word ‘wooden’ and every instance of the word ‘parasol’. Your customer is most likely not going to want to have to scroll through pages and pages of results trying to find that elusive parasol and will go somewhere else.

How do you improve your search query results? Fire up your FTP client and get out your favourite text editor it’s time to get stuck in.

That was a bit over dramatic it actually quite simple we just need to modify two files.

Find ‘form.mini.phtml’ in


Between the form tags place these two hidden form fields.

Then you need to make a copy of


and place it in


Depending how much work you have already done on your site you might need to create this directory structure.




Warning! It is important to create this second ‘local’ directory never edit files within the ‘core’ directory why? Well that is one for another post.

In ‘Fulltext.php’ find the line

and change to

Then find the line

And change it to

You can see easily what’s being changed here so we are saying instead of searching for

Word(1) OR Word(2) = Every single instance of each word

We are changing it to say

Word(1) AND Word(2) = Every instance of these two (or more) being used together

Result! Much better search results for your customers so they can find the product they want faster.

Credit to Markus Tenghamn @ markustenghamn.com for this useful bit of code.