Magento redirect to checkout after adding to cart












0















I want to disable the shopping cart page. I mean that when customers add products to cart, Magento will skip the shopping cart page and redirects them to the checkout page to shorten buying process.



Is there any way to make it successful?



Please suggest me.










share|improve this question
















bumped to the homepage by Community 8 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1





    magento verision?

    – Amit Bera
    May 8 '16 at 12:56











  • Want the redirection for after cart or at any time if user hit checkout/cart/

    – Amit Bera
    May 8 '16 at 13:19
















0















I want to disable the shopping cart page. I mean that when customers add products to cart, Magento will skip the shopping cart page and redirects them to the checkout page to shorten buying process.



Is there any way to make it successful?



Please suggest me.










share|improve this question
















bumped to the homepage by Community 8 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1





    magento verision?

    – Amit Bera
    May 8 '16 at 12:56











  • Want the redirection for after cart or at any time if user hit checkout/cart/

    – Amit Bera
    May 8 '16 at 13:19














0












0








0








I want to disable the shopping cart page. I mean that when customers add products to cart, Magento will skip the shopping cart page and redirects them to the checkout page to shorten buying process.



Is there any way to make it successful?



Please suggest me.










share|improve this question
















I want to disable the shopping cart page. I mean that when customers add products to cart, Magento will skip the shopping cart page and redirects them to the checkout page to shorten buying process.



Is there any way to make it successful?



Please suggest me.







checkout magento-1 redirect






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 '17 at 12:05









7ochem

5,76293768




5,76293768










asked May 8 '16 at 12:42









JamesljJameslj

50639




50639





bumped to the homepage by Community 8 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 8 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 1





    magento verision?

    – Amit Bera
    May 8 '16 at 12:56











  • Want the redirection for after cart or at any time if user hit checkout/cart/

    – Amit Bera
    May 8 '16 at 13:19














  • 1





    magento verision?

    – Amit Bera
    May 8 '16 at 12:56











  • Want the redirection for after cart or at any time if user hit checkout/cart/

    – Amit Bera
    May 8 '16 at 13:19








1




1





magento verision?

– Amit Bera
May 8 '16 at 12:56





magento verision?

– Amit Bera
May 8 '16 at 12:56













Want the redirection for after cart or at any time if user hit checkout/cart/

– Amit Bera
May 8 '16 at 13:19





Want the redirection for after cart or at any time if user hit checkout/cart/

– Amit Bera
May 8 '16 at 13:19










2 Answers
2






active

oldest

votes


















0














Assume that you have using magento 1.x version



and assume that you does not want access checkout/cart/ at all time.



For this case you can use Magento Event/observer.



This is case use magento event controller_action_predispatch_checkout_cart_index



and from this event observer redirect to checkout/onepage/ page




  <global>
<events>
<controller_action_predispatch_checkout_cart_index>
<observers>
<redirect_to_checkout_from_cart>
<type>singleton</type>
<class>[ModuleNameSpace]_[ModuleName]_Model_Observer</class>
<method>forceToGoCheckoutPage</method>
</redirect_to_checkout_from_cart>
</observers>
</controller_action_predispatch_checkout_cart_index>
</events>
</global>



Observer:



<?php
class ModuleNameSpace]_[ModuleName]_Model_Observer{
public function forceToGoCheckoutPage($observer){
// force redirct to checkout page
Mage::app()->getFrontController()->getResponse()
->setRedirect(Mage::getUrl('chekout/onepage'))
->sendResponse();
exit();

}
}





share|improve this answer

































    0














    My final observer:



    I've added a check for cart items because if cart cookie expires or you refresh checkout or success order page, magento displays error 500, too many redirects. If there are no items in cart you must redirect to another page like homepage.



      public function forceCheckoutRedirect($observer){

    $numberOfItems = Mage::helper('checkout/cart')->getItemsCount();
    // force redirct to checkout page if cart is not empty
    if($numberOfItems > 0) {
    Mage::app()->getFrontController()->getResponse()
    ->setRedirect(Mage::getUrl('onepage'))
    ->sendResponse();
    exit();
    }
    else {
    Mage::app()->getFrontController()->getResponse()
    ->setRedirect(Mage::getUrl('/'))
    ->sendResponse();
    exit();

    }

    }





    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "479"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f114443%2fmagento-redirect-to-checkout-after-adding-to-cart%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Assume that you have using magento 1.x version



      and assume that you does not want access checkout/cart/ at all time.



      For this case you can use Magento Event/observer.



      This is case use magento event controller_action_predispatch_checkout_cart_index



      and from this event observer redirect to checkout/onepage/ page




        <global>
      <events>
      <controller_action_predispatch_checkout_cart_index>
      <observers>
      <redirect_to_checkout_from_cart>
      <type>singleton</type>
      <class>[ModuleNameSpace]_[ModuleName]_Model_Observer</class>
      <method>forceToGoCheckoutPage</method>
      </redirect_to_checkout_from_cart>
      </observers>
      </controller_action_predispatch_checkout_cart_index>
      </events>
      </global>



      Observer:



      <?php
      class ModuleNameSpace]_[ModuleName]_Model_Observer{
      public function forceToGoCheckoutPage($observer){
      // force redirct to checkout page
      Mage::app()->getFrontController()->getResponse()
      ->setRedirect(Mage::getUrl('chekout/onepage'))
      ->sendResponse();
      exit();

      }
      }





      share|improve this answer






























        0














        Assume that you have using magento 1.x version



        and assume that you does not want access checkout/cart/ at all time.



        For this case you can use Magento Event/observer.



        This is case use magento event controller_action_predispatch_checkout_cart_index



        and from this event observer redirect to checkout/onepage/ page




          <global>
        <events>
        <controller_action_predispatch_checkout_cart_index>
        <observers>
        <redirect_to_checkout_from_cart>
        <type>singleton</type>
        <class>[ModuleNameSpace]_[ModuleName]_Model_Observer</class>
        <method>forceToGoCheckoutPage</method>
        </redirect_to_checkout_from_cart>
        </observers>
        </controller_action_predispatch_checkout_cart_index>
        </events>
        </global>



        Observer:



        <?php
        class ModuleNameSpace]_[ModuleName]_Model_Observer{
        public function forceToGoCheckoutPage($observer){
        // force redirct to checkout page
        Mage::app()->getFrontController()->getResponse()
        ->setRedirect(Mage::getUrl('chekout/onepage'))
        ->sendResponse();
        exit();

        }
        }





        share|improve this answer




























          0












          0








          0







          Assume that you have using magento 1.x version



          and assume that you does not want access checkout/cart/ at all time.



          For this case you can use Magento Event/observer.



          This is case use magento event controller_action_predispatch_checkout_cart_index



          and from this event observer redirect to checkout/onepage/ page




            <global>
          <events>
          <controller_action_predispatch_checkout_cart_index>
          <observers>
          <redirect_to_checkout_from_cart>
          <type>singleton</type>
          <class>[ModuleNameSpace]_[ModuleName]_Model_Observer</class>
          <method>forceToGoCheckoutPage</method>
          </redirect_to_checkout_from_cart>
          </observers>
          </controller_action_predispatch_checkout_cart_index>
          </events>
          </global>



          Observer:



          <?php
          class ModuleNameSpace]_[ModuleName]_Model_Observer{
          public function forceToGoCheckoutPage($observer){
          // force redirct to checkout page
          Mage::app()->getFrontController()->getResponse()
          ->setRedirect(Mage::getUrl('chekout/onepage'))
          ->sendResponse();
          exit();

          }
          }





          share|improve this answer















          Assume that you have using magento 1.x version



          and assume that you does not want access checkout/cart/ at all time.



          For this case you can use Magento Event/observer.



          This is case use magento event controller_action_predispatch_checkout_cart_index



          and from this event observer redirect to checkout/onepage/ page




            <global>
          <events>
          <controller_action_predispatch_checkout_cart_index>
          <observers>
          <redirect_to_checkout_from_cart>
          <type>singleton</type>
          <class>[ModuleNameSpace]_[ModuleName]_Model_Observer</class>
          <method>forceToGoCheckoutPage</method>
          </redirect_to_checkout_from_cart>
          </observers>
          </controller_action_predispatch_checkout_cart_index>
          </events>
          </global>



          Observer:



          <?php
          class ModuleNameSpace]_[ModuleName]_Model_Observer{
          public function forceToGoCheckoutPage($observer){
          // force redirct to checkout page
          Mage::app()->getFrontController()->getResponse()
          ->setRedirect(Mage::getUrl('chekout/onepage'))
          ->sendResponse();
          exit();

          }
          }






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 8 '16 at 13:34

























          answered May 8 '16 at 13:24









          Amit BeraAmit Bera

          58.3k1475174




          58.3k1475174

























              0














              My final observer:



              I've added a check for cart items because if cart cookie expires or you refresh checkout or success order page, magento displays error 500, too many redirects. If there are no items in cart you must redirect to another page like homepage.



                public function forceCheckoutRedirect($observer){

              $numberOfItems = Mage::helper('checkout/cart')->getItemsCount();
              // force redirct to checkout page if cart is not empty
              if($numberOfItems > 0) {
              Mage::app()->getFrontController()->getResponse()
              ->setRedirect(Mage::getUrl('onepage'))
              ->sendResponse();
              exit();
              }
              else {
              Mage::app()->getFrontController()->getResponse()
              ->setRedirect(Mage::getUrl('/'))
              ->sendResponse();
              exit();

              }

              }





              share|improve this answer




























                0














                My final observer:



                I've added a check for cart items because if cart cookie expires or you refresh checkout or success order page, magento displays error 500, too many redirects. If there are no items in cart you must redirect to another page like homepage.



                  public function forceCheckoutRedirect($observer){

                $numberOfItems = Mage::helper('checkout/cart')->getItemsCount();
                // force redirct to checkout page if cart is not empty
                if($numberOfItems > 0) {
                Mage::app()->getFrontController()->getResponse()
                ->setRedirect(Mage::getUrl('onepage'))
                ->sendResponse();
                exit();
                }
                else {
                Mage::app()->getFrontController()->getResponse()
                ->setRedirect(Mage::getUrl('/'))
                ->sendResponse();
                exit();

                }

                }





                share|improve this answer


























                  0












                  0








                  0







                  My final observer:



                  I've added a check for cart items because if cart cookie expires or you refresh checkout or success order page, magento displays error 500, too many redirects. If there are no items in cart you must redirect to another page like homepage.



                    public function forceCheckoutRedirect($observer){

                  $numberOfItems = Mage::helper('checkout/cart')->getItemsCount();
                  // force redirct to checkout page if cart is not empty
                  if($numberOfItems > 0) {
                  Mage::app()->getFrontController()->getResponse()
                  ->setRedirect(Mage::getUrl('onepage'))
                  ->sendResponse();
                  exit();
                  }
                  else {
                  Mage::app()->getFrontController()->getResponse()
                  ->setRedirect(Mage::getUrl('/'))
                  ->sendResponse();
                  exit();

                  }

                  }





                  share|improve this answer













                  My final observer:



                  I've added a check for cart items because if cart cookie expires or you refresh checkout or success order page, magento displays error 500, too many redirects. If there are no items in cart you must redirect to another page like homepage.



                    public function forceCheckoutRedirect($observer){

                  $numberOfItems = Mage::helper('checkout/cart')->getItemsCount();
                  // force redirct to checkout page if cart is not empty
                  if($numberOfItems > 0) {
                  Mage::app()->getFrontController()->getResponse()
                  ->setRedirect(Mage::getUrl('onepage'))
                  ->sendResponse();
                  exit();
                  }
                  else {
                  Mage::app()->getFrontController()->getResponse()
                  ->setRedirect(Mage::getUrl('/'))
                  ->sendResponse();
                  exit();

                  }

                  }






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 7 '17 at 11:17









                  mlavelamlavela

                  476




                  476






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Magento Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f114443%2fmagento-redirect-to-checkout-after-adding-to-cart%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Magento 2 controller redirect on button click in phtml file

                      Polycentropodidae