Magento read CSV using Varien_File_Csv library

Posted by Damodar Bashyal on April 20, 2015


Read CSV into PHP array

$file = 'csv_file_to_parse_into_php_array.csv'; // full path to your csv file.


Magento re-index via command line

Posted by Damodar Bashyal on December 29, 2014


Magento re-indexing through command line

If you are hosting your Magento store on shared hosting, this is almost required that you have to run re-index through command line. Even if you are on powerful server, you may find from time to time reindex times out if you have big data.

To over come this issue, you can use your command line to run reindex on required indexes.

I use PuTTY to connect to server and then go to your magento install and then to shell folder. e.g.


Here you can check status of current indexes with this command:


Magento find number of times a coupon has been used

Posted by Damodar Bashyal on October 13, 2014


Magento was not recording correct number of times a shopping cart coupon was used. When I ran below query in database, it was giving wrong information as far as I know.

mysql> select u.coupon_id, c.code, count(*) as total from salesrule_coupon_usage u, salesrule_coupon c where u.coupon_id=c.coupon_id and u.coupon_id IN (119, 132, 91) group by u.coupon_id;

May be I was wrong to use that query to find usage :), so tried another query, which gave me better report.