Friday, 24 February 2012

How To Change Order Status in Magento1.6

I searched all around to find this solution. In Magento Commerce, there is no provision for manually changing order status from the admin panel. I have also try to change in Magento\app\code\core\Mage\Sales\etc\config.xml file but i cant change in magento1.6. so finally i got below solution i hope this work for you.

Open file app\design\adminhtml\default\default\template\sales\order\view\history.phtml in this file.

Also replace the code.

<?php foreach ($this->getStatuses() as $_code=>$_label): ?>
                
            <?php endforeach; ?>

with

                <?php 
                $selected = "";
                foreach (Mage::getSingleton('sales/order_config')->getStatuses() as $_code=>$_label): 
                    if($_code==$this->getOrder()->getStatus())
                            $selected = 'selected="selected"';
                    echo "";
                endforeach;?>

Its works perfectly for me i hope its work for you.

14 comments:

  1. how would u do this by not overriding the core files and creating it as its own module?

    ReplyDelete
    Replies
    1. I have use it using overriding the code files of magento.

      Delete
  2. works a treat! awesome stuff, maybe instead of reading the data from the array its read directly from the database instead, incase people put custom order statuses

    ReplyDelete
    Replies
    1. Thanks Jay for suggestion i will update you soon.

      Delete
    2. I have update it. you can see in above code all status are fetched dynamically.

      Delete
    3. Hey Ram

      And idea on how i can make it update the state value as well?

      problem is if one item goes to state value fraud, updating the status doesnt make it avaiilable to invoice and go ahead with the order

      Delete
  3. HI ram, awesome stuff mate. im trying to sort it out though so the "state" updates according to the status value too.

    I hope that makes sense?

    ReplyDelete
  4. Is a same thing for magento 1.7 ?
    I try replace the code in magento 1.7, but not realy works.

    You can help-me, please....

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. In Magento 1.7, replace:

    foreach ($this->getStatuses() as $_code=>$_label):

    With:

    foreach (Mage::getSingleton('sales/order_config')->getStatuses() as $_code=>$_label):

    ...and it will work.

    ReplyDelete
    Replies
    1. Just replace the code above, don't worry with replacing the entire foreach block because it won't work, just follow above.

      Delete
    2. thanks
      very uses full script

      Delete
  7. Dear Friends,

    It is not working after changing the code

    when we click to check the order detail it dose not show any thing other then a screen of written information nothing else.

    I am using 1.7.0.2 magento.

    Need help.

    ReplyDelete
  8. thanks, works perfectly. Only 1 exception. I had to change line 6 to

    echo '< option value="'.$_code.'" '.$selected.'="">'.$_label.'< /option>';

    (had to add blanks before "option" and "/option" to avoid your html-commentvalidation)

    ReplyDelete