Monday, September 19, 2011

How to overwrite / rewrite a store cookie in Magento Mage_Core_Model_App class?

We can not rewrite Mage_Core_Model_App class. The reason is explained here.
Copy your "Mage/Core/Model/App.php" to "app/code/local/Mage/Core/Model/App.php".
Find the function "_checkGetStore($type)"
Replace the below line
if (empty($_GET)) {
    return $this;
}
 */
/**
 * @todo check XML_PATH_STORE_IN_URL
 */
/*if (!isset($_GET['___store'])) {
    return $this;
}

$store = $_GET['___store'];
with
if(!isset($_REQUEST['mystore'])) {
 return $this;
}

$store = $_REQUEST['mystore'];
pass your store code to the url like www.mysite.com?mystore=your_store_code
Thats it you are done.

No comments:

Post a Comment