Skip to content

Commit

Permalink
Merge branch 'release/release-1.5.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
ctasca committed Feb 8, 2016
2 parents 4deeb51 + 7c60a08 commit b3d8944
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions magefix/src/Magefix/Magento/Store/Scope.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,22 @@ public static function setCurrentStoreScope()
{
Mage::app()->setCurrentStore(self::$_currentStore);
}

/**
* @param $storeCode
* @throws \Exception
*/
public static function switchScope($storeCode)
{
$stores = Mage::getModel('core/store')->getCollection()
->addFieldToFilter('code', ['eq' => $storeCode]);

$store = $stores->getSelect()->limit(1)->query()->fetch();

if (empty($store)) {
throw new \Exception("Unavailable data for store code: '{$storeCode}'");
}

Mage::app()->setCurrentStore($store['store_id']);
}
}

0 comments on commit b3d8944

Please sign in to comment.