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

Magento: Join, filter, select and sort attributes, fields and tables

In my previous article (Magento: Very Useful Collection Functions), I had written about database interaction functions present in class Varien_Data_Collection_Db. Here, I am going to explain some database interaction functions present in the class Mage_Eav_Model_Entity_Collection_Abstract. These collection functions are very useful to select data from Magento database. We need them almost all the time for … Read more

Magento: Convert Price from Current Currency to Base Currency and vice-versa

Here is a quick code to convert price amount from current currency of the shop to base currency. This is applicable when you have a multiple currency shop. From the code below, you can convert any currency you desire. You just need the ‘From Currency Code’ and ‘To Currency Code’. In the example below, I … Read more

PHP: How to get stock quote data from Yahoo! Finance? (Complete Code and Tutorial)

In this tutorial, I will be showing you how you can fetch any company’s data from Yahoo! Finance. INTRODUCTION First of all, let us see the stock quote data of top tech companies on Yahoo! Finance. View the basic Google stock chart on Yahoo! Finance: http://finance.yahoo.com/q?s=goog For eBay: http://finance.yahoo.com/q?s=EBAY For Amazon: http://finance.yahoo.com/q?s=AMZN For Apple: http://finance.yahoo.com/q?s=AAPL … Read more

PHP: Read Write CSV

In this article, I will be showing you how to read and write CSV file with PHP. I have used PHP function fgetcsv to read CSV fields and fputcsv to write on CSV file. fgetcsv — Gets line from file pointer and parse for CSV fields. fgetcsv() parses the line it reads for fields in … Read more

PHP: How to get Main or Base URL?

Suppose you are on a page : http://example.com/category/php/ Now, the base URL or the main URL for the above link is : http://example.com Similarly, in the case of local machine (localhost), Suppose you are in the page : http://localhost/myproject/index.php?id=8 Here, the base or main URL is : http://localhost/myproject Below is the code to get main … Read more