In Magento 1.9 I want to get the customerId of opened customer in Mage_Adminhtml_Block_Customer_Edit_Tab_View
.
I tried like this:
$customer_session = Mage::getSingleton('customer/session'); //I saw here in Stackoverflow this
$customer = $customer_session->getCustomer();
$customerID = $customer->getId();
But I got a null.
I also tried with $this->getId()
and Mage::helper('customer')->getId()
, but neither worked.
How do achieve this?
2
Answers
I figured out that the correct way is:
$customerID = $this->getCustomer()->getId();
For admin we should use ‘admin/session’ for ‘customer/session’