Archive for the ‘Programming’ Category

View and Filter Orders Grid with Product SKU

March 3rd, 2012

One of the most bewildering missing features I have come across in Magento is the inability to look up orders by ordered products. There are occasions where this feature is sorely needed. For example, you may discover a product needs to be recalled and need a list of every order in the past month containing that product. I discovered I wasn’t the only soul begging for this feature. There is one solution posted which worked but had a few problems. To be precise, it breaks the pager, it replaces a core file and filtering doesn’t work. So, I’ve fixed the major problems and packaged and released it as a free module on github!

This module adds a column to the orders grid which displays either the product name and ordered quantities or the product SKU and ordered quantities which is configurable under Sales > Orders Grid Products Column. The one not selected to be displayed will be added to the title attribute so it can be seen with a mouse hover. The column is filterable by either the product name or SKU depending on the configuration.


Magento, Programming

Module Manager Update, now on Google Code!

January 31st, 2010

I recently updated Module Manager (first post) to support nested modules and renamed the .modman definitions file to simply modman for easier editing in IDEs. To top it off I am officially releasing it to the public under the Apache License 2.0 so that you may start using it in your own projects.

Additionally, Module Manager now has it’s own home on Google Code so check it out! (pun intended)

Here is an example of the new nested modules feature:

# My template files
skin               skin/frontend/my/default
design             app/design/frontend/my/default

# Import Colin_HotDealz module
@import            modules/Colin_HotDealz

Magento, Programming , , ,

Module Manager – for when svn:externals just doesn’t cut it.

October 17th, 2009

Update 1/30/2010:
Added nested modules, renamed .modman file to modman, released under Apache License 2.0, and hosted on Google Code.

This project was inspired by my recent Magento development work so I’m not sure how much application it has outside of that, but if you’ve ever wanted to use svn:externals with individual files (you can’t btw) then this is the next best thing (and therefore the best thing). Perhaps some other VCS supports this functionality natively , if you know of it please clue me in. I’ve used git and bazaar but still like the simplicity of subversion for small, non-distributed projects.

Magento’s source code is split among several different groups of files: code, design, locale, skin, libs, etc (as in config), etc.. (as in etcetera)
You really cannot avoid ever having to mix a file in here or there which means svn:externals won’t cut it. Besides, svn:externals won’t let you make one commit from all of your externals so to commit your changes you have to do it once for each folder which makes your commit history nearly useless. Enter “modman”, my Magento module manager. While it could be used for deployment it is primarily geared towards developers. Here is how it works:

Read more…

Magento, Programming , ,

Yet Another “Hiding Out-Of-Stock Products” Update

September 28th, 2009

Update: Bug fix

It turns out that when layered navigation indexes are refreshed the website_id is 0 which causes the filtered results to be empty which makes layered navigation disappear. The fix is to simply place an if statement around the filter dependent on the website id no being 0. The Magento Connect module has been updated with this fix (0.3.1).

Ok, I think this will finally be the last update to this module… I’ve learned a lot about Magento since the first version of this module, and think I finally did it right this time. This update adds support for advanced search (thanks saho for the bug report) and also every other aspect of the store I could find.
Read more…

Magento, Programming

Hiding “Out of Stock” items in Layered Navigation

July 14th, 2009

Updated 9/28/09

See the latest post in this series: Yet Another “Hiding Out-Of-Stock Products” Update, for an update that fixes advanced search, tags, up-sells, cross-sells, etc..

Updated 7/23/09

Updated once again to add support for filtering search results. (Added CatalogSearch/Model/Layer.php, moved Model/Layer.php to Catalog/Model/Layer.php, updated config.xml)

My previous post about “Hiding Out of Stock Items in Magento” had one pretty major downfall, in that it did not handle the product counts in the layered navigation. In response to a forum post regarding this I looked into fixing my original solution and have come up with a more concise and complete approach which I present now as a replacement to my original InStockOnly module.

Read more…

Magento, Programming

Hiding “Out of Stock” Items in Magento

June 2nd, 2009

Updated 7/14/09

This module has been replaced with one that correctly updates the layered navigation counts. See the new version here.

Updated 7/3/09

The in-stock-only module now works properly when multiple websites are in use.

Updated 6/26/09

The in-stock-only module now works with configurable products.


Magento has several criteria for determining if an item should be visible in the store, but one of these is not whether or not the item is in stock. Magento can manage your stock and will set your stock status to “Out of Stock” for you, but what if you want these out of stock items to be hidden from the store.. automatically? Also, in my case I do not want to “disable” the item because the inventory management system will then ignore it. Turns out this was much more difficult to figure out than I expected it to be but the end solution was quite simple.

Read more…

Magento, Programming ,

Implementing Zend Framework’s “Conventional Modular” Directory Structure in Kohana

April 19th, 2009

There is a little conflict in terms here because “modules” are not the same to Kohana as they are to Zend Framework and Yii Framework, which both have support for modular directory structures. In Kohana, modules are like plugins to the framework which can change or add functionality to the core to be made use of in the application. The “Conventional Modular” Directory Structure in Zend Framework is a configuration option, and modules are more like sub-applications; essentially just a neat way to organize various components of an application.

Read more…

Programming , ,

Event Delegation for Prototype

March 23rd, 2009

Today I’d like to present my own rendition of an Event Delegator class based on Prototype. Event Delegation can be used to improve performance and code simplicity by observing one parent element and triggering events on the children when applicable rather than observing each child element individually.

Read more…

Programming ,

DAMit Version 2

November 18th, 2008

While working at Seelab at The University of Tennessee in 2006 one of my first tasks was to rename every function in what is now the Visualization CookBook, but was previously another name. We developed a simple Document for API Modification and called it the DAM document. I then wrote a Perl script to apply the DAM document to user’s source code to ease the pains of a major API modification and we named it “DAMit”. Yes, we too thought it was funny.

Read more…

Programming ,

Ajax.DoubleCombo update

November 11th, 2008

Due to a recent request about my Ajax.DoubleCombo class, I have updated it to support automatic updates trickling down when the server returns a “selected” value or the default value is non-void. In the process, I added some Prototype 1.6 custom events, namely doubleCombo:update and doubleCombo:clearSlaves which in turn added support for what I will call “branching”. That is, support for multiple slave selects at each level. I don’t know if anyone has a use for this but it is now supported…

Here is the page with the code, docs and demo: Ajax.DoubleCombo

Programming ,