cancel
Showing results for 
Search instead for 
Did you mean: 

How to Remove Deleted Orders From admin Sales Order

SOLVED

How to Remove Deleted Orders From admin Sales Order

Hi,

 

I have run the following php scripts to delete the Test Orders,

require 'app/Mage.php';
Mage::app('admin')->setUseSessionInUrl(false);
$orderIds=array(
  '500000062',
);

foreach($orderIds as $id){
    try{
        Mage::getModel('sales/order')->loadByIncrementId($id)->delete();
        echo "Deleted";
    }catch(Exception $e){
        echo $e->getMessage();
    }
}

I checked this code at my localhost and it was working fine. At Server, the record is deleted, but still persists on the sales order grid view. When I am clicking the record, given me the error message 'the record no longer exists '. 

 

I want to remove deleted order records from the grid view, also want to know why the code works fine at localhost not server.

I hope someone will help me on this.

 

Thanks,

Gayathri S

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to Remove Deleted Orders From admin Sales Order

If you have deleted the order, but it is still seen in the Orders Grid (even after you have refreshed the cache), the problem might be caused by the foreign key. The foreign key in the sales_flat_order_grid may not be working. 


Delete the record from there as well, and tell us if it helped. 

______________________________________________________________
Innovative, top-performing Magento Extensions (with an array of FREE tools).

View solution in original post

3 REPLIES 3

Re: How to Remove Deleted Orders From admin Sales Order

If you have deleted the order, but it is still seen in the Orders Grid (even after you have refreshed the cache), the problem might be caused by the foreign key. The foreign key in the sales_flat_order_grid may not be working. 


Delete the record from there as well, and tell us if it helped. 

______________________________________________________________
Innovative, top-performing Magento Extensions (with an array of FREE tools).

Re: How to Remove Deleted Orders From admin Sales Order

Thanks for the Reply..

It's working now. I got to know why its working in localhost.

Also clearly understand the magento orders table.

 

Re: How to Remove Deleted Orders From admin Sales Order

Hi @Gayathrivintonz 

Did you tried running the indexer from shell?

I was able to fix a similar issue with Customers grid but I'm not sure if Sales grid can be reindexed.