Magento: Event Observer with Save before and Save after

Magento has this cool functionality of Event Observer. Magento follows the Observer Design Pattern for its event hooking system. With this Event Observer Hook, additional functionality can be added without modifying the core code. The full list of Magento Event Observer Hooks is present over here:- Magento Event/Observer Hooks Cheat Sheet Magento has been programmed … Read more

Magento: How to run Magento code in an external website?

Suppose you have a Magento shop installed. You also have another php installation in your server (may it be wordpress, joomla, drupal, or any other php code system). Now, you want to get Magento shop data in your external website which is not Magento. So, how to do this? It’s simple. You just need to … Read more

Magento: How to search or filter by multiselect attribute in admin grid?

Suppose you have a multi select attribute and you have displayed it in admin grid. You have displayed the multi select attribute options as selection list. Now, you want to filter/search the grid by the multiselect attribute. The problem here is that the multiselect attribute value is store as comma separated value in database. When … Read more

Magento: How to get top rated products?

Here, I will be showing you how to get the top/highest rated product. The basic idea for getting the top rated products is fetching all products, looping through them, getting ratings of each product and populating a ratings array. After that sort the array and then slice the array for limiting the number of product … Read more

Sample valid credit card numbers for testing

Here is a list of sample/dummy/test credit card numbers, which are safe to use when you test credit card functionality on a website or application that involves credit card transactions. These credit card numbers validate properly but they are not actually in use. NOTE: Expiry or Expiration date can be any valid date of the … Read more

Magento: Up-sells, Cross-sells and Related products are not showing up

Here is a quick solution to the problem of upsell, cross sell and related products not showing up in Magento shop frontend. This problem occurs in Magento version 1.4 or higher. Scenario: I have added up-sells, cross-sells and related products to a product from admin. But when I view the product from frontend, I don’t … Read more

Magento: How to get / filter all products by attribute value?

Here, I will show you how you can filter or fetch products related to any particular attribute and value. A simple scenario will be filtering products by manufacturer/brand. Suppose, I want to get all products under ‘Samsung’ manufacturer/brand. For this, you need the attribute code and attribute value ID for which you are fetching products. … Read more

Magento: How to remove index.php from URL?

In your Magento shop URL, if you see “index.php” and wanted to remove it then here is the solution. – First of all, apache module ‘mod_rewrite‘ should be enabled. Check apache’s httpd.conf file. – Then login to Magento admin panel – Go to System -> Configuration -> Web -> Search Engines Optimization -> Use Web … Read more

Magento: Product is still visible in catalog and search even after changing visibility to nowhere

Scenario: I have changed my product’s Visibility to ‘Nowhere‘. But still the product is visible in both catalog and search. I have refreshed cache but the problem is still there. Cause: This problem arises because the Scope of Visibility attribute is Store View by default. This means that it’s value is set differently for each … Read more