Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Retrieve Customer ID in custom module
 
vcutting
Jr. Member
 
Avatar
Total Posts:  4
Joined:  2007-10-25
Grimsby, UK
 

I’m fairly new to customizing Magento, but I’m trying to make a custom module for a store I’m building.

How do i echo the logged in customer’s ID in my module?
Ive tried using the following from the customer/account module but with no result:

<?php echo $this->__('Hello, %s!'$this->htmlEscape($this->getCustomerName())) ?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
swissters
Member
 
Total Posts:  31
Joined:  2008-04-23
 

Bump

This seems like it should be fairly easy for someone who knows magento.  Any help?

 
Magento Community Magento Community
Magento Community
Magento Community
 
S4370PL
Jr. Member
 
Avatar
Total Posts:  5
Joined:  2010-01-24
 

Any update in how to retrieve the customer info to the dashboard?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jignesh Chauhan
Sr. Member
 
Total Posts:  176
Joined:  2009-12-23
 

Hello,

Please Try this code.

$customerId=Mage::getSingleton(’customer/session’)->getCustomerId();
$customerName = Mage::getModel(’customer/customer’)->load($customerId)->getName();

Thanks and Regards,

Jignesh Chauhan

 
Magento Community Magento Community
Magento Community
Magento Community
 
S4370PL
Jr. Member
 
Avatar
Total Posts:  5
Joined:  2010-01-24
 

Thank you Jignesh for your reply

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top