How to create a new product type in Magento

Magento comes packed with several product types: simple, grouped, configurable, virtual, bundle, downloadable. Sometimes clients request can reach beyond any of these built in product types functionality. In such cases, usual way of handling things is throwing some new attributes and hooking into some events from which you can handle and “re-route” certain logic.

In some cases, the required product logic can extend to such level that you are better of with building a new product type in Magento. Why, you might ask? Becase of the more finer control you can achieve on product trough your own models than to poke around on the existing stuff.

Attached to this article is a fully working extension I wrote that creates a new product type in your Magento store. This new product type uses code name “customproduct”. Its based on the Mage_Catalog_Model_Product_Type_Abstract class, the one on which the “simple” product is build upon. Unlike “simple” product type, this “customproduct” does not have any, whatsoever, additional logic built in. This, I leave to you.

Also, extension comes with several “hooks” to certain Magento controllers actions. If you open the app/code/local/Ajzele/CustomProduct/Model/Observer.php you will see implemented several “blank” methods as hooks. Going to config.xml file of this extension will show you what these methods “observe”.

Here are few screenshots of how this looks like on frontend and on backend.

And here is the module (extension), Ajzele_CustomProduct.

Note, DO NOT INSTALL the extension on LIVE SITE. Use it merely for development testing and getting to know Magento product types. Extension is tested on my PC, latest Magento 1.3.2.4 version and it seems to work fine, both in admin and frontend. It is by no means intendant to be used on live site. Use it at your own responsibility.

Hope you find it useful 🙂

Cheers.