문제

I have a website in Magento 1.9 called www.example.com. In Magento, we know that we can create multiple websites so I have created like that multiple websites with their own store and store view. so I have the site.

example.com(default)
example.com(2)
example.com(3)
example.com(4)

My requirement is I need to switch to these websites by staying the same URL (www.example.com). Can any one help me to do this?

도움이 되었습니까?

해결책

After some experiments i have found the solution.You can pass the website code in get parameter and on the basis of that code run the website in index.php. This way your url will not be changed and also set a session for website code.

if (isset($_GET["website"])){
   $web=$_GET['website'];
}

if($web=="clt")
{
   $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? 
   $_SERVER['MAGE_RUN_CODE'] : 'clt';
   $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'website';
   Mage::run('clt', 'website');
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top