0

I can't figure out how customer_logged_in and customer_logged_out work

<customer_logged_out>
...
</customer_logged_out>

where are they defined, how are they called?


EDIT

 <events>
    <controller_action_layout_load_before>
        <observers>
            <customer_is_logged_in_observer>
                <class>customer/observer</class>
                <method>beforeLoadLayout</method>
            </customer_is_logged_in_observer>
        </observers>
    </controller_action_layout_load_before>

I found out how this is triggered but i can't find the controller_action_layout_load_before event dispatcher

I have searched the project as a text but it doesn't show up in any file. Please shed some light on this.

thanks

2 Answers 2

1

Hi @static how are you?,

The idea it's very simple. Using You have the possibility to show/hide information for customer logged or not. That handles are executed in a observer, so for example in top menu to display log in or my account links are using that handle.

Let me know if you need more technical information. I glad to help you.

Best, ALejandro.

3
  • thanks GrinGo, but yes i will need more technical info, if you can edit your post with the files and their location, and point to where and what is executed it would be nice.
    – static
    Apr 8, 2016 at 23:53
  • it seems i am having trouble finding an event dispatcher for controller_action_layout_load_before
    – static
    Apr 9, 2016 at 0:47
  • @static I'm out from my laptop are you fine not or you can wait until tomorrow
    – AleGrinGo
    Apr 9, 2016 at 0:49
1

following events are used for customer login and customer logout

for customer login

customer_login event observer will be called. this function will be called the moment the customer logs in.you can see in the following Mage_Customer_Model_Session where the customer_login event has been called

public function setCustomerAsLoggedIn($customer)
{
    $this->setCustomer($customer);
    $this->renewSession();
    Mage::dispatchEvent('customer_login', array('customer'=>$customer));
    return $this;
}

for customer logout

customer_logout event observer will be called. this function will be called the moment the customer logs out.you can see in the following Mage_Customer_Model_Session where the customer_logout event has been called

public function logout()
{
    if ($this->isLoggedIn()) {
        Mage::dispatchEvent('customer_logout', array('customer' => $this->getCustomer()) );
        $this->_logout();
    }
    return $this;
}
3
  • I think the OP is referring to the layout handle, not the dispatched events Apr 9, 2016 at 9:10
  • i dont think so that thr are layout handles present with customer_logged_out in magento Apr 9, 2016 at 9:26
  • I can confirm that there are layout handles, check customer.xml file Apr 9, 2016 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.