Magento

Manage Customer Attributes

From the start Magento has included the ability to modify product attributes through an interface in the administration panel. With Enterprise Edition 1.9, you can now manage customer attributes through a similar interface. This article will show you how to use this interface, as well as show you what this interface can and can't do. The most useful feature that this interface provides is the ability to create brand new customer attributes and then define where in the site these attributes should be shown. Read more →

(Re)sending Magento order emails

I recently had a need to resend Magento order confirmation emails for orders placed within a particular time period. Magento provides an interface for resending these emails out of the box (navigate to Sales → Orders → Order and click 'Send Email' up in the top right), but this takes 15-20 seconds per order at best. If you have more than a few of these order emails to resend, this approach will quickly become tedious. Read more →

Banners and the Banner Rotator Widget

Banners are a relatively new CMS feature of Magento Enterprise Edition that allow administrators to create, organise and display promotional content. In the past, this requirement was often addressed by manually creating static blocks and customising a site's layout. By using banners and the banner rotator widget, you can now create content and then control exactly how and where it is shown on your site in a much easier way. Read more →

Adding a step to the Onepage Checkout

The default Magento onepage checkout includes six steps for the customer to complete. However, sometimes you may have a requirement to create an extra checkout step. An example of this might be an option for your customer to choose a free gift as part of their order, or an extra step to collect special delivery instructions. Using delivery instructions as an example, we'll demonstrate how this can be achieved. Read more →

Magento Session Fixation Workaround

Earlier versions of Magento were susceptible to a form of session fixation vulnerability, which can have quite serious consequences even without anyone trying to exploit it maliciously. Visitors may unwittingly follow a link to a Magento site, and be logged in as another user without performing any actions. This results in multiple visitors sharing a session and causes confusion as they add and remove things from the same cart, and potentially even allows them to view another customer's details and place orders under their account. Read more →

Customise Magento Checkout Success Page Based On Payment Type

The Magento order process completes with an order success page confirming that the order has been received and displaying the order number. This poses a problem for orders with non-instantaneous payment methods (like Check/Money Order) since the necessary payment details are then only available to customers during the payment step before the order is placed and customers need to know to note these down. Ideally you want any necessary payment information to be shown to the customer once they have finished placing the order. Read more →

Automatically set Magento customer group

A commonly used Magento feature is the ability to place customers into different customer groups. These customer groups can then be used in a number of ways, such as tiered pricing where each customer group may have different pricing applied. By default, Magento does not include a means of automatically sorting customers into different groups when the customer account is created; instead they must be assigned manually. This post follows on from our creating custom customer attributes post and shows how to automate customers being assigned to groups based upon information they have provided when signing up, whether from a custom or default customer attribute. Read more →

Extending the Magento web services API

First of all, you need to find the Magento core file that provides the API method you want to extend. These are generally in model files called Api.php or under directories called Api. For example, I recently needed to look up customer orders by their IDs, as opposed to their increment IDs (aka their order numbers, such as '#100000003'). After some searching, I found the file that contains the relevant code at app/code/core/Mage/Sales/Model/Order/Api. Read more →

Direct SQL queries in Magento

$conn = Mage::getSingleton('core/resource')-getConnection('core_read'); This will return a Varien_Db_Adapter_Pdo_Mysql object, a subclass of Zend_Db_Adapter_Abstract, which will allow you to run the Zend adapter methods directly. For example: // Prints a list of all website names $results = $conn-fetchAll("SELECT * FROM core_website;"); foreach($results as $row) { echo $row['name'] . "\n"; } Note the use of the core_read parameter in the getConnection call - this instructs Magento as to which resource to use. Read more →

Displaying Magento custom product attributes on the frontend

The simplest way to display custom attributes is to enable them on product view pages, where they normally show up as a table. Design files can be edited to display custom product attributes elsewhere on the product view page. When a Magento product object gets loaded in a template file, any custom attributes that have been added to products are also accessible. The method used to retrieve the values depends on the type of attribute. Read more →