2
votes

I have created some custom statuses beyond the default Magento statuses.

When I grab an order to send to production, I set the status in Magento via the API. Problem is, if the order is set to one of these custom statuses, it doesn't show the order in the My Account Order History area for the customer.

What do I need to do to show these orders in the My Account Order History area, that have my custom statuses currently set?

For question sake, this status is called "New Status" and I have assigned it to the processing state.

2

2 Answers

3
votes

Short answer... merge this with app/code/core/Mage/Sales/config.xml or (better) add this to a config.xml in your own local module. Modifying core files is frowned upon (but happens).

Change new_status to your status.

<config>
    <global>
        <sales>
            <order>
                <statuses>
                    <new_status translate="label">
                        <label>New Status</label>
                    </new_status>
                </statuses>
                <states>
                     <new_status translate="label">
                          <label>New Status</label>
                          <statuses>
                              <new_status default="1"/>
                          </statuses>
                          <visible_on_front>1</visible_on_front>
                     </new_status>
                 </states>
             </order>
        </sales>
    </global>
</config>

Long answer: See Mage_Sales_Block_Order_History specifically, the piece that grabs the order collection

$orders = Mage::getResourceModel('sales/order_collection')
    ->addFieldToSelect('*')
    ->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
    ->addFieldToFilter('state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()))
    ->setOrder('created_at', 'desc')

The second addFieldToFilter looks for order states within a set of "visible" states. Those set of states are pulled by Mage_Sales_Order_Config, and are set in the configuration. See above for the configuration changes. You can look in Mage_Sales_Order_Config and the function _getStates() to see how it pulls these from the configuration.

0
votes
    Suppose your custom order status is paymentsuccess in magento   order_status table
<config>
  <global>    
   <sales>
        <order>
            <statuses>
                <paymentsuccess translate="label">
                    <label>Payment Successful</label>
                </paymentsuccess>
            </statuses>
            <states>
                 <paymentsuccess translate="label">
                      <label>Payment Successful</label>
                      <statuses>
                          <paymentsuccess default="1"/>
                      </statuses>
                      <visible_on_front>1</visible_on_front>
                 </paymentsuccess>
             </states>
         </order>
    </sales>
</global>
</config>