Showing posts with label admin. Show all posts
Showing posts with label admin. Show all posts

Sunday, 25 October 2015

how to check admin is logged in or not in Magento

 Hi with the below peace of code you can check admin user is logged in or not anywhere is magento

$sesId = isset($_COOKIE['adminhtml']) ? $_COOKIE['adminhtml'] : false ;
$session = false;
if($sesId){
    $session = Mage::getSingleton('core/resource_session')->read($sesId);
}
$loggedIn = false;
if($session)
{
    if(stristr($session,'Mage_Admin_Model_User'))
    {
        $loggedIn = true;
    }
}
var_dump($loggedIn);// this will be true if admin logged in and false if not

Monday, 14 January 2013

Get custom attribute value in magento admin orders

with this code you can get any custom attribute value in magento admin order section , you can show only in admin or in frontend depends upon your need
   

 <div style="color: black; font-size: 14px; font-weight: bold;">proviser <span><?php $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $_item->getSku(), array('provider')); echo $product->getprovider(); ?>  </span>  </div>

in above code just replace your attribute code which you specify in admin for that like for my case i use "provider "
just replace provider with your attribute code and place this in your 

/public_html/app/design/adminhtml/default/default/template/sales/items/column/name.phtml file