Can't Access Quote from checkout session after returning from payment Gateway












2














I am building payment gateway extension and i am facing small issue to get the quote object after control return from payment Gateway.



Let me explain you in detail.



I am using below funtion to redirect to payment gateway.



public function getCheckoutRedirectUrl()
{
return Mage::getUrl('custom/index/start');
}


Above method works fine. I am redirecting to payment gateway and payment processed successful with success message and redirect back to our store with captured status on below controller action.



public function returnAction()
{
$quote = Mage::getSingleton('checkout/session')->getQuote();
$quote->collectTotals();
$payment = $quote->getPayment();
$service = Mage::getModel('sales/service_quote', $quote);
$service->submitAll();
$quote->save();
$order = $service->getOrder();
$this->getSession()->setLastQuoteId($quote->getId())
->setLastSuccessQuoteId($quote->getId())
->setLastOrderId($order->getId());
{

Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
break;
case Mage_Sales_Model_Order::STATE_PROCESSING:
case Mage_Sales_Model_Order::STATE_COMPLETE:
case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW:
$order->sendNewOrderEmail();
break;
}
$this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage/success'));
return;
}


But in the above function i get the quote object as blank and due to that i am unable to place an order. This means that after returning from payment gateway it clears the checkout session.

How can i get the quote object and what is the problem ?



Please help










share|improve this question
















bumped to the homepage by Community yesterday


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




















    2














    I am building payment gateway extension and i am facing small issue to get the quote object after control return from payment Gateway.



    Let me explain you in detail.



    I am using below funtion to redirect to payment gateway.



    public function getCheckoutRedirectUrl()
    {
    return Mage::getUrl('custom/index/start');
    }


    Above method works fine. I am redirecting to payment gateway and payment processed successful with success message and redirect back to our store with captured status on below controller action.



    public function returnAction()
    {
    $quote = Mage::getSingleton('checkout/session')->getQuote();
    $quote->collectTotals();
    $payment = $quote->getPayment();
    $service = Mage::getModel('sales/service_quote', $quote);
    $service->submitAll();
    $quote->save();
    $order = $service->getOrder();
    $this->getSession()->setLastQuoteId($quote->getId())
    ->setLastSuccessQuoteId($quote->getId())
    ->setLastOrderId($order->getId());
    {

    Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
    break;
    case Mage_Sales_Model_Order::STATE_PROCESSING:
    case Mage_Sales_Model_Order::STATE_COMPLETE:
    case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW:
    $order->sendNewOrderEmail();
    break;
    }
    $this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage/success'));
    return;
    }


    But in the above function i get the quote object as blank and due to that i am unable to place an order. This means that after returning from payment gateway it clears the checkout session.

    How can i get the quote object and what is the problem ?



    Please help










    share|improve this question
















    bumped to the homepage by Community yesterday


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


















      2












      2








      2







      I am building payment gateway extension and i am facing small issue to get the quote object after control return from payment Gateway.



      Let me explain you in detail.



      I am using below funtion to redirect to payment gateway.



      public function getCheckoutRedirectUrl()
      {
      return Mage::getUrl('custom/index/start');
      }


      Above method works fine. I am redirecting to payment gateway and payment processed successful with success message and redirect back to our store with captured status on below controller action.



      public function returnAction()
      {
      $quote = Mage::getSingleton('checkout/session')->getQuote();
      $quote->collectTotals();
      $payment = $quote->getPayment();
      $service = Mage::getModel('sales/service_quote', $quote);
      $service->submitAll();
      $quote->save();
      $order = $service->getOrder();
      $this->getSession()->setLastQuoteId($quote->getId())
      ->setLastSuccessQuoteId($quote->getId())
      ->setLastOrderId($order->getId());
      {

      Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
      break;
      case Mage_Sales_Model_Order::STATE_PROCESSING:
      case Mage_Sales_Model_Order::STATE_COMPLETE:
      case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW:
      $order->sendNewOrderEmail();
      break;
      }
      $this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage/success'));
      return;
      }


      But in the above function i get the quote object as blank and due to that i am unable to place an order. This means that after returning from payment gateway it clears the checkout session.

      How can i get the quote object and what is the problem ?



      Please help










      share|improve this question















      I am building payment gateway extension and i am facing small issue to get the quote object after control return from payment Gateway.



      Let me explain you in detail.



      I am using below funtion to redirect to payment gateway.



      public function getCheckoutRedirectUrl()
      {
      return Mage::getUrl('custom/index/start');
      }


      Above method works fine. I am redirecting to payment gateway and payment processed successful with success message and redirect back to our store with captured status on below controller action.



      public function returnAction()
      {
      $quote = Mage::getSingleton('checkout/session')->getQuote();
      $quote->collectTotals();
      $payment = $quote->getPayment();
      $service = Mage::getModel('sales/service_quote', $quote);
      $service->submitAll();
      $quote->save();
      $order = $service->getOrder();
      $this->getSession()->setLastQuoteId($quote->getId())
      ->setLastSuccessQuoteId($quote->getId())
      ->setLastOrderId($order->getId());
      {

      Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
      break;
      case Mage_Sales_Model_Order::STATE_PROCESSING:
      case Mage_Sales_Model_Order::STATE_COMPLETE:
      case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW:
      $order->sendNewOrderEmail();
      break;
      }
      $this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage/success'));
      return;
      }


      But in the above function i get the quote object as blank and due to that i am unable to place an order. This means that after returning from payment gateway it clears the checkout session.

      How can i get the quote object and what is the problem ?



      Please help







      checkout quote payment-gateway






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 17 '15 at 17:49









      Amit Bera

      57.3k1474171




      57.3k1474171










      asked Oct 17 '15 at 6:02









      Sanjay JethvaSanjay Jethva

      514825




      514825





      bumped to the homepage by Community yesterday


      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 yesterday


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
























          1 Answer
          1






          active

          oldest

          votes


















          0














          After click on place order button at final step of checkout ,you can not get quote object from $quote = Mage::getSingleton('checkout/session')->getQuote();



          As per as magento,whenever a customer is click on place order button then a quote is convert to order object and unlink the session quote object from session. and just assign:





          • last quote id to checkout session variable to last_quote_id

          • Newly created order increment id to session variable
            last_real_order_id


          If you want to get order increment id & quote id then use
          $OrderIncrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId(); and
          $quote=Mage::getSingleton('checkout/session')->getLastQuoteId() respectively at returnAction



          $OrderObject=$order = Mage::getModel('sales/order');
          $order->loadByIncrementId($OrderIncrementId);


          And



          $QuoteObject = Mage::getModel('sales/quote');
          $QuoteObject->load(Mage::getSingleton('checkout/session')->getLastQuoteId());





          share|improve this answer























          • Thanks for your answer but i am using below function means public function getCheckoutRedirectUrl() { return Mage::getUrl('custom/index/start'); } when i click on save payment then i am redirected to payment gateway. Same function as paypal standard payment Gateway. I have tried code but its not working and redirect back to return action and redirected to shopping cart page with blank cart. I got quote object as blank value. Let me know
            – Sanjay Jethva
            Oct 19 '15 at 3:16













          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%2f86788%2fcant-access-quote-from-checkout-session-after-returning-from-payment-gateway%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          After click on place order button at final step of checkout ,you can not get quote object from $quote = Mage::getSingleton('checkout/session')->getQuote();



          As per as magento,whenever a customer is click on place order button then a quote is convert to order object and unlink the session quote object from session. and just assign:





          • last quote id to checkout session variable to last_quote_id

          • Newly created order increment id to session variable
            last_real_order_id


          If you want to get order increment id & quote id then use
          $OrderIncrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId(); and
          $quote=Mage::getSingleton('checkout/session')->getLastQuoteId() respectively at returnAction



          $OrderObject=$order = Mage::getModel('sales/order');
          $order->loadByIncrementId($OrderIncrementId);


          And



          $QuoteObject = Mage::getModel('sales/quote');
          $QuoteObject->load(Mage::getSingleton('checkout/session')->getLastQuoteId());





          share|improve this answer























          • Thanks for your answer but i am using below function means public function getCheckoutRedirectUrl() { return Mage::getUrl('custom/index/start'); } when i click on save payment then i am redirected to payment gateway. Same function as paypal standard payment Gateway. I have tried code but its not working and redirect back to return action and redirected to shopping cart page with blank cart. I got quote object as blank value. Let me know
            – Sanjay Jethva
            Oct 19 '15 at 3:16


















          0














          After click on place order button at final step of checkout ,you can not get quote object from $quote = Mage::getSingleton('checkout/session')->getQuote();



          As per as magento,whenever a customer is click on place order button then a quote is convert to order object and unlink the session quote object from session. and just assign:





          • last quote id to checkout session variable to last_quote_id

          • Newly created order increment id to session variable
            last_real_order_id


          If you want to get order increment id & quote id then use
          $OrderIncrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId(); and
          $quote=Mage::getSingleton('checkout/session')->getLastQuoteId() respectively at returnAction



          $OrderObject=$order = Mage::getModel('sales/order');
          $order->loadByIncrementId($OrderIncrementId);


          And



          $QuoteObject = Mage::getModel('sales/quote');
          $QuoteObject->load(Mage::getSingleton('checkout/session')->getLastQuoteId());





          share|improve this answer























          • Thanks for your answer but i am using below function means public function getCheckoutRedirectUrl() { return Mage::getUrl('custom/index/start'); } when i click on save payment then i am redirected to payment gateway. Same function as paypal standard payment Gateway. I have tried code but its not working and redirect back to return action and redirected to shopping cart page with blank cart. I got quote object as blank value. Let me know
            – Sanjay Jethva
            Oct 19 '15 at 3:16
















          0












          0








          0






          After click on place order button at final step of checkout ,you can not get quote object from $quote = Mage::getSingleton('checkout/session')->getQuote();



          As per as magento,whenever a customer is click on place order button then a quote is convert to order object and unlink the session quote object from session. and just assign:





          • last quote id to checkout session variable to last_quote_id

          • Newly created order increment id to session variable
            last_real_order_id


          If you want to get order increment id & quote id then use
          $OrderIncrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId(); and
          $quote=Mage::getSingleton('checkout/session')->getLastQuoteId() respectively at returnAction



          $OrderObject=$order = Mage::getModel('sales/order');
          $order->loadByIncrementId($OrderIncrementId);


          And



          $QuoteObject = Mage::getModel('sales/quote');
          $QuoteObject->load(Mage::getSingleton('checkout/session')->getLastQuoteId());





          share|improve this answer














          After click on place order button at final step of checkout ,you can not get quote object from $quote = Mage::getSingleton('checkout/session')->getQuote();



          As per as magento,whenever a customer is click on place order button then a quote is convert to order object and unlink the session quote object from session. and just assign:





          • last quote id to checkout session variable to last_quote_id

          • Newly created order increment id to session variable
            last_real_order_id


          If you want to get order increment id & quote id then use
          $OrderIncrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId(); and
          $quote=Mage::getSingleton('checkout/session')->getLastQuoteId() respectively at returnAction



          $OrderObject=$order = Mage::getModel('sales/order');
          $order->loadByIncrementId($OrderIncrementId);


          And



          $QuoteObject = Mage::getModel('sales/quote');
          $QuoteObject->load(Mage::getSingleton('checkout/session')->getLastQuoteId());






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Oct 17 '15 at 18:38

























          answered Oct 17 '15 at 18:26









          Amit BeraAmit Bera

          57.3k1474171




          57.3k1474171












          • Thanks for your answer but i am using below function means public function getCheckoutRedirectUrl() { return Mage::getUrl('custom/index/start'); } when i click on save payment then i am redirected to payment gateway. Same function as paypal standard payment Gateway. I have tried code but its not working and redirect back to return action and redirected to shopping cart page with blank cart. I got quote object as blank value. Let me know
            – Sanjay Jethva
            Oct 19 '15 at 3:16




















          • Thanks for your answer but i am using below function means public function getCheckoutRedirectUrl() { return Mage::getUrl('custom/index/start'); } when i click on save payment then i am redirected to payment gateway. Same function as paypal standard payment Gateway. I have tried code but its not working and redirect back to return action and redirected to shopping cart page with blank cart. I got quote object as blank value. Let me know
            – Sanjay Jethva
            Oct 19 '15 at 3:16


















          Thanks for your answer but i am using below function means public function getCheckoutRedirectUrl() { return Mage::getUrl('custom/index/start'); } when i click on save payment then i am redirected to payment gateway. Same function as paypal standard payment Gateway. I have tried code but its not working and redirect back to return action and redirected to shopping cart page with blank cart. I got quote object as blank value. Let me know
          – Sanjay Jethva
          Oct 19 '15 at 3:16






          Thanks for your answer but i am using below function means public function getCheckoutRedirectUrl() { return Mage::getUrl('custom/index/start'); } when i click on save payment then i am redirected to payment gateway. Same function as paypal standard payment Gateway. I have tried code but its not working and redirect back to return action and redirected to shopping cart page with blank cart. I got quote object as blank value. Let me know
          – Sanjay Jethva
          Oct 19 '15 at 3:16




















          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2f86788%2fcant-access-quote-from-checkout-session-after-returning-from-payment-gateway%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

          An IMO inspired problem

          Management

          Has there ever been an instance of an active nuclear power plant within or near a war zone?