The best place to hide a dead body is Page 2 of Google Search

And it is probably completely true, any search term you are looking to market on, or draw traffic from, if you aren’t on page one of google then you might as well not be at the party.

Best Place to Hide a Dead Body is page 2 of google search
Best Place to Hide a Dead Body is page 2 of google search

And this is why you need to focus your efforts

1/ Pick your search terms carefully, make sure they will not only generate traffic but make sure they represent the right traffic, traffic that will actually buy from your site.

2/ Research them, make sure what you are trying to achieve is reasonable (i.e. dont go after Amazons top search term, because it may bring you traffic but you are very very very unlikely ever to get to page 1).

3/ Optimise your landing page, give your keywords the best possible place to land. and your new visitors an attractive and informative entry point to your site.

4/ Track and Record, Baseline before you start and measure performance regularly, this way you know whats working and whats not.

5/ Go to 1 and start again, keep doing it, a little bit every day, just keep doing it.

How to embed a youtube video in your ebay listings

If you have tried embedding a video in your eBay listings then you will have seen the iframe error message telling you that you are not allowed to embed iframes in ebay listings and therefore cannot embed a youTube video.

Well there is a really really simple way round this, normally when you click on the share tab in youTube you will see this code.

YouTube IFrame Embed Code
YouTube IFrame Embed Code

However if you click on the “Use Old embed Code” option you will notice that youTube changes from an iFrame to object embedding.

YouTube Old Object Embed Code for eBay Listings
YouTube Old Object Embed Code for eBay Listings

 

And there you go, using the youTube “old embed code” option will allow your videos to be embedded into your eBay listings without any problems from the old iFrame not allowed error.

Bulk Additions of URL Re-Writes in Magento

In moving a site that is already established into the magento e-commerce cart one major challenge is to populate URL rewrites that will re-direct all the old product URL’s into the new magento SEO URL’s

There are a number of ways you can do this, below is an explanation of a very simplistic re-map, by mapping all the old URL’s to the root of the new site, now this is not ideal for a number of reasons firstly that any external links to products will be remapped down the root of the new site, not the product they used to point to, but even this is better than thousands of 404 errors.

The first task is to create a database table with all the old URL’s in, you have a number of options here, you can either extract them via SQL or some other form from your old cart, ideally leaving off the domain name and http string, if this is not possible then you can easily remove this later either with search and replace in the file or within MySQL itself as below:

update core_url_rewrite
set id_path = right(id_path, length(id_path) – 26),
request_path = right(request_path, length(request_path) – 26)
where id_path like 'http://www.mydomain.co.uk/%'

The value 26 used in the SQL above is the number of characters you want to remove from the front of the URL’s this is quick and dirty,  and could be done dynamically but this is a one hit job so there is very little point.  The SQL above is targeted to be used against the Magento core_url_rewrite table after the URL’s have been added but could easily be used against any table either before or after loading. next you need to load these URL’s into a database table on the target MySQL server.

Having done this the job is relatively simple.

The first thing to do is ensure that none of the URL’s you are about to load into the mg_core_rewrite table are duplicates of anything that is already there. the table I have loaded my URL’s into for this example is called ‘newurls’ and has a single field ‘url’

first we need to get rid of any duplication against mg_core_rewrite

DELETE from newurls WHERE url in (SELECT id_path FROM core_url_rewrite

The SQL above will delete from our table anything which is  a duplicate and already exists in the core_url_rewrite table, next we can add our new URL’s to the table and point them to the root of the domain.

INSERT INTO core_url_rewrite (store_id, id_path, request_path, target_path, is_system, options)
SELECT DISTINCT 1, url, url, 'http://www.mydomain.co.uk/', 0, ‘RP’
FROM `newurls`

This SQL will load full records into the core_url_rewrite table of Magento and point the URL’s to the root of the domain.

Simples, no more 404 errors from your old URL’s, now to do this and map the products back to each other you are going to need the SKU of the products loaded with the URL’s in your original SQL extract data, I will cover this in another article at a later date.

Greyed Out Folders on Mac – Cannot Access Folder

OK, we have hit this one a couple of times when a fold copy has not completed for some reason and unless you know how to fix this then you will not be able to access the folder and potentially lose the files within it.

Apple Mac Greyed Out Folders Fix

A greyed out folder on a MAC is often caused by a creation date problem on the folder, the first obvious thing you can do is reboot and see if it sorts itself out, if not there are a few other ways to get back into a greyed out folder on a MAC.

One way is to use the terminal to rename the folder, then create a new folder and move the content of the original to the newly created folder, simple enough to do using the command line terminal.

From the Terminal Rename the Original Folder:

# mv MyFolder TempFolder

Then Make a new one and move the files from the old one to the new one:

# mkdir MyFolder
# mv TempFolder/* MyFolder

And Your sorted, you now have a shiny new folder with the same name as the old one with all your files in it, all that is left to do is delete the old TempFolder.

The main problem with the above solution is it involved copying the data again, and this is what probably caused your issue in the first place, so much better to do a straight copy or tar the data:

# cp -pR TempFolder/* MyFolder/

or:

# (cd TempFolder; tar cf - . ) | ( cd MyFolder; tar xpf - )

However, given the main problem is usually the creation date of the folder being corrupt, a much faster and easier solution is to fix the original problem folder by setting the creation date into the past:

SetFile -d 02/02/2013 <folder_path>

And fingers crossed your sorted.

Clearing and Setting Attributes in Magento Programatically

Todays challenge following a 4000 product import from a supplier into a Magento store was to set all the Categories in the store to Anchor and to clear down the Meta_Title, Meta_Description and Meta_Keywords attributes within magento, that had been loaded with rubbish during the Import.

To do this manually even using the update attributes script inside the product editor of Magento would have been a total pain so a quick script was need in PHP using the core Mage functions to do this programatically, especially as this is to be an ongoing task which will need to be run after each import so ideally a PHP script file that can be set to run as a cron job is ideal.

The following script worked a treat, using paging on the product collections to keep the memory usage down to a minimum during running.

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');

// Load Up Magento Core
define('MAGENTO', realpath(''));

require_once(MAGENTO . '/app/Mage.php');

$app = Mage::app();

$categories = Mage::getModel('catalog/category')
  ->getCollection()
  ->addAttributeToSelect('*')
  ->addAttributeToFilter('is_anchor', 0)
  ->addAttributeToFilter('entity_id', array("gt" => 1))
  ->setOrder('entity_id')
;

foreach($categories as $category) {
echo $category->getId() . "\t" . $category->getName() . "</br>";
  $category->setIsAnchor(1);
  $category->save();
}

$productCollection = Mage::getModel('catalog/product')
  ->getCollection()
  ->addAttributeToSelect('sku')
  ->addAttributeToSelect('meta_title')
  ->addAttributeToSelect('meta_description')
  ->addAttributeToSelect('meta_keywords')
  ->setPageSize(10)
;

for($page = 1; $page <= $productCollection->getLastPageNumber(); $page++)
{
  $productCollection->clear()->setCurPage($page)->load();
  foreach($productCollection as $product) {
    echo $product->getId() . "\t" . $product->getSku() . "</br>";
    $product->setMetaDescription('');
    $product->setMetaTitle('');
    $product->setMetaKeywords('');
    $product->save();
  }
}

?>

But please please please please please remember, before running anything like this, take a backup of your data, unless you are 120% confident that the script will do what exactly what you want it to do, and even then, take a backup just in case.

Creare SEO Module for Magento Commerce

Ok I am going to state absolutely upfront and categorically that we love this module, if you only install one module to handle on site SEO within Magento then make this the one. It doesn’t do everything , it isn’t the answer to all your prayers, but it is a very comprehensive module that covers more than just the basics.

Creare SEO module for magento has several sections to it that really need to be covered separately as they each cover different elements of your onside SEO.

Luckily the nice boys at Creare have included a “Basic SEO Health Check” as part of the module so that would seem a good place to start

The Default SEO Check screen within the module is a basic checklist of Magento configuration items that need to be setup to give your site a fairly optimal SEO setup, that Google etc are going to have real trouble objecting too. What your looking for here is a screen full of big green ticks, fairly simple, yes it is however this simple tick list does contain some pretty big items, that many might have been caught out by in the past, and also some of the items relate directly to configuration items that need to be set for Creare SEO itself. Let’s take each element one at a time.

Creare SEO Settings:

The Meta Keywords Tag and any Blank Meta Descriptions Tags have been removed :- This one is very simple Google have long since stated that they and many other engines no longer use the meta keywords tag, however they have never to my knowledge stated they will penalise a site for having it, so removing the meta keywords tag completely can seem like a little bit of over kill, but if you look at the bandwidth usage over time of redundant code then it is worth removing, and the second part of this is the removal of any blank Meta DescriptIon Tags, in essence if thenTag has no data why would you want it.

Parameter Based Category Pages have ‘noindex’ set in robots :- this simply change brought in by Creare SEO will have a dramagic effect on reducing page duplication (a serious nono and pet hate of Google) , the problem sitso within Magento itself in that when your categories have searchable products using Layered Navigation then each category page will have a huge number of possible combinations of parameters, we have seen a Magento site with as few as 500 products throw up over 8000 duplicate pages all nicely indexed by Google, what Creare SEO has done is added the ‘no index, follow’ flag to the category pages, so that bots will still crawl the entire category but all parameterised pages will be marked as noindex and keep Google etc from penalising your site for duplicate content.

Unique Category Heading are Enabled:- really simple, this option enforces unique category headings so that you doing get Duplicated Content within your site, really useful option, however if you use Configurable Products and then Associated Products for variations then this one might not suite you.

Canonical Product Redirecting is enabled. Any non-canonical URL paths are automatically 301 redirected to the canonical path:- All products will be set to be accessed via the product url only, not via the /category/product structure and a Canonical Link Meta Tag will be inserted to each product to tell search engines which URL to use.

Twitter Cards are enabled for product pages:- Interesting one, this adds structured data for both Twitter Cars and Facebook to the product pages, you will need to register with Twitter for your cards to work properly.

Default Meta Descriptions for products are configured and enabled: With default meta description enabled for products in Creare SEO, the system will create an SEO description following your default template [product_name] – [category_name] etc.

Default Meta Descriptions for categories are configured and enabled: As above Creare SEO can be configured to supply default meta descriptions for all categories where non are specified in the category data.

Default Page Titles for products are configured and enabled: Default page titles as with the Meta Descriptions can be configure to follow a template for each product by Creare SEO this default will then be used for all products where the page title is not already set.

Default Page Titles for categories are configured and enabled: As with the Default Page Titles for Products categories page titles can also be set to follow a template set in Creare SEO.

Your robots.txt file exists and is writable: This check ensures that the robots.txt file exists in the root directory and that it can be written to by Creare SEO, their are menu options in Creare SEO for editing both the robots.txt and .htaccess files.

Your .htaccess file exists and is writable: This check is to make sure the .htaccess file a) exists and b) can be written too by Creare SEO.

Magento Configuration Settings

Web Server Rewrites are enabled correctly: We Server URL Rewrites have been correctly configured and enabled, allowing Search Engine Friendly URLS’s to be used.

Category Canonical Tags have been setup correctly: Canonical Tags for categories, will set the Canonical URL meta tag in each category page telling search engines exactly which URL to use for the page.

Product Canonical Tags have been configured correctly: As with Categories you want this set to inform Search Engines via the Meta Tags exactly what URL to index for the page in question.

Product URL’s only exist under the canonical tag: Product URL’s should only be accessible via their Canonical URL.

Default Values

The default Meta Description value has been emptied: Ensure the Default Page Meta Description value is empty other wise you will have “demo store” in the meta description of all your products, not ideal for SEO you must admit, by making sure this is empty you allow Creare SEO to utilise it’s own defaults for products with no Meta Description.

The site’s Meta Robots Tag allows search engines to both crawl and cache your website: This option ensures that your basic robots.txt file is configured correctly, not optimally, just the basics.

Your store view name has been customised: The store new name has been changed away from the default.

Your website name has been customised: Ensure the name of the website has been changed away from the default.

Your logo alt text name has been customised: The logo and it’s Alt text appear on the site via your theme, do not leave them default.

In Summary

In our opinion this should probably be the first module you load to any new Magento setup, get Creare SEO installed and everything configured, then think about themes and products etc, make sure Google gets the right information from the off.

Check out the Creare SEO Module for Magento here.

The Google Analytics Bug and Checkout Issues

Please tell me i’m not the only one with an online business who can sit for hours working on one screen with Google Analytics Real Time on the other, secretly repeating to myself in my head “Buy something, come on Buy something” as I watch the little blips glow on and off on the Top Locations Map

Now I know we cant drive our customers to the checkout using telepathy, but we can remove as many barriers to a sale as humanly possible. Does your checkout are have SSL, are there too many steps in the checkout process, Is your card processing causing issues, could any of the steps in getting a customer through the checkout and out the other side causing customers to fallout.

One way to determine any issues is to get Goals in Google Analytics, listing the steps of the checkout as Goals will allow you to see exactly how many people enter the checkout process and exactly how many make it to the other side, through all the steps.

Bulk Update Custom Attributes in Magento via the Database

Ok, here is something that according to most of the articles I have read is impossible, and it’s a relatively mundane task.

What I needed to do was having introduced a new Custom Attribute and set it’s default in Magento, I then needed to set all the products within the Magento Attribute Set to have that default applied to them, simple you would think but no not in Magento

So faced with the prospect of Manually having to go through hundreds of products to set the correct default on them all, my solution was to turn to the Magento database and populate the data manually.

And here’s how you do it.

First you will need the entity_type_id for this use the following SQL

SELECT entity_type_id FROM catalog_product_entity WHERE sku = ‘XXXX

In this data you can use a SKU that you know to be one of your target products and then get the entity_type_id and make a note of it, you are going to need it for the next step.

Next you need to get the correct attribute from the eav_attribute table the following SQL will return a list.

SELECT attribute_id, attribute_code FROM eav_attribute WHERE entity_type_id = your_attribute_entity_type_id

Now having found the attribute_id that you need to add, next you need the default option value to set it to, for this use the SQL below.

SELECT eao.option_id, eaov.value_id, eaov.value, eaov.store_id
FROM eav_attribute_option eao
INNER JOIN eav_attribute_option_value eaov
ON eao.option_id = eaov.option_id
WHERE eao.attribute_id  = your_attribute_id

This SQL will give you a list of options that are available to set for the attribute you are looking at, and the value you need is the ‘option_id’ and also the ‘store_id’.

You now have all the information you need to set the attribute in bulk using the SQL below to update the catalog_product_entity tables.

INSERT INTO catalog_product_entity_int (`entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`)
SELECT your_entity_id, your_attribute_id, your_store_id, entity_id, your_option_id
FROM catalog_product_entity
WHERE entity_id not in
(select entity_id from catalog_product_entity_int where attribute_id = your_attribute_id)

To make life easier I have coloured the sections of the above SQL query where you need to insert your ID’s in place of the name holders I have specified.

And dont forget before you go anything as mad as this, please please please backup your database.

 

 

IT Best Practice

Let’s face it, IT Best Practices is not the stuff of dreams, more like nightmares, and even though I come from an IT background myself and can regurgitate this best practice and IT standards all day long, I still need reminding periodically of the what to’s and what not to do’s especially in the ever changing world of e-commerce and the internet.

I am just glad i’m not the one writing the book, but it is in fact a good friend of mine Andrew Pearce, with many many years of change management and process management experience, Andrews CV stretches on and on for miles.

Andrew titles the book as “The Handbook for SME Business Owners” and I for one will be going through my own business with a copy when he has finished.

While it is still a work in progress you can see a few previews and keep an eye on the his blog at: http://itbestpractice.co.uk/

Starting Over at 40, new business and rebuilding