Archive for category ‘Magento’

Magento: How to cache product loading

You probably know the famous $product->load($product->getId()) that populates your product object with data retrieved from database. This method does not use native Magento caching while it could be useful to avoid numbers of repetitive MySQL queries. Here is a short example showing you how to cache Magento product loading.

Force your Magento module to be installed after the default ones

Sometimes you absolutely want your module to be installed after the default ones defined in Magento. You have propably tried to play with the dependencies between modules, but this has no impact on the prioritization of modules. Here is a little code snippet to keep Magento default installation and to install your module afterwards.

Magento: Create your own admin controller in a new tab

We have already seen in a previous post how to override a controller into Magento. This time I’ll show you how to create your own controller in admin panel in an efficiant way, because there are many solutions here and there but they do not always work and are sometimes obsolete. We will access our […]

Magento: Save products stock movements

With Magento, the stock of a product is not stored each time it’s changing. However, the stock may be modified in many ways (product ordered, canceled order, manual changes, imports, etc..) and it may be useful to know how and when the stock has changed. Here is a simple extension that saves over time the […]

Install Magento modules with modgit

When developing Magento modules, it is quite tedious to create packages for Magento Connect. That is why there are often modules that are not present in this one but available elsewhere, eg on GitHub. I will present here a very fast way to install Magento modules available on Git repositories through modgit tool.

Magento: Add images to product attribute options

In a Magento project, we have sometimes the desire to associate an image with attributes options of our products. This can be useful in the layered navigation to highlight a list of colors rather than text alone, or associate a logo with the brand of a product and display it in the product view. I […]

Disable an event observer defined by default in Magento

Another simple trick. This time we will see how to disable a default event observer. This can be useful if you want to prevent a method to be executed when Mage::dispatchEvent() is called, or simply if you want to define the behavior you want by writing your own observer.