I'm using Magento CE 1.7. I have several stores in admin panel. I want to get both the enabled and disabled products collection in admin panel when create new order. When click the add Products button the grid should all the products(even if they are expired, disabled, out of stock or whatever the status) under the current store. How can I get this collection?

Please any help will be appreciated.

EDIT: Override the block class Mage_Adminhtml_Block_Sales_Order_Create_Search_Grid

Edited the following function.

protected function _prepareCollection()
   $currentStore = Mage::getSingleton('adminhtml/session_quote')->getStore();
    $collection = Mage::getModel('catalog/product')->getCollection();

            ->addAttributeToFilter('type_id', array_keys(

In the method Mage_Adminhtml_Block_Sales_Order_Create_Search_Grid::_prepareCollection there is this line that filters only in stock products: Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($collection);
But changing this might lead to other issues since there are verifications when placing the order for example in Mage_Adminhtml_Block_Sales_Order_Create_Items_Grid::getItems.
But it's a good place to start.

  • I followed what you have suggested. I got the results as expected. I have put the code under EDIT in my question. Thank you so much. – Sukeshini Sep 23 '13 at 11:51

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.