Fontis Ecommerce Blog: Commerce Advice and Insights

Magento CMS static blocks

by Peter Spiller in Magento

Static blocks in Magento are a useful way of making elements of your site easily configurable by administrators. If you have sidebar blocks, headers or other elements that can change from time to time, using a static block can be easier in the long run than hard-coding them.

Static blocks are very simple to create. In the admin backend, just go to the CMS menu and select Static Blocks. Click on the Add New Block button to create a new block. The fields for a static block are also very simple - you can give the block a title (used to distinguish blocks in the backend) and you can select whether it is enabled or not. The Content field is where you can enter your block HTML. You can use Magento template placeholders in this field (i.e. https://static.fontis.com.au/skin/frontend/base/default/...).

Read More

Magento on the Mac

by Denis Margetic in Magento

Magento is a web-based application, and therefore Magento development is thankfully not limited to any particular platform or operating system. As a Mac user I prefer to do my Magento development on my Mac. In setting up my development environment, I discovered that there are very few useful resources out there for other developers looking to do the same. So hopefully this post will serve as a start for others looking to do the same.

Read More

Debugging Magento with Xdebug

by Peter Spiller in Magento

Diagnostic print_r statements and logging might be quick and easy tools for investigating what Magento is doing, but a full debugger offers a lot more power and flexibility. This post demonstrates how to set up the xdebug debugger for use with the vim editor.

First of all, I'd like to thank Box.net for their great Xdebug tutorial. Check it out for a more in-depth look at using Xdebug and vim.

  1. To start, install the Xdebug PHP extension on your server. Note that this has to be installed as a Zend extension, not a normal PHP extension. You can obtain the Xdebug extension from xdebug.org, or you can install it via your package manager on a Linux system. On a Debian-based system, use:

    apt-get install php5-xdebug

    Edit your PHP config file and make sure you have the following settings. The zend_extension line may point to a different location for your system. (If you have installed Xdebug using a package manager they may already be set up for you.)

    Read More

Customised Magento review summary

by Denis Margetic in Magento

There is little doubt that product reviews are popular with online shoppers, and are playing an increasingly important role in purchasers' buying decisions. Magento includes a solid feature set for implementing product reviews and can show them on various pages that include product listings. You may find that you want to customise the way these reviews are displayed, but the best way to do this may not be immediately obvious.

Read More

Magento debugging - loading blocks, layouts and config files

by Peter Spiller in Magento

Occasionally I've needed to take a closer look at exactly which block, layout or config file is being loaded by Magento. In this post I will demonstrate a "brute force" approach to checking exactly what is being processed.

Please note: Where possible, we will be using Magento's logging, the output of which will be written to the file var/log/system.log, which also includes the rest of the system logging output. Logging must be enabled for output to be written to this file - you can enable logging in the Magento admin panel by going to System → Configuration → Developer → Log Settings and setting Enabled to True.

Read More

Definitive Magento installation guide

by Denis Margetic in Magento

While getting started with Magento some time ago, I thought it would be a good idea to write a post that started at the beginning: how to install it. Reading through the Magento forums, I get the impression that Magento users have extremely varied levels of web development and systems administration experience. That raises the question of the amount of detail to include in a post aimed at Magento newcomers, since experienced web developers will need only the important steps, whilst those new to web development will prefer more info. Here's our take on an install guide that will hopefully prove useful for both audiences.

Read More

API product IDs vs SKUs

by Peter Spiller in Magento

The Magento web services API is quite flexible - a lot of the time, it can either take an ID (like a product ID) or a more human-readable identifier (like a product SKU). Unfortunately, the downside of this is that in certain circumstances these can be mixed up, in which case the the wrong product will be affected.

In theory, to fetch information on a product based on its ID, the catalog_product.info method should be used with with an integer argument:

Read More

Web services API filter operators

by Peter Spiller in Magento

Many of the Magento web services API methods facilitate listing certain types of data - customers, products, orders, etc. However, when using these methods we rarely want to retrieve every record. Luckily there are a number of filter operators that can be used to narrow the result set that will be returned.

Read More

Preventing PO box customer addresses

by Denis Margetic in Magento

It's often undesirable to mail items to customers who provide post office boxes or locked bags for their delivery address when placing an order on a Magento site. Most commonly this is a requirement for fraud prevention or shipping reasons. Unfortunately, simply stating that PO boxes cannot be accepted somewhere on the site is often not enough to stop some customers from still placing an order with one. Rather then be left with orders that either require a followup or can't be fulfilled, an easy solution is to add validation code to prevent PO boxes and/or locked bags from being entered in the first place.

Read More

Custom controllers

by Peter Spiller in Magento

Here are a few notes on creating your own controllers and actions in Magento modules. This example shows how to create a controller called 'subscriber' for a module called 'MailingList'.

One scenario in which a custom controller is useful is when there is a need to allow other applications to interact with Magento. For example, we might want to be able to take action on subscribers being added or removed from an external mailing list, which is in fact exactly what our Campaign Monitor extension does.

Read More