2

I created a custom order status like below.(This is a big issue that i am simply missing some small stuff and hope to figure out with the help of a member).

config.xml

<sales>
    <order>
        <statuses>
          <backorders translate="label">
            <label>Back Orders</label>
          </backorders>
        </statuses>
        <states>
          <backorders translate="label">
            <label>Back Orders</label>
            <statuses>
              <backorders default="1"/>
            </statuses>
          </backorders>
        </states>
   </order>
</sales>

mysql script

<?php
$installer = $this;
$installer->startSetup();
// Required tables
$statusTable = $installer->getTable('sales/order_status');
$statusStateTable = $installer->getTable('sales/order_status_state');

// Insert statuses
$installer->getConnection()->insertArray(
    $statusTable,
    array('status', 'label'),
    array(
        array(
            'status' => 'backorders', 
            'label' => 'Back Order'
        )
    )
);

// Insert states and mapping of statuses to states
$installer->getConnection()->insertArray(
    $statusStateTable,
    array('status', 'state', 'is_default'),
        array(
            array(
                'status' => 'backorders', 
                'state' => 'backorders', 
                'is_default' => 1
            )
        )
    );
$installer->endSetup();

During the back order the order status is saved to backorders and it will show in the admin panel order list. My question is the same order is not showing in the customers my account recent orders section.

Why this orders under status of backorders not showing in recent orders page?

In the admin panel if we create an invoice the order status is changed to Processing, but if i create an invoice for the orders wich belongs to backorders are not changed to Processing.But if i completed the shipping for backorders order it will change the order status to Completed

What is the issue causing this?

This is how i update the order status in the observer

$order->setData('state', 'backorders');
$order->setStatus('backorders');
$history = $order->addStatusHistoryComment('', false);                 
$history->setStatus('backorders')->setData('state', 'backorders')->setIsCustomerNotified(false);               
$order->save();

After order saved(with the status of backorders) the success screen is like below. enter image description here

if i update the order status like this everything is fine.

$order->setData('state', 'processing');
$order->setStatus('processing');
$history = $order->addStatusHistoryComment('', false);                 
$history->setStatus('processing')->setData('state', 'processing')->setIsCustomerNotified(false);               
$order->save();

After order saved(with the status of processing) the success screen is like below. enter image description here

I can clearly understand there were some issue with custom created status.but i cannot found out why was that.

5
  • did you tried by changing the status only not state mean state is new and status is backorder. Commented Jan 6, 2017 at 6:22
  • i assigned the status backorders to state backorders in the installer script right?
    – Mujahidh
    Commented Jan 6, 2017 at 6:27
  • just for testing may be it's state issue. Commented Jan 6, 2017 at 6:29
  • i too guessing the same, how can i overcome this?Please help me
    – Mujahidh
    Commented Jan 6, 2017 at 6:30
  • 1
    $order->setData('state', 'new'); $order->setStatus('backorders'); $history = $order->addStatusHistoryComment('', false); $history->setStatus('backorders')->setData('state', 'new')->setIsCustomerNotified(false); $order->save(); do something like that Commented Jan 6, 2017 at 6:31

2 Answers 2

1

There was state issue use default state new and set your status on that backorders

$order->setData('state', 'new'); $order->setStatus('backorders'); 
$history = $order->addStatusHistoryComment('', false); 
$history->setStatus('backorders')->setData('state', 'new')->setIsCustomerNotified(false); 
$order->save();
3
  • Thank you, what did you edit on my question,I cannot figure out
    – Mujahidh
    Commented Jan 6, 2017 at 6:45
  • @mujas removed extra tag Commented Jan 6, 2017 at 6:45
  • thanks. yesterday question also same.Unable to get an answer for that, so i re post it.
    – Mujahidh
    Commented Jan 6, 2017 at 6:46
0

I have got the solution for that:

you need go to this File Path : app/code/core/Mage/Sales/Block/Order/History.php

and comment of this code

->addFieldToFilter('state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()))

It will be work.

Thanks !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.