Customer session is different in different parts of a Magento website
Posted
by
Josh Pennington
on Stack Overflow
See other posts from Stack Overflow
or by Josh Pennington
Published on 2011-01-17T22:34:36Z
Indexed on
2011/01/17
22:53 UTC
Read the original article
Hit count: 302
magento
I have a function inside of a Helper in Magento that returns whether or not a customer attribute equals one.
Here is my Helper class
class Nie_Nie_Helper_Data extends Mage_Core_Helper_Abstract {
public function isNieAdmin() {
if(Mage::getSingleton('customer/session')->getCustomer()->getNieAdmin() == 1) {
return true;
} else {
return false;
}
}
}
Now when I call this function from a class that extends Mage_Core_Block_Template, everything seems to work fine. However when I try to use this inside one of my controllers, it does not work. In fact when I do Mage::getSingleton('customer/session')->getCustomer()->debug() the only variable that is returned is the website_id.
Does anyone know what I have to do in order to get this to work?
Thanks
Josh Pennington
© Stack Overflow or respective owner