Thursday 4 June 2015

Two ways to set up the default store and defaute store view

The easiest and well known of setting the default store and the store views is setting them through Magento Admin Panel

Go into System->Manage Stores.
Click the website for which you want to set up the default store and you will get the setting page where the default store can be configured.
Click the store for which you want to set up the default store view and you can set it up on the page you get.

There is another way we have to know which may cause the first way ineffective without any obvious clues to solve the issue

In the index.php file, there are two lines related to the default store and store view as shown below:

/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

This means we can set up the variable MAGE_RUN_CODE and MAGE_RUN_TYPE in Apache/Nginx configuration files or PHP configuration file. Here is a sample configuration snippet in nginx configuration file:

fastcgi_param  MAGE_RUN_CODE default; ## Store code is defined in administration > Configuration > Manage Stores
fastcgi_param  MAGE_RUN_TYPE store;

Note: remember to check whether the configuration of the second way exists when you find that the default store/store view settings in Admin Panel don't work

No comments:

Post a Comment