Adding English (India) locale

We were working on a eCommerce website based on magento for INDIA. Magento allows the locale from admin, the path to be followed is Admin >> System >> Configuration >> General >> Locale. In the “Locale” dropdown it has option for English (United States), English (United Kingdom), Hindi (India) etc. but no option for English (India).

Continue reading »

Order address edit log not maintained in Magento Enterprise edition

Magento admin has a logging module that records actions performed in Magento admin. It is a very useful module when the admin is used by multiple persons and you want to track the changes made in admin. You have the option to select which of the admin actions are logged. To select/modify the admin actions to be logged go to Admin >> System >> Configuration >> Advanced >> Admin, check the checkbox next to any actions that you want to be logged in the log file.

Continue reading »

Excluding Pages from wordpress search results

By deafult Wordpress search feature displays pages as well as posts in the search results. It may be desirable that you want to display only posts for the search results in your blog. Here how you can do this.

Create the function below and add it to your theme functions.php file.

function SearchResultsFilter($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}

add_filter('pre_get_posts','SearchResultsFilter');

Continue reading »

Running Magento indexer from command line (shell)

Magento maintain various index tables to make data access faster. Magento core updates the indexes itself when you save a product but in some cases you may be required to update the indexes yourself. There are two ways to update the indexes from Magento admin or using the command line.

Continue reading »

Disabling the form submit on press of ENTER key

enter key

At times you would have seen that when you are filling a form on a website and you hit “ENTER” key the form gets submitted. As a developer you may have come across a situation where you would have wanted to prevent this action. The solution to this is to disable the “ENTER” key using javascript. Here’s a code snippet that disables “Enter” key in HTML textbox:

<script type="text/javascript">

// <![CDATA[
function disableEnterKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (elem.type=='text'))  {return false;}
}

document.onkeypress = disableEnterKey;
// ]]>

</script>

Continue reading »

Invalid data: Filezilla is running in kiosk mode

Today I had to fix an issue in a new website of my client. I opened FilZilla and tried to add the FTP details of the site by going to File >> Site Manager. I add the “Host” details, selected protocol as “FTP”, login type “Normal”, added the “User” and “Password”, and then finally clicked on “Connect” button. Guess what happened, I was able to connect to the site – “No”. A pop up appeared saying “Filezilla is running in kiosk mode. “Normal” and “Account” logintypes are not available in this mode“.

Continue reading »

Duplicating a database in MySql

We can use the following command in Linux to duplicate database in mysql


mysqldump -hhost -uroot -p databasenameexport | mysql -hhost -uroot -p databasenameimport

Continue reading »

Parsing XML file using DOMDocument class

XML is often used as Data Interchange format. I have worked on e-commerce sites that acted as frontend for taking orders and these order were sent in XML format to third party fulfillment system.

Here we are going to parse a XML file using the DOMDocument class.

Continue reading »

Creating Virtual Hosts

Virtual Hosting is a method of hosting multiple websites (domain names like abc.com, great.com etc) on a single server. There are two main types of virtual hosting, name based and IP based.

        • “name-based”: We have multiple names running on each IP address. It is sometimes also called host-based or non-IP virtual hosts.

 

        • “IP-based”: We have a different IP address for every web site

Continue reading »

Prompting a user to save the data we are sending

In many projects we create reports and we want the data to be exported in csv file so that the user can download it and send it via email to some other department or we need to provide links to some files and want to force the user to download these file. We can use the Content-Disposition header to supply a recommended filename and force the browser to display the save dialog.

Continue reading »

Back to top