0

How would I restrict access to only show completed orders in the admin for one user or role? This employee only needs to see new pending orders, and I don't want this employee to be able to look back through the history of old completed orders. Whenever there is an issue with an order, her supervisor handles it.

Right now she can export the entire order history, because I want her to be able to export pending orders. Ideally I would prevent her from even looking up old orders, but at a minimum I just want to restrict what's shown in the order grid to make it difficult for her to see completed orders. Thanks.

1 Answer 1

0

Try creating an admin observer for

In config.xml

<sales_order_grid_collection_load_before>
    <observers>
        <magepal>
            <type>singleton</type>
            <class>magepal/observer</class>
            <method>handleOrderCollectionLoadBefore</method>
        </magepal>
    </observers>
</sales_order_grid_collection_load_before>

In Observer.php

public function handleOrderCollectionLoadBefore($observer) 
{  
    if(userid){
        $collection = $observer->getOrderGridCollection();
        if ($collection){
            //$collection->addFieldToFilter('status', array('in' => array('complete')));
            $collection->addFieldToFilter('state', 'complete');
        }
    }

}

See Adding A Column To Magento Orders Grid - Alternative Way Using Layout Handles

2

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.