0

after customer logged in to our site, it's redirecting to "my account " page.

but i want to redirect to "shopping cart" page.

i reffered this link for

[ Creating account = > Shopping cart page]

now we need for

"loogged in = > "shopping cart page

please help me to find solution

2

In this case,you can use event customer_login and

Condtion:

  • fire this event on frontend <frontend> area.
  • Basically when customer are loggedin success then the event is fire.Also and put a condition for current full action for Mage::app()->getRequest()->getFullActionName()=='customer_account_loginPost' because of Customer also register at checkout step

Then at observer redirect to your shopping cart page using below code:

Mage::app()->getResponse()
                        ->setRedirect($YOurUrl)
                             ->sendResponse();

Config.xml code:

  <global>
    <models>
      <magento>
        <class>StackExchange_Magento_Model</class>
      </magento>
    </models>
  </global>
<frontend><!-- area -->
    <events>
      <customer_login> <!-- identifier of the event we want to catch -->
        <observers>
          <customer_login_redirect> <!-- identifier of the event handler -->
            <type>model</type> <!-- class method call type; valid are model, object and singleton -->
            <class>magento/observer</class> <!-- observers class alias -->
            <method>redirectiontoCart</method>  <!-- observer's method to be called -->
          </customer_login_redirect>
        </observers>
      </customer_login>
    </events>
<frontend>

Observer.php is :

<?php
class StackExchange_Magento_Model{
public function redirectiontoCart(Varien_Event_Observer $observer)
    {
        if(Mage::app()->getRequest()->getFullActionName()=='customer_account_loginPost'):
            Mage::app()->getResponse()
                            ->setRedirect($YOurUrl)
                                 ->sendResponse();

        endif;

    }
}
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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