I have a problem on frontend with the sales order history info. I have added a custom order status on admin, "custom_state".
In the customer control panel, in the order history (/sales/order/history/) I could not see the orders until I modified the file app/code/core/Mage/Sales/Block/Order/History.php
$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())) ->addFieldToFilter('state', array('in' => array(0 => 'custom_state', 1 => 'all the other states...'))) ->setOrder('created_at', 'desc') ;
Now, I can see the all the orders, but when i try to go to see the order information (/sales/order/view/order_id/100/) with 'custom_state' I'm being redirected at the same page (sales/order/history/). With all the default magento states I can see the info of the order.
Which file i have to edit, or what can i do to see this order information on frontend for the orders with that state?
Solved! Go to Solution.
First please remove the custom changes you have made in the core files (i.e - file app/code/core/Mage/Sales/Block/Order/History.php) as making changes in the core files is not a good practice.
May be you have missed anything while creating the Custom status, so Please follow the steps to create a custom order status :
STEP 1 : Create a custom order status :
-> select System > Order Statuses.
-> click the Create New Status button.
-> In the Order Status Information section, Enter a Status Code and Enter a Status Label to identify the status setting in both the Admin and store.
-> In the Store View Specific Labels section, enter labels for different store views and languages.
-> click the Save Status button.
The new order status is now listed in the Order Statuses list.
STEP 2 : Assign an order status to a state :
-> Click the Assign Status to State button.
-> In Assignment Information section, Select Order Status that you want to assign, now Select the Order State to which you want to assign your order status. Select the Use Order Status as Default checkbox if you want to make this status the default for the order state and at the end click the Save Status Assignment button.
Now You have successfully assigned Your Custom status to the state.
I have followed the same and created a custom status "customcheck" and assigned it to "[Processing" state and can easily access the order history (/sales/order/history/) and see the order information (/sales/order/view/order_id/16/) with custom status "customcheck" after placing fresh order.
I hope it works for you too.
Friday 1 September 2017