| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 41 | public static function switchScope($storeCode) |
||
| 42 | { |
||
| 43 | $stores = Mage::getModel('core/store')->getCollection() |
||
| 44 | ->addFieldToFilter('code', ['eq' => $storeCode]); |
||
| 45 | |||
| 46 | $store = $stores->getSelect()->limit(1)->query()->fetch(); |
||
| 47 | |||
| 48 | if (empty($store)) { |
||
| 49 | throw new \Exception("Unavailable data for store code: '{$storeCode}'"); |
||
| 50 | } |
||
| 51 | |||
| 52 | Mage::app()->setCurrentStore($store['store_id']); |
||
| 53 | } |
||
| 54 | } |
||
| 55 |