1

I created a custom order status like below.

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?

UPDATE : 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();

system->Order Statuses Screen enter image description here

1

after creating programatically invoice you have to set state and status for that

$invoice->getOrder()->setIsInProcess(true);
$order->setData('state', Mage_Sales_Model_Order::STATE_PROCESSING);
$order->setStatus(Mage_Sales_Model_Order::STATE_PROCESSING);
$history = $invoice->getOrder()->addStatusHistoryComment(
    'created invoice', true
);
$invoice->sendEmail(false, '');              
$order->save();

second solution

you use the default magento state with custom status that will solved you problem.

  • Thank you.Here i am not creating invoice pragmatically.I created the invoice from the admin panel only. and why it is not showing in my account area too? – Mujahidh Jan 5 '17 at 13:09
  • @Qaisar.I cannot understand what u r telling.Can you please update your answer – Mujahidh Jan 5 '17 at 13:23
  • @mujas i am trying to there is backorders attach with backorders as you can see in admin panel > system > order statuses you can assign state to status their only check that – Qaisar Satti Jan 5 '17 at 13:42
  • it's showing, I updated the question with the image – Mujahidh Jan 5 '17 at 13:49
  • @mujas i think you are talking about this question i update my solution here too – Qaisar Satti Jan 6 '17 at 10:07
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, privacy policy and cookie policy

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