This post is not a question but an experience share.
Sometimes we need to test our Store in live environment with the live database, or be able to show clients how the new version will look like without installing another test server, or in the case you don't want to create another GIT branch on your local server and don't want to push to Live critical files...
My solution is to create another codepool just for testing purpose.
First create a file called testing.php on Magento's Root (next to index.php) with this code
<?php setcookie('testing',true); ?> <!DOCTYPE html> <html> <head> <title>test</title> <meta name="robots" content="noindex,nofollow"/> </head> <body> <a href="http://<?php echo $_SERVER['HTTP_HOST'] ?>/?___store=test_store">Go to test store</a> </body> </html>
Then we modify
Mage.php (it's a slight modification so can be deleted without incidences with a Magento update) to make the Autoload part to look like this
if (isset($_COOKIE['testing'])) $paths = BP . DS . 'app' . DS . 'code' . DS . 'test'; $paths = BP . DS . 'app' . DS . 'code' . DS . 'local'; $paths = BP . DS . 'app' . DS . 'code' . DS . 'community'; $paths = BP . DS . 'app' . DS . 'code' . DS . 'core'; $paths = BP . DS . 'lib';
Now if you want to modify your code you simply copy the folder from
app/code/test your code should work fine at this point.
For the frontend it's easier as you just need to create the store view with the code
test_store in Configuration change your current store to the test go to Design > head >
Default Robots >
Then Design > Themes should have the
default to your main theme and all others to your test theme.
If you have a multilingual store that has a selection you will have to create a website instead of store view.
There is certainly a better solutions, please share if you have it.