Magento Request - Frontend or Backend?

后端 未结 5 1960
臣服心动
臣服心动 2020-12-29 05:31

How can I tell if the current request is for a backend or frontend page? This check will be done inside an observer, so I do have access to the request object if that helps

5条回答
  •  -上瘾入骨i
    2020-12-29 05:46

    Have a look at the methods inside Mage/Core/Model/Store.php you'll want to use:

    Mage::app()->getStore()->isAdmin()
    

    In conjunction with

    Mage::getDesign()->getArea() == 'adminhtml'
    

    To act as a fallback where the store ID isn't set as you expect (Magento connect etc.)

提交回复
热议问题