Skip to content

Commit

Permalink
Check for auto-redirect option before removing default store code
Browse files Browse the repository at this point in the history
Fixes #2
  • Loading branch information
clockworkgeek committed Nov 28, 2014
1 parent 1d1a9b8 commit 543e66b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/code/community/Knectar/Storecodes/Controller/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,12 @@ public function match(Zend_Controller_Request_Http $request)
}
}
// store is valid but is it wanted?
elseif (! Mage::getStoreConfigFlag('web/url/use_store_default')) {
elseif (! Mage::getStoreConfigFlag('web/url/use_store_default') && ($redirect = $helper->getRedirectCode())) {
$storeCode = $helper->getStoreCode($request);
if ($storeCode === Mage::app()->getDefaultStoreView()->getCode()) {
$storeCode = preg_quote($storeCode);
$path = $request->getOriginalRequest()->getRequestUri();
$path = preg_replace("#/{$storeCode}(/|$)#", '', $path, 1);
$redirect = $helper->getRedirectCode();
Mage::app()->getResponse()
->setRedirect(Mage::getUrl('', array('_direct' => $path)), $redirect)
->sendResponse();
Expand Down

0 comments on commit 543e66b

Please sign in to comment.