I want to log the recently viewed product for every visitor on the site. And for that the best way I believe is to log it via their cookie/session ID. How can I get the Session ID/Cookies of a visitor who is not logged in.
Thanks,
I want to log the recently viewed product for every visitor on the site. And for that the best way I believe is to log it via their cookie/session ID. How can I get the Session ID/Cookies of a visitor who is not logged in.
Thanks,
you can get the visitor id by session
$vistitorId = Mage::getModel('core/session')->getVisitorId();
To get Cookies
Mage::app()->getRequest()->getCookie();
To get Session Id
$session = Mage::getSingleton('customer/session', array('name' => 'frontend'));
echo $session->getId();
echo $session->getCustomerId();
FYI : There is a default magento functionality available for the recently viewed products
Please check the below url
Magento: Show Visitor's Recently Viewed Product