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

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

Magento: How to enable maintenance mode?

Maintenance mode is a key feature required to any website. You need to set the live website into maintenance mode whenever you need to do any changes in the website. Here, I will show how you can do this in Magento. For Magento version 1.4 and above, you just need to create a file named … Read more

Magento: How to check if current page is homepage?

Here is a quick Magento code to check if the current page is homepage or not. If you are in template/page/html/header.phtml template file, then you can check for homepage with the following code: if($this->getIsHomePage()) { echo 'You are in Homepage!'; } else { echo 'You are NOT in Homepage!'; } If you are elsewhere (in … Read more