2

How does one get the Guest ID in Magento? I see it in administration under Customers>Guests but how can one print it on a page in the front end?

I found this for regular customers:

<?php
echo Mage::getSingleton('customer/session')->getId();
?>
qrs
  • 177
  • 6
  • 20
  • This answer can help to you. http://stackoverflow.com/questions/9048180/how-do-i-create-a-magento-session-outside-of-magento – 502_Geek Jun 24 '13 at 04:00

2 Answers2

5
$visitorData = Mage::getSingleton('core/session')->getVisitorData();
echo $visitorData['visitor_id'];
Steve Robbins
  • 13,672
  • 12
  • 76
  • 124
1
Mage::getModel('core/session')->getVisitorId();

good luck!

Michael Leiss
  • 5,395
  • 3
  • 21
  • 27
  • This does not work for me on enterprise ver. 1.13.0.2 – activeDev Dec 09 '13 at 13:36
  • @activeDev Try `zend_debug::dump(Mage::getModel('core/session')->getData())` (*this is just like var_dump*). now check what is the exact call to be made for getting guest id. – Mr_Green Dec 09 '13 at 14:55