0

i want to rewrite the product grid like this

 protected function _prepareCollection() {

    parent::_prepareCollection();


    $this->getCollection()->addAttributeToFilter('supplier', array('eq' => 11));


    return $this;


 }

config.xml

   <blocks>
       <adminhtml>
           <rewrite>
               <catalog_product_grid>Namespace_Modulenam_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
           </rewrite>
       </adminhtml>
   </blocks>

the supplier is a custom attribute, i want the products show only according to the supplier attribute, the above code still show all the products, anyone know what's wrong with about code?

2
  • add more information. how you rewrite, show your config etc.
    – Sohel Rana
    Commented Aug 10, 2016 at 5:49
  • i've updated my question
    – hkguile
    Commented Aug 10, 2016 at 5:58

1 Answer 1

0

this should be the solution

http://www.drewgillson.com/blog/gotcha-dealt-problem-overloading-magentos-adminhtml-grid/

need to copy entire _preparecollection() and comment out

parent::_prepareCollection();

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.