8

For the creation of multistore magento we use following code

$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
Mage::run($mageRunCode, $mageRunType);

What will be the difference if we use website instead of store in $_SERVER['MAGE_RUN_TYPE'] : 'store'; code

13

I want to correct KESHAV_PHP here.

$_SERVER['MAGE_RUN_TYPE'] defines the type of entity which is used to select the store in the end. If you define a specific store by passing here store, then the store is loaded. This means espacially (in contradiction to what keshav wrote), that it doesn't matter wether the store is part of the default website or not.

If you pass website, then the store is loaded which is default for the website.

$_SERVER['MAGE_RUN_CODE'] defines the code of the website or store, as defined in the tables core_website.code and core_store.code.

The whole process can be found here:

\Mage_Core_Model_App::_initCurrentStore
switch ($scopeType) {
        case 'store':
            $this->_currentStore = $scopeCode;
            break;
        case 'group':
            $this->_currentStore = $this->_getStoreByGroup($scopeCode);
            break;
        case 'website':
            $this->_currentStore = $this->_getStoreByWebsite($scopeCode);
            break;
        default:
            $this->throwStoreException();
    }

Where getStoreByWebsite only gets the default group and then calls getStoreByGroup which gets the default store for the group.

  • Fabulous explanation.+1 for digging core :) – Rajeev K Tomy Sep 1 '14 at 1:59
1

Currently am also working on different website in magento site.In my project am creating three websites with stores that specific to website.

$server[mage_run_type]:website mean that when the site is load , magento load the website .

$server[mage_runtype]:store means that magento load the store of default website.

http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/navigation/multiple-website-setup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.