Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7991771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:23:15+00:00 2026-06-04T13:23:15+00:00

I would just like to know what is that one property which when set

  • 0

I would just like to know what is that one property which when set would mark the order as failed so that failureAction() of app/code/core/Mage/Checkout/controller/OnepageController.php gets called.

I have an Observer.php where in I’m creating invoice for successful payments and for failed payments saving order with pending_payment status and wanting to redirect them to the cart page with an error message at the top.

All this happens fine. Just that for unsuccessful / failed payments, along with saving the order with pending_payment status n redirecting them to cart page with error message, I would also like to retain/save the cart from getting empty.

But to no luck

Observer.php

 public function implementOrderStatus($event)
 {
    $order = $event->getEvent()->getOrder(); 
    if ($this->_getPaymentMethod($order) == 'mypaymentmodule') 
    {
                $quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
        if($order->getPayment()->getCcTransId() == NULL)
        {
            $order->cancel();
            $order->setStatus('canceled');
            $order->save();
            $quote->setIsActive(1)->save();
            /*$state = 'pending_payment';
            $status = 'pending_payment';
            $comment = 'Payment transaction failed due to incorrect AVS/CVD details.';
            $isNotified = false;
            $order->setState($state,$status,$comment,$isNotified)->save();
            $order->setCanSendNewEmailFlag(false);*/

            Mage::getSingleton('checkout/session')->addError('Sorry, either of your card information (billing address or card validation digits) dint match. Please try again');                 

            Mage::app()->getFrontController()->getResponse()->setRedirect('checkout/cart/')->sendResponse();
        }
       else
       {
           if ($order->canInvoice())

            $this->_processOrderStatus($order);
       }
    }
    return $this;
}

But $quote->setIsActive(true)->save() does not seem to be doing the trick. Any help as to how can I save my cart from getting empty after saving the order with ‘canceled’ status.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:23:16+00:00Added an answer on June 4, 2026 at 1:23 pm

    You maybe should have a look at ./app/code/core/Mage/Sales/Model/Order.php. There you will find several constants for an order, which may be used to set the state of an order like this:

    <?php
    // [...] all your code within your custom action or script
    
    //load your order by order_id (or by increment_id, if you like to, here, it's your order id
    $order = Mage::getModel('sales/order')->load($your_order_id);
    $order->setState(Mage_Sales_Model_Order::STATE_CANCELED); //or whatever distinct order status you'd like
    $order->save();
    

    The failureAction in the controiller action does nothing of the sort, if you want to call it manually, you can build it’s url using Mage::getUrl()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am just learning and would like to know about a piece of code
I am new to coding and would just like to know a bit more
I just would like to know if it is possible (and if yes how)
I'd like to allow a user to add a shape (which would just be
I know many developers just do it like this: They start developing their app
I would just like your feedback on something. Basically I have a value called
I am pretty sure I cannot, but I would just like to double check
I have an std::vector<unsigned char> with binary data in. I just would like to
I would like to upload files just like google mail does. I would want
Normally I would just use URL GET parameters but CodeIgniter doesn't seem to like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.