Unravelling Magento's collectTotals: Invoices and Credit Memos

Previous Entries Part 1: Introduction Part 2: The Core Process Part 3: Orders and Caveats Quite some time ago (well over a year, in fact), I published a series of articles on Magento's cart totals collection process (linked above), how it works, and how to customize it. The series provided a guide for introducing entirely new totals, but any intrepid developers trying out this procedure might have discovered a missing piece: While the previous articles offered a step-by-step for getting new totals into the cart and onto the final order, more effort is required for these totals to make it onto the order's invoices and credit memos. If your order fulfillment process occurs within Magento, fancy custom totals can hardly be of any use without support for these components. Therefore, it...

Posted on December 13, 2014

Posted under Development, Magento, Magento Development, Management by Chris Nanninga

Debugging Complex Problems

Recently, I posted about avoiding common coding problems. These practices can help to reduce debugging overall time. Even after common coding issues have been reduced, you are often still left with a need to debug more complex problems. These are the bugs that you either didn't write, which are sometimes buried in the core of the framework or application on which you are working (in our case, Magento), or that stem from incorrect or incomplete logic. These types of problems can often require a variety of techniques to debug, especially when the bug is in code you neither wrote nor have seen. Example The Problem A client was having a problem where no product on a grouped product page was able to be added to the cart. All qty text boxes were hidden, and it was ultimately represented...

Posted on November 18, 2014

Posted under Development, Magento Development, PHP by Jonathan Hodges

Magento Translation, Step Zero: What Must Be Translated?

Internationalization is an increasingly important consideration for Magento merchants developers looking to expand market penetration and increase usability. A significant part of this effort is realized in the form of maintaining translations for multiple locales – quite the undertaking, in spite of Magento’s robust localization capabilities. However, a journey of a thousand miles begins with a single step, and this initial step can be particularly daunting. What must be translated? Ideally, every string ever used, be it backend or frontend, would be documented so that an exhaustive list is always available of material scheduled for translation. In practice, however, this is rarely the case – maybe the site or module wasn’t initially slated for an international market or the ROI was...

Posted on October 24, 2014

Posted under Development, E-Commerce, Magento, Magento Development, Management by Eric Wiese

Custom Reports in Magento with Clean_SqlReports

Magento comes with a number of built-in reports covering areas like: sales, taxes, customers, products, abandoned carts, and reviews. However many merchants have reporting needs beyond Magento has to offer. For some merchants, a third-party extension like Aheadworks' Advanced Reports module will do the trick. However if an existing module doesn't fit the bill, then you'll need to build a custom report. Traditionally, a Magento developer would build a report into Magento following the same pattern of Magento's native reports. However this approach can take a while and will often be cost-prohibitive. To make building custom reports an easier task, Kalen Jordan built a module called Clean_SqlReports that allows you to take a MySQL query and automatically turn it into a Magento...

Posted on September 24, 2014

Posted under Development, E-Commerce, Magento, Magento Development, Management by Erik Hansen

An In-Depth Look at Magento Theme Fallback

Magento supports unparalleled theme flexibility and sophistication that allow for incredibly custom branding while still retaining development efficiency and upgrade compatibility. In particular, the theme asset fallback system allows theme developers to only modify the parts of a theme which actually need to be customized. This feature also enables merchants to quickly deploy stylized stores while still retaining features developed for the overall brand. Current Fallback Structure Magento Enterprise 1.14 and Community 1.9 introduced a new, more flexible theme fallback mechanism. Each theme can now specify its parent, which can then specify its parent, and so on. This theoretically allows infinite fallback levels instead of the fixed number of fallback "slots" in older versions. As...

Posted on August 5, 2014

Posted under Development, Magento, Magento, Magento Development, Theme Fallback by Eric Wiese

Implementing High-Res Images on Magento's Native Responsive Theme

With retina displays becoming more and more common both on desktop and mobile devices, supplying appropriately high-resolution imagery is an important consideration. Blindly providing high-resolution images, however, wastes bandwidth – a resource in short supply, especially with mobile devices. New specifications allow websites to provide an array of images at different resolutions to the browser so that it can pick the best fit for its display density and bandwidth availability. Adding support for this ensures that cutting-edge devices (and their lucrative owners) enjoy the best possible experience, while not penalizing traditional devices and users with traditional display densities with increased bandwidth usage. Native RWD theme support By default, the native rwd/default theme...

Posted on May 27, 2014

Posted under Development, Magento Development by Eric Wiese

Currency in Magento

Magento is built to be an extensible multi-lingual, multi-currency, and multi-national platform. It's flexibility can create significant challenges for merchants and developers alike. This has led me to dig deep into the currency systems that are built into the pricing and sales portions of Magento. At a basic level, native Magento currency options can be expressed as three possibilities. The first option is to simply have your base price set on every product using a single currency. This base price is the one that you set when you are setting the price value on a product at the default level. The second option is to use Magento's native currency conversion that operates at runtime on a per store basis. As a Magento merchant or developer, you have the option of allowing your...

Posted on January 15, 2014

Posted under E-Commerce, Magento Development, Management by Jonathan Hodges


Save Credit Cards in Magento with Our New PayPal Extension

Classy Llama's newly released PayPal Credit Card Tokenization extension adds a feature to Magento that's been sorely missed by merchants who use PayPal as their payment service of choice: the ability for customers to save a credit card for repeated use. The enhancement has the potential to make PayPal a more attractive option for new merchants choosing an online payment solution as well. With the extension in place on a Magento site using PayPal, logged in or registering customers will now be presented with a "Save this card for future use" checkbox when paying with a credit card. On subsequent visits, any previously saved cards will be available for one-click use. And while this is the most prominent feature of the new extension, it offers quite a few other bells and whistles as...

Posted on August 15, 2013

Posted under Magento, Magento Development by Chris Nanninga


Unravelling Magento's collectTotals: Orders and Caveats

Previous Entries Part 1: Introduction Part 2: The Core Process The focus of this series is Magento's process for calculating and displaying cart totals. We have taken a thorough look at the code involved with the core process, but there are a few important points left to cover. Transferring totals to the order What we've seen so far all relates to what's happening when a cart is still in progress, and it makes sense that that's where the truly hard work is done. But at some point (we hope), a cart will become an order. What happens then? There are several relevant points: Frequently, the same database fields we've seen in the quote tables (ex. "gift_cards_amount" and "base_gift_cards_amount") will show up in the order tables as well. Where these fields are present in...

Posted on May 8, 2013

Posted under Development, Magento Development, PHP by Chris Nanninga


Unravelling Magento's collectTotals: The Core Process

Previous entries Part 1: Introduction In this series, we're looking at Magento's process for calculating and displaying totals for a cart. In our introduction we briefly covered what a "total" or "total collector" is and saw how one is defined in config.xml. Now it's time to take a closer look at the models and data structure involved. The job of a total collector model can be divided into two processes: Calculation and display. You're highly encouraged to open up the Magento codebase and follow along in the referenced code. The collectTotals process As mentioned in the previous article, the calculation of cart totals is kicked off with a call to Mage_Sales_Model_Quote::collectTotals. Before taking a look at code, there are a few things to take note of about the underlying...

Posted on May 1, 2013

Posted under Development, Magento Development, PHP by Chris Nanninga