1

I have a client that needs to be able to filter orders they placed. Is there a way to do it when they try to use "View All" when viewing "My Account"?

2
  • What filters are you trying to apply? Date? Order Status? Payment method? Be specific.
    – philwinkle
    Commented Jul 16, 2013 at 13:51
  • Date, Order Status, Ship To.
    – Karlson
    Commented Jul 16, 2013 at 13:58

1 Answer 1

2

Not out of the box. In an unmodified Magento instance the orders in the customer history are selected as follows:

/* See Mage_Sales_Block_Order_History::__construct() */
$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');

In addition, the pager block applies the paging (in Mage_Page_Block_Html_Pager::setCollection()):

$collection->setCurPage($this->getCurrentPage());
$collection->setPageSize($this->getLimit());

If you want to add additional filtering capabilities you need to create an extension which provides the user interface for that and then applies those settings to the collection before it's loaded (which happens when Mage_Sales_Block_Order_History::_prepareLayout() is called.

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.