我创建了几家商店,并为每家商店创建了不同的管理员。现在我想通过商店ID获取管理员详细信息。目前我正在使用给定的代码:
$sess_data = Mage::getSingleton('admin/session')->getData();
$detail = $sess_data['user']->getData();
print_r($detail);
结果:
[user_id] => 3
[firstname] => name
[lastname] => last
[email] => mss.name@gmail.com
[username] => store2
[password] => 7fa6d16a7d9892479966dde026724294:CWKkyKBp7drPnfmlJvIUxpP00J4DzPKr
[created] => 2014-10-20 22:28:49
[modified] => 2014-10-20 06:51:32
[logdate] => 2014-10-21 04:28:49
[lognum] => 6
[reload_acl_flag] => 0
[is_active] => 1
[extra] =>
[rp_token] =>
[rp_token_created_at] =>
我的问题是如何获取与该管理员帐户关联的商店ID?
答案 0 :(得分:1)
Deepak,据我所知,Magento在社区和企业版中也没有此功能。我同时工作过。您可以创建多个商店和多个管理员用户,但您无法为特定商店分配用户。我不知道你是怎么说的。
// Gets the current store's details
$store = Mage::app()->getStore();
// Gets the current store's id
$storeId = Mage::app()->getStore()->getStoreId();
// Gets the current store's code
$storeCode = Mage::app()->getStore()->getCode();
// Gets the current website's id
$websiteId = Mage::app()->getStore()->getWebsiteId();
// Gets the current store's group id
$storeGroupId = Mage::app()->getStore()->getGroupId();
// Gets the current store's name
$storeName = Mage::app()->getStore()->getName();
// Gets the current store's sort order
$storeSortOrder = Mage::app()->getStore()->getSortOrder();
// Gets the current store's status
$storeIsActive = Mage::app()->getStore()->getIsActive();
// Gets the current store's locale
$storeLocaleCode = Mage::app()->getStore()->getLocaleCode();
// Gets the current store's home url
$storeHomeUrl = Mage::app()->getStore()->getHomeUrl();
你可以通过这个获得管理员用户会话,
Mage::getSingleton('admin/session')->getUser();