Friday, August 19, 2011

Best Solutions for Ecommerce Websites – Magento Commerce

Today’s one of the most favorite open source platform for ecommerce websites is Magento Ecommerce in all over the world. The main advantages to make a websites in Magento Framework are its very user friendly and beautiful. Magento Frameworks offer various features like beyond any rational comparison and widely adored by most of Magento Developers today. Magento Ecommerce is the world’s fastest increasing ecommerce platform with a admirable number of merchants, transactions and extensions.

Magento Development offered online shopping cart and store designs which are the best. It allows the management of multiple store for the same product through its multi store functionality from the same administrative panel. It provides huge scalability and flexibility to merchants so that they can control their websites in very possible aspect.

The characteristic features and offerings of Magento can be briefed up as follows:

• Marketing promotion and tools
• Analytics and reasoning
• Search Engine Optimisation
• Site management
• Catalogue Management
• Catalogue browsing
• Product browsing
• Mobile commerce
• International Support
• Checkout
• Shipping
• Payment
• Customer Service
• Customer Accounts
• Order Management

Apart from these, the other feature of Magento Development would include Spreadsheet Import facility and Reorder Facility. In a nutshell, Magento Commerce offers everything that an online Business, or simply speaking, ecommerce can ever imagine. It is a simile to the Genie of Aladdin’s magic lamp. Ask for something for your online business, and Magento is there to fulfill your wish. It is truly the best commerce for ecommerce websites.

Monday, August 15, 2011

How to get auto redirect your customers to their language store?


Redirect the browser language is the solution for you. It can run on popular browsers such as Firefox, IE, Mozilla, Google Chrome, Avant, and Safari. Normally, Magento does not support the detection of spatial and redirection. And various online merchants direct their customers to start asking their default page where they ask them to choose best Web Development Copmany their preferred language. This is the standard way to redirect customers to their store in the local language. Another alternative is to choose a country or flag down to redirect customers to store their language (widely used in stores multilingual).

This is a very debatable; the search engine robots do not want automatic redirection and can be punished for it. But there are solutions that can solve your problem without being penalized by search engines. You can specify specific search engines and show them the necessary links for SEO for the diversion or may be before the redirection. A well-conceived strategy can help with SEO and avoid penalties. If you choose this type of redirection sure you follow the Google guidelines for the diversion and referencing some of the best practices further assistance.

Let’s take an example where you have a Magento multi language store (http://www.magento-exmaple-store.com) already setup:
  1. Default store language is English
  2. Multi language stores are in French and Spanish.
Customers coming from Spain or customers coming from France should redirect to http://www.magento-exmaple-store.com/es or http://www.magento-exmaple-store.com/fr respectively. Here it is assumed that you have already assigned/enabled store codes in URL’s via Admin Panel => System => Configuration => Web => Url Options => Add store code to Urls=> Yes
This ensures that any customers coming from the above mentioned geographic area should be redirected to their browser language store. In our case (French {fr} or Spain {es}) otherwise they will land on default English version of your store. Check Valid country code list for reference.

Prerequisites
  1. Server should be mod_rewrite = enabled.
  2. Store codes are enabled via admin as mentioned above.
  3. URL Rewriting is enabled (Admin Panel => System => Configuration => Web => Url Options => Use Web Server Rewrites => Yes)
  4. Two letter browser local code created (e.g. fr for French and es for Spanish) Admin Panel => System => Manage Stores
  5. Default store (English) should have store code “en” and sort order “0”.
  6. Spanish store “es” created with sort order “1” & French store code “fr” with sort order “2”.
  7. All these three stores are accessible via browser i.e. http://www.magento-exmaple-store.com http://www.magento-exmaple-store.com/es and http://www.magento-exmaple-store.com/fr

Auto Redirection To Browser Language Store

In order to automatically redirect the customers to their browser language settings we need to edit index.php file which will be found in your store’s root directory i.e. http://www.magento-exmaple-store.com/index.php

Edit the file and place the following piece of code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* Check For Browser languge to redirect to appropriate store */
function checkStoreLanguage()
{
   if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
       foreach (explode(",", strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])) as $accept) {
           if (preg_match("!([a-z-]+)(;q=([0-9\\.]+))?!", trim($accept), $found)) {
               $langs[] = $found[1];
               $quality[] = (isset($found[3]) ? (float) $found[3] : 1.0);
           }
       }
       // Order the codes by quality
       array_multisort($quality, SORT_NUMERIC, SORT_DESC, $langs);
       // get list of stores and use the store code for the key
       $stores = Mage::app()->getStores(false, true);
       // iterate through languages found in the accept-language header
       foreach ($langs as $lang) {
           $lang = substr($lang,0,2);
           if (isset($stores[$lang]) && $stores[$lang]->getIsActive()) return $stores[$lang];
       }
   }
   return Mage::app()->getStore();
}

/* Automatically redirect to language fr or es store view if request is for root */
if ($_SERVER['REQUEST_URI'] === '/') {
   header('Location: '.checkStoreLanguage()->getBaseUrl());
   exit;
}

#Varien_Profiler::enable();

#Mage::setIsDeveloperMode(true);

#ini_set('display_errors', 1);

umask(0);
Mage::run();
The above code will first parse the HTTP_ACCEPT_LANGUAGE header sent by browser with priority code and desired language code. [Ref: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4]. Your sort order will tell Magento which is the most preferred store (in our case “0” which is English version of the store). It will loop through the entire store views and look for ISO 639-2 letter country code (in our case en, fr and es), finally it will return whether the country code is found otherwise opens default store view which is English version of the store.

1
2
3
4
if ($_SERVER['REQUEST_URI'] === '/') {
   header('Location: '.checkStoreLanguage()->getBaseUrl());
   exit;
}

Function call to checkStoreLanguage will ensure that when root “/” (if Magento is installed in other directory than root change it accordingly) is called it fetches the correct store view and redirect the customers to their preferred language store view.

Testing Automatic Redirection

There are two methods which can help you to test the entire redirection process:
  1. Use Firefox plug-in called Quick Locale which is by far the easiest language switcher.
  2. You can optionally change your browser’s language setting. Read the instructions carefully on how to change your browser language settings.

Browser Language Redirection on IP Based Geolocation

There are various third-party tools/APIs available i.e. http://www.ipligence.com/geolocation/ which can be used to detect the customers IP address by sending ($_SERVER['REMOTE_ADDR']). Based on the return value you can redirect your users to a particular store view.


Looking for best magento e-commerce solutions?

Then contact us at Biztech Consultancy. We excel in the area of Magento Development and Customization. Our core competency lies in Magento Shopping Cart Development, Magento Customization, Magento Custom Module Development, Magento Extensions Development, PSD to Magento Conversion, and Magento Theme & Template Designing. Hire Magento Developers from us for various magento related services.

Monday, August 8, 2011

Multi language Magento store having language redirection

Browser language redirection is the solution for you. It can run on popular browsers like Firefox, IE, Mozilla, Google Chrome, Avant and Safar. Normally, Magento Development does not support geographical detection and redirection. So, various online merchants initially direct their customers to land on their default page where they ask them to choose their preferred language. This is the default way of redirecting customers to their local language store. Another alternative is to choose a country drop-down or flag to redirect customers to their language store (widely used in multi lingual stores).
Automatic redirection based on Customers Location, Geographical detection and browser language
It is a highly debatable topic that search engine robots do not wish to see automatic redirection and one can be penalized for doing this. However there are workarounds that can solve your problem without being penalized by search engines. You can specifically tell search engines and show them links which are necessary for SEO after redirection or may be before redirection. A well devised strategy can help in SEO and avoid penalties. If you are choosing this type of redirection make sure that you follow Google’s guidelines related to redirection and SEO, some best practices can further help.
Let’s take an example where you have a Magento multi language store (http://www.magento-exmaple-store.com) already setup:
  1. Default store language is English
  2. Multi language stores are in French and Spanish.
Customers coming from Spain or customers coming from France should redirect to http://www.magento-exmaple-store.com/es or http://www.magento-exmaple-store.com/fr respectively. Here it is assumed that you have already assigned/enabled store codes in URL’s via Admin Panel => System => Configuration => Web => Url Options => Add store code to Urls=> Yes
This ensures that any customers coming from the above mentioned geographic area should be redirected to their browser language store. In our case (French {fr} or Spain {es}) otherwise they will land on default English version of your store. Check Valid country code list for reference.
Prerequisites
  1. Server should be mod_rewrite = enabled.
  2. Store codes are enabled via admin as mentioned above.
  3. URL Rewriting is enabled (Admin Panel => System => Configuration => Web => Url Options => Use Web Server Rewrites => Yes)
  4. Two letter browser local code created (e.g. fr for French and es for Spanish) Admin Panel => System => Manage Stores
  5. Default store (English) should have store code “en” and sort order “0”.
  6. Spanish store “es” created with sort order “1” & French store code “fr” with sort order “2”.
  7. All these three stores are accessible via browser i.e. http://www.magento-exmaple-store.com http://www.magento-exmaple-store.com/es and http://www.magento-exmaple-store.com/fr
Auto Redirection To Browser Language Store
In order to automatically redirect the customers to their browser language settings we need to edit index.php file which will be found in your store’s root directory i.e. http://www.magento-exmaple-store.com/index.php
Edit the file and place the following piece of code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* Check For Browser languge to redirect to appropriate store */
function checkStoreLanguage()
{
   if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
       foreach (explode(",", strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])) as $accept) {
           if (preg_match("!([a-z-]+)(;q=([0-9\\.]+))?!", trim($accept), $found)) {
               $langs[] = $found[1];
               $quality[] = (isset($found[3]) ? (float) $found[3] : 1.0);
           }
       }
       // Order the codes by quality
       array_multisort($quality, SORT_NUMERIC, SORT_DESC, $langs);
       // get list of stores and use the store code for the key
       $stores = Mage::app()->getStores(false, true);
       // iterate through languages found in the accept-language header
       foreach ($langs as $lang) {
           $lang = substr($lang,0,2);
           if (isset($stores[$lang]) && $stores[$lang]->getIsActive()) return $stores[$lang];
       }
   }
   return Mage::app()->getStore();
}

/* Automatically redirect to language fr or es store view if request is for root */
if ($_SERVER['REQUEST_URI'] === '/') {
   header('Location: '.checkStoreLanguage()->getBaseUrl());
   exit;
}

#Varien_Profiler::enable();

#Mage::setIsDeveloperMode(true);

#ini_set('display_errors', 1);

umask(0);
Mage::run();
The above code will first parse the HTTP_ACCEPT_LANGUAGE header sent by browser with priority code and desired language code. [Ref: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4]. Your sort order will tell Magento which is the most preferred store (in our case “0” which is English version of the store). It will loop through the entire store views and look for ISO 639-2 letter country code (in our case en, fr and es), finally it will return whether the country code is found otherwise opens default store view which is English version of the store.
1
2
3
4
if ($_SERVER['REQUEST_URI'] === '/') {
   header('Location: '.checkStoreLanguage()->getBaseUrl());
   exit;
}
Function call to checkStoreLanguage will ensure that when root “/” (if Magento is installed in other directory than root change it accordingly) is called it fetches the correct store view and redirect the customers to their preferred language store view.
Testing Automatic Redirection
There are two methods which can help you to test the entire redirection process:
  1. Use Firefox plug-in called Quick Locale which is by far the easiest language switcher.
  2. You can optionally change your browser’s language setting. Read the instructions carefully on how to change your browser language settings.
Browser Language Redirection on IP Based Geolocation
There are various third-party tools/APIs available i.e. http://www.ipligence.com/geolocation/ which can be used to detect the customers IP address by sending ($_SERVER['REMOTE_ADDR']). Based on the return value you can redirect your users to a particular store view.