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

Message on Logout
 
suma_user
Jr. Member
 
Total Posts:  14
Joined:  2008-04-23
 

Hi everyone smile

I could really do with some help on this, I’m not too great with PHP but trying!

I would like Magento to display a message (maybe a javascript pop up) when the user logs out. This message will tell them if there are any items in their basket, if so how many, and the total value. It will also tell them that they will be saved for their next visit.

I have been looking at ammending the AccountController.php in app/code/core/Mage/Cusotmer/Controller.

I’d really appreciate any help on solving this.

Many Thanks,
Amy

 
Magento Community Magento Community
Magento Community
Magento Community
 
Georg Ringer
Member
 
Avatar
Total Posts:  63
Joined:  2008-07-04
Linz, Austria
 

Hi,

why not use the template?
\app\design\frontend\default\<theme>\template\customer\logout.phtml

 
Magento Community Magento Community
Magento Community
Magento Community
 
suma_user
Jr. Member
 
Total Posts:  14
Joined:  2008-04-23
 

Yeah, I did think of that, but not sure if I would still have access to the session data after the logout process. I need to be able to look at what a customer had in their basket, and retrieve the total and number of products. Do you think that’s possible?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Georg Ringer
Member
 
Avatar
Total Posts:  63
Joined:  2008-07-04
Linz, Austria
 

no that won’t be possible

 
Magento Community Magento Community
Magento Community
Magento Community
 
suma_user
Jr. Member
 
Total Posts:  14
Joined:  2008-04-23
 

I didn’t think so, so i’m back to my javascript message perhaps?
Can anyone else help me solve this problem?
Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
suma_user
Jr. Member
 
Total Posts:  14
Joined:  2008-04-23
 

Can someone help me with this? Pretty please?

 
Magento Community Magento Community
Magento Community
Magento Community
 
alistek
Sr. Member
 
Total Posts:  293
Joined:  2008-04-02
Normal, IL
 

Here is an overview of the customer logout action.  Upon clicking the logout link (or redirecting) it calls AccountController.php via these actions.

/**
     * Customer logout action
     */
    public function logoutAction()
    
{
        $this
->_getSession()->logout()
            ->
setBeforeAuthUrl(Mage::getUrl());

        
$this->_redirect('*/*/logoutSuccess');
    
}

    
/**
     * Logout success page
     */
    
public function logoutSuccessAction()
    
{
        $this
->loadLayout();
        
$this->renderLayout();
    
}

Next you can see that the customer.xml layout XML file defines the template to use for logout.

<!--
Layout for customer log out page
-->

    <
customer_account_logoutsuccess>
        <!-- 
Mage_Customer -->
        <
remove name="right"/>
        <
remove name="left"/>

        <
reference name="root">
            <
action method="setTemplate"><template>page/1column.phtml</template></action>
        </
reference>
        <
reference name="content">
            <
block type="core/template" name="customer_logout" template="customer/logout.phtml"/>
        </
reference>
    </
customer_account_logoutsuccess>

And lastly you can see the actual code for the template itself:

<div class="page-head">
    <
h3><?php echo $this->__("You're now Logged Out"?></h3>
</
div>
<
p><?php echo $this->__('You have been successfully logged out and will be redirected to our homepage in 5 seconds.'?></p>
<
script type="text/javascript">
setTimeout(function(){ location.href '<?php echo $this->getUrl() ?>'},5000);
</script>

We need to pass some sort of value from the controller to the block and then to the template.

-Adam

 
Magento Community Magento Community
Magento Community
Magento Community
 
suma_user
Jr. Member
 
Total Posts:  14
Joined:  2008-04-23
 

Thanks Adam,
So if I understand correctly, i would read the information in to a global variable in the accountcontroller.php, perhaps by ammending one of the functions, and then call on this in the template. How would i go about passing it to the block and then the template? I’m confused how to do this?
Thank you smile

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