May
21
2014

Setting all products to list by default in Magento category pages

If you have a smaller Magento store with a relatively small number of products and categories, it can be useful to customers to list all products per category in one page in Magento.

Luckily, setting all products to list in a category by default is quite an easy change to achieve in Magento. The changes require edits to your theme’s local.xml file (e.g., in /app/design/frontend/default/your-theme/layout). If this file doesn’t exist in your theme, you can create it. In older versions of Magento (~1.3 and earlier), make these changes in the catalog.xml file.

I’ve highlighted the changes required to your theme’s local.xml file below:

<catalog_category_default translate="label">
<reference name="content">
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
<action method="setDefaultListPerPage">
<limit>all</limit><label>All</label>
</action>

<action method="setDefaultGridPerPage">
<limit>all</limit>
<label>All</label>
</action>

<action method="addPagerLimit"><mode>list</mode><limit>10</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>20</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>30</limit></action>
<action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>
<action method="addPagerLimit"><mode>grid</mode><limit>12</limit></action>
<action method="addPagerLimit"><mode>grid</mode><limit>16</limit></action>
<action method="addPagerLimit"><mode>grid</mode><limit>24</limit></action>
<action method="addPagerLimit" translate="label">
<mode>grid</mode>
<limit>all</limit>
<label>All</label>
</action>
</block>
</reference>
</catalog_category_default>

Don’t forget to refresh Magento’s caches if you have them enabled, in the System > Cache Management menu.

Need a hand with Magento? We offer Magento support and consultancy for businesses of all sizes.

Nov
25
2013

Three things to consider before migrating your website to Magento

We receive a healthy number of requests each month for migrating existing ecommerce websites to the Magento platform, and there are a number of things worth considering before you move to Magento.

The benefits of migrating to Magento

There can be huge benefits to moving your store to Magento’s platform, including:

  • Magento is one of the most popular ecommerce systems around, and this means there’s a very active ecosystem of developers and designers who are experts (like us!). As a store owner, this usually means quicker bug fixes to the core Magento features, and a greater range of free or pre-existing extensions to add new features.
  • Magento (Community Edition) is free and open source (see this article on whether Magento Enterprise Edition is worth the cost for you). This means there are no licensing costs for the software, just the budget for the customisations and designs you need.
  • Magento is built for ecommerce: unlike some other ecommerce platforms, Magento was built specifically for online stores, and it shows. Catalogue management for your products and categories is deeply integrated with Magento and very well tested.
  • Multi-store management built in: if you have more than one store, you can use Magento to manage them all through the same control panel.
  • Powerful reports and analytics: Magento gives you the power to create custom reports as standard, giving you the power to adapt your business to suit your customers’ needs.
  • And much more! See Magento’s demo.

1. Migration is a big deal

You’re not just moving some products to Magento: you’re moving your whole online store, which means customers, your order history and other page content will need to move too! This is not a reason not to migrate to Magento; simply something to consider. Many requests for transferring an existing online shop to Magento don’t budget enough for data transfer, and ensuring continuity for existing customers is usually a key factor in successfully migrating website platforms!

So, as well as products, consider the need to:

  1. Migrate your store’s customers to your new Magento store
  2. Move your product category and hierarchies across to Magento
  3. Moving your product images to Magento
  4. Ensure that your products’ web addresses (URLs) may need redirecting to their new addresses.

2. Is Magento really what you want?

Magento is sometimes used by clients as a buzzword: they’ve been told they need Magento, but have no idea why. Magento’s one page checkout is a great tool, and can cut the time it takes customers to check out, but it doesn’t suit every store’s needs: some businesses need a more customised checkout process to help customers better understand what they’re doing and at which point.

If your existing ecommerce website is heavily customised, check with your developer if the Magento extensions they might be using to replicate features will work the same – or a similar – way as your previous store. As we said, consistency is key in a migration to prevent loss to your store’s turnover.

Review Magento’s demonstration version(s) carefully before: whilst visual changes are usually relatively easy to undertake (a custom Magento theme can change the look of Magento very deeply), changing the fundamental processes that Magento follows is more of an undertaking and can be costly and make Magento difficult to maintain if done by inexperienced Magento developers.

3. Pick your hosting platform carefully

Magento is perfectly capable of running very, very slowly. It’s a powerful ecommerce system and requires a suitable hosting platform to go with it. Look for specialised Magento hosting companies, and try and check their sites’ load times with an external tool (e.g. Pingdom): loading time is an important factor in your store’s bottom line!

It’s also worth getting your web developer to check Magento’s server requirements before moving, and that you can easily scale to provide more resources to your store if required.

Nov
11
2013

How to disable Magento “short description” field for products

Magento has a lot of “sensible defaults” as settings, but we find time and time again, we end up disabling the short description field for product pages in Magento.

Disabling the short description attribute for your store tends to be for a few reasons:

  • the client is importing contents from another during a site migration to Magento, and the old product data doesn’t (generating a short description automatically tends to end up messy!)
  • the client’s website is being penalised for duplicate content (very rare, in our experience) – often as the short description uses exactly the same content as the longer product description
  • the custom Magento theme design chosen for the store does not accommodate the short description field

Disabling the product’s short description in Magento

To disable the short description field entirely for your Magento store, log in to your Magento store’s administration panel, and navigate to Catalog > Attributes > Manage Attribute sets:

Navigate to Catalog > Attributes > Manage Attribute Sets

Select your product attribute set (this is usually Default, unless), and you’ll see the screen below. Drag and drop the short_description field to the Unassigned Attributes column on the right, and click Save Attribute Set:

Remove the short_description field from Magento

Disabling the product short description field as a required field

As well as entirely removing Magento’s short description field for products, you can change your product attribute settings so that the short description is no longer required to add a product to your store, which hides the short description field for all products that don’t have one added.

This field can be turned off fairly easy: log in to your Magento administration panel, and navigate to Catalog > Attributes > Manage Attributes.

Disable short description in Magento product pages

From the list of product attributes shown, find short_description:

Selecting the attribute short_description in Magento's backend

Select this attribute to edit it, and locate the Values Required field. Set this field’s value to No to click the Save Attribute button at the top-right of the screen.

Depending on your caching options, you may need to clear Magento’s caches and possibly reindex your product data to see the change take affect.

Turn Magento's short description off as a required field

This works in the most recent version of Magento Enterprise Edition and Magento Community Edition (we use Magento Community Edition 1.7 or 1.8), and should work on much earlier versions of Magento too (though see about upgrading your Magento store soon!).

Nov
1
2013

Magento, Google Merchant Center & Robots.txt

If you are looking to make SEO improvements to your Magento website, you have probably considered using a robots.txt file to block specific pages from search engine listings. A word to the wise: If you are listing your products on Google Merchant Centre, you may want to tread carefully.

The issue: robots.txt blocking access to Magento product images

The core issue is that your robots.txt file could be blocking Google from accessing your product images (used in Google shopping feeds, etc), especially if you’ve just scrapped the default Magento robots.txt in to your site.

If you used the default Magento robots.txt file already, you may have run in to the error below:
**Error message********************************************************

'The submitted image URLs seem to be blocked by robots.txt. Google will not be able to display these images together with the products. Please change your robots.txt file to allow Google to download the image.'

**********************************************************************
If you are receiving the error above, then the chances are that your products are slowly being de-listed for product feed listings. Let’s look at how this can be fixed. I’ll start with a sample robots file.
User-agent: *
# Directories
Disallow: /404/
Disallow: /media/
Disallow: /catalogsearch/
Disallow: /catalog/product_compare/
Disallow: /catalog/category/view/
Disallow: /catalog/product/view/

This is a simplified example of what your robots.txt file may look like for a Magento store. The problem is with the following line:
Disallow: /media/

This line blocks all search engine bots from accessing the media folder, including Google’s media bot which is used to access this, in which the product images (among others) sit.

Solution: ensuring your Magento product images are accessible to Google Images

If you understand how the robots.txt file works, you may be tempted to try the following fix, which gives the Google ‘image-bot’ access to the media folder.
User-agent: googlebot-image
Allow: /media/

As it turns out, this doesn’t seem to work. As an alternative you can simply try to remove the ‘media’ line altogether. However, if this doesn’t work you’ve landed yourself in a tricky situation.

Try waiting a couple of days after making a change, as it often takes this long for Google to re-index the updated robots.txt file. If you are unsure if the changes have been picked up, try looking in your Google Webmaster Tools account, under the ‘Crawl > Blocks URLs‘ page. Here you will see the contents of your robots.txt file from Google’s perspective.

Even though the above content in your Magento website’s robots.txt file should do the job, it appears you actually need to use the following at the bottom of your robots.txt file to re-allow Google’s image bot to access what it needs:
User-agent: Googlebot
Disallow:

If you urgently need to get your products back in the listings, this solution worked for our client – but it came at a price. Adding these lines to the end of your Magento store’s robots.txt file basically overwrites everything prior to it, giving Google access to all the pages you originally wanted to block.

Oct
15
2013

Responsive MediaWiki skin design for PetroWiki

We’re really pleased to have launched a fully redesigned responsive MediaWiki skin for PetroWiki.org on behalf of the Society of Petroleum Engineers.

Responsive MediaWiki skin design for PetroWiki.org

The website, based on the MediaWiki platform, and provides an online, interactive handbook for petroleum engineers around the world to maintain their industrial knowledge and share best practice.

We totally redesigned PetroWiki.org to incorporate a mobile-friendly responsive MediaWiki skin design tailoring its view to be more easily accessible to members accessing the information on a range of devices from aging desktop computers to modern smartphones.

The responsive MediaWiki skin allows PetroWiki.org’s vast membership to access and contribute to the knowledgebase wherever they happen to be, from out in the field on their smartphone on an oil rig to sitting in their office in New York. Read more on our responsive MediaWiki theme design here.

petrowiki.org

Jun
10
2013

WordPress showing 2 meta descriptions in < head >

We came across this situation today, where, after installing a meta plugin for WordPress, two meta descriptions were appearing in our WordPress website’s <head>.

In the HTML source of the WordPress website we were working on, we found this:

<meta name="description" content="1st meta content not wanted by the client" />
<meta name="description" content="Client's actual desired meta description content" />

Most search engines are almost definitely smart enough to just pick one and use it, but it’s a good idea to maintain just one meta description per page to prevent confusion!

The potential causes for duplicate meta tags appearing in your WordPress pages are:

  1. Multiple WordPress plugins installed, each adding their own meta description to pages
  2. Your WordPress theme inserting an additional meta description field in to the page

In our case, it was the latter option!

How to fix WordPress displaying 2 meta descriptions

The fix, you’ll be glad to hear, is mercifully easy! Your WordPress theme’s header.php file probably has a hard-coded meta description.

  1. Look in the wp-content/themes/your-theme-name directory.
  2. Open the header.php file.
  3. Look for something like the below code within the <head> element:
    <meta name="description" content="<?php bloginfo('description'); ?>">
  4. Remove that line and upload the file back to your server, and you’re done!

And if that doesn’t solve it, we’re happy to help you with your WordPress site!

 

Apr
29
2013

MediaWiki cheatsheet

We had a request recently from a client of our MediaWiki training course for a MediaWiki cheatsheet to help them remember the various syntaxes for different formatting options in MediaWiki.

This MediaWiki cheatsheet provides a guide to basic MediaWiki formatting, from making text bold and italic to inserting images in to your MediaWiki articles.

Basic MediaWiki formatting cheatsheet

Aim MediaWiki syntax or ‘wiki markup’ to do this What you’ll see Comments
A new paragraph Ensure there is a free line between content. This is on line.

This is a second paragraph created by the spare line above.

Italic text ”Italic text’ Italic text A double apostrophe on each side of the text you want to make italic.
Bold text ”’Bold text”’ Bold text A triple apostrophe on each side of the text you want to make bold.
Bold and italic text ””’Bold and italic text””’ Bold and italic text Five apostrophes on each side of the text you want to make bold and italic.
A table of contents n/a A table of contents based on the headings in your wiki article. MediaWiki will do this automatically once your article has 4 or more headings. You can remove the table of contents from a specific article by inserting the

__NOTOC__ magic word in to the page's content.
A link to another page in your wiki [[Test page]] Test page This would link to the page called Test page in your wiki, whether or not the page existed.
A link to another page in your wiki with custom link text [[Test page|Link text]] Link text This would link to the page called Test page in your wiki, whether or not the page existed, but it would display Link text rather than Test page.
A link to another website (an external link) [http://www.example.com] 1 Be sure to use the full link to the website, including the "http://". Most MediaWiki installations (this depends on the "skin" or design you have installed) will display a small icon alongside external links to indicate they're different from the internal link to a page within your wiki.

MediaWiki will number links added like this, starting at 1.

A link to another website (an external link) with custom link text [http://www.example.com Link text] Link text Be sure to use the full link to the website, including the "http://", and leave a space between the link to the website and the link text you wish to use.
A bullet point list * A list item
* A list item
** A nested list item
** A nested list item
* A list item
  • A list item
  • A list item
    • A nested list item
    • A nested list item
  • A list item
You can nest more than one list in itself by using more asterisk (*) characters.
A numbered list # A list item
# A list item
## A nested list item
## A nested list item
# A list item
  1. A list item
  2. A list item
    1. A nested list item
    2. A nested list item
  3. A list item
You can nest more than one list in itself by using more hash (#) characters.
An image [[File:Test.jpg]] Test image This inserts the image called Test.jpg in your wiki in to the page at its original size.
An image with a size and caption [[File:Test.jpg|200px|Caption goes here]] Test image This inserts the image called Test.jpg in your wiki in to the page at a size of 200px (200 pixels wide) in to the page with a caption of "Caption goes here".
An image with a size and caption, as a thumbnail [[File:Test.jpg|thumb|right|200px|Caption goes here]] Test image This inserts the image called Test.jpg in your wiki in to the page at a size of 200px (200 pixels wide) in to the page with a caption of "Caption goes here". The image will appear to the right of the content block, with text flowing around it.
A category [[Category:Test category]] This adds the page to a category called Test category. You can insert more than more category per page using this syntax.
A redirect #REDIRECT [[New page]] This redirects the current page to a page called New page whether or not this page exists.  

Advanced MediaWiki editing cheatsheet

Aim MediaWiki syntax or 'wiki markup' to do this What you'll see Comments
A table of data {|
! A table heading
! Another table heading
|-
| A table cell
| A table cell
|}
A table heading Another table heading
A table cell A table cell
Use {| to open a table and |} to close a table. For each new cell in the table, start a new line in MediaWiki's editor tool. Start the line with an exclamation mark (!) for table headings, and a vertical pipe (|) for normal cells. Use |- (a vertical pipe followed immediately by a hyphen character) to start a new row of cells.

Have we missed anything? Let us know!

Apr
8
2013

How to blank all page content in MediaWiki

One of our MediaWiki clients wanted us to blank all of the content within their wiki, so they can start their annually recurring project from scratch on the same platform as last year. Here’s how we blanked all content in their MediaWiki:

  1. Access your wiki’s database administration tool (we tend to use phpMyAdmin).
  2. Ensure you’ve selected your wiki’s database.
  3. Run the following SQL command to delete all pages in your MediaWiki installation:DELETE FROM page;

As always, make sure you back up your files/database before doing something like this!

Bonus: deleting all content in a particular MediaWiki namespace

You can also delete all content in a particular MediaWiki namespace in a similar fashion. So, to delete all content in your wiki’s Talk namespace, you would run the following SQL query:

DELETE FROM page WHERE page_namespace = 1;

As a guide, page_namespace = 0 is generally the Main namespace where general MediaWiki articles reside, and page_namespace = 1 is generally your MediaWiki installation’s Talk namespace.

Mar
25
2013

Magento CURLOPT_SSL_VERIFYHOST error with SagePay

A handful of Magento clients on Magento support plans have had this issue: SagePay misbehaving on their checkout (or one page checkout) pages and producing a CURLOPT_SSL_VERIFYHOST error from their Magento store.

Luckily, it’s fixed in SagePaySuite’s latest version, so if you can, just update the module in Magento Connect Manager!

What is the CURLOPT_SSL_VERIFYHOST error?

The cause of the bug is the use of an incorrect parameter related to SSL (security certificates) on your server. Essentially, the old, “broken”, code is telling the server to simply check the “common name” of the server exists, whereas the fix (below) asks the server to check that “common name” matches the actual “hostname” of the server the website is on. Simply, SagePay have chosen to discontinue support for CURLOPT_SSL_VERIFYHOST set to 1 or True as it’s much less secure, and this has affected your Magento store if it relies on the SagePay payment gateway.

The bug is explained reasonably well in a related bug in WordPress here.

The error that pops up is similar to that below – your browser’s native JavaScript ‘alert’ dialogue displaying an error message along the lines of:

The page at https://www.example.com says:

An error occured with Sage Pay: Gateway request error: Notice: curl_setopt() [<a href=”‘function.curl-setopt’>function.curl-setopt</a>]: CURLOPT_SSL_VERIFYHOST with value 1 is deprecated and will be removed as of libcurl 7.28.1. It is recommended to use value 2 instead in /home/yourhostingaccountname­/public_html/app/code/­local/Ebizmarts/SagePaySuite/Model/­Api/Payment.php on line 1169

SagePay CURLOPT_SSL_VERIFYHOST error in Magento

Error message in Chrome (Mac) produced by SagePay CURLOPT_SSL_VERIFYHOST error in Magento

A quick fix for the CURLOPT_SSL_VERIFYHOST error

Here’s a quick remedy to the CURLOPT_SSL_VERIFYHOST issue in Magento (I’m sure it’s fixed in the most recent version of Ebizmarts’ SagePaySuite module but haven’t had time to verify this as of yet). If you re-read the error message, you’ll see the fix is essentially given in the

  1. Locate the file named in the error message in your Magento installation – in our case, it was /app/code/local/Ebizmarts/SagePaySuite/Model/Api/Payment.php – and open it in your preferred text editor. Create a backup copy of it too, just in case you need to restore it.
  2. Locate the line in the file causing the problem; again, ours was line 1169, which looked like this:curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 1);
  3. Change the parameter from ‘1’ to ‘2’; on line 1169, which should now read luike this:
    curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 2);
  4. Upload this file over the existing Payment.php file.
  5. You may need to clear Magento’s caches for this change to take effect.
  6. That’s it: the CURLOPT_SSL_VERIFYHOST error with SagePay in your Magento store should now be resolved!

Why do I say “quick fix” above? Simply because the change will be overwritten when you come to update the module (you could try doing this in Magento Connect Manager anyway as a longer-term fix!).

Mar
20
2013

What are MediaWiki Namespaces and what is their purpose?

Part of dealing with open source software is being part of the community, and as MediaWiki is a large part of the work we do, I spend at least a few minutes most days looking at mwusers.com, the unofficial MediaWiki form.

One query that popped up today was this one, which asked about the use of Namespaces in MediaWiki and their potential uses in organising content within a wiki. I’d had this post in a draft state for quite a while, so it seemed like a good time to finish and publish it!

This is something I cover in our MediaWiki training courses, and I’ve pulled the gist of how I try and explain the concept of Namespaces to clients below.

What is a MediaWiki Namespace?

A Namespace in MediaWiki groups like content together. Unlike categories which nominally group content related by topic (e.g., the Cat and Dog page may both be in the Pets category), MediaWiki Namespaces are a way to group content by purpose.

The purpose of MediaWiki Namespaces

Namespaces can be used to control permissions over the content they contain. E.g., you can more easily restrict certain user groups to viewing/editing content within a specific namespace than you can over a specific page.

For example, you might have a specific namespace for a project (let’s call it ProjectX), and by grouping all of the content for it within that namespace (so you would have pages called ProjectX:Page_1, ProjectX:Page_25, etc), you can control who’s able to see/contribute to that content.

Searches can also be conducted within a specific namespace, so using namespaces can make searching for content in your wiki much easier.