When you click on a customer in "manage customers" and then "create order", my client does not want to see the disabled products come up in the list for products to add to order. Any idea how I would go about changing this? Or at least some file location hints, lol.

I'm editing the following per below advice.

 protected function _prepareCollection()
        $attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
        /* @var $collection Mage_Catalog_Model_Resource_Product_Collection */
        $collection = Mage::getModel('catalog/product')->getCollection();
            ->addAttributeToFilter('type_id', array_keys(
            ->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);

        return parent::_prepareCollection();

As you can see I added ->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED); but am getting following error:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/ab71714/public_html/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid.php on line 109

  • 2
    Don't edit the core. If you must, copy the file and the full path into app/code/local.
    – philwinkle
    Apr 17 '13 at 22:23

The class you are looking for is: Mage_Adminhtml_Block_Sales_Order_Create_Search_Grid

Override the _prepareCollection() and add a filter to the $collection like so:

$collection->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)

This should filter all disabled products and only show enabled ones. Tested with CE 1.7

Hope this helps!

  • I get an error. See above. Thank you so much for your help! Apr 11 '13 at 21:51
  • Oh wait, im such a dummy! it has to go after Mage::getSingleton('catalog/product_status'). Works now! THank you!!! Apr 11 '13 at 21:55

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.