magento如何知道哪个商店使用?

Dee*_*tta 3 magento

Magento何时决定使用哪个商店视图,以及何时设置当前区域设置?

我想知道我应该在哪里进入文件以了解将在fronend中使用哪个商店视图?

Dee*_*tta 6

谢谢大家,

我想分享一下我的发现:

  1. Index.php调用 Mage::run()
  2. 它调用app/mage.php :: run()
  3. run函数有最后 self::$_app->run(...)一行调用Mage_Core_Model_App::run()函数的代码行
  4. Mage_Core_Model_App::run() 包括 $this->_initCurrentStore($scopeCode, $scopeType);
  5. _initCurrentStore()::使用_initStores()方法将所有网站,组和商店加载到网站,组和存储对象中.此功能检查网站是网站还是商店组或商店,如果它是一个,那么它设置当前商店.如果范围是基础,那么它就会通过$this->_checkCookieStore()
  6. $this->_checkCookieStore()::这从cookie获取商店类型$this->getCookie()->get(Mage_Core_Model_Store::COOKIE_NAME);,在那里它检查它是网站,组还是商店,并在$this->_currentStore = $store; cookie返回的值的基础上设置当前商店.
  7. Mage_Core_Model_App::_checkGetStore(),这将使用xpath_of_store_url检查当前存储,更新cookie

Mage_Core_Model_App::init()调用当前语言环境时,init()函数具有$this->_initEnvironment();locale设置