2013-03-19 55 views
0

加载商店之前,我想获取一些客户数据并决定加载哪个storeview。但它不工作就是这样:如何在Mage :: run之前获取Magento客户数据?

// Option 1 
$customer = Mage::getSingleton('customer/session'); // does not work before Framework is loaded 


// Option 2 
Mage::app(); 
$customer = Mage::getSingleton('customer/session'); // does work but... 
Mage::run($mageRunCode, $mageRunType); // produces here the following error: "Mage registry key "controller" already exists" 

那么,如何加载客户数据,然后加载店?

回答

1

据我所知,没有办法做到这一点,因为商店必须初始化自己,为您提供您想要使用的模型。

我能想到的唯一方法就是不用任何Magento类就直接将它们从数据库中拉出来,因为我认为自动加载器本身还没有初始化。

编辑:

尝试法师::应用程序('your_store_view_name)

+0

权,但你如何手动启动前端与法师初始化框架::应用后(); ? – ottom 2013-03-19 13:41:22

+0

请参阅我的编辑以获取更多信息 – Soundz 2013-03-19 14:04:05